Each group may be ``owned'' by another group. This idea of ownership may be used to establish associations between groups. Many groups may be associated together into a sort of ``super-group'', or group of groups, by making one group the owner of another, which in turn is the owner of another, and so on. These associations are provided for the benefit of the calling application, which can impose any meaning it likes on the associations. The only significance of these associations within the GRP package is that when a group is deleted (using GRP_DELET), all other groups in the same ``super-group'' (i.e. all groups which have an association, either directly, or indirectly, with the specified group) are also deleted.
An example of the use of these associations is to provide a means of attaching supplemental information to a group describing the global properties of the group. For instance, consider an application which uses groups to store information about spiral galaxies. Group A may contain the names 1232, 628, 5364, and group B may contain 81, 31. It may be necessary to store supplemental information describing each of these groups, for instance the catalogue to which the numbers in groups A and B refer, the morphological type, and so. A new group C could be created holding the names NGC and ScI, giving the catalogue and type of the galaxies in group A. This group could then be associated with group A. Similarly a group D could be created holding the names Messier and Sb, and associated with group B.
Three routines are included in the GRP package for handling these associations; GRP_SOWN establishes one group as owner of another, GRP_OWN returns the identifier of the group which owns a specified group, and GRP_HEAD returns the group at the head of an owner-slave chain. Groups are ``free'' (i.e. are not owned by any other group) when they are created. A group which has had an owner established for it can be made free again by calling GRP_SOWN giving a null group (GRP__NOID) as the ``owner''. A group may not be owned by more than one group, and may itself own a maximum of one group. It is thus possible to establish ``chains'' of owner-slave associations (but not ``tree structures''). All the groups in such a chain form a ``super-group'' of inter-dependant groups. When an attempt is made to delete any group within such a super-group, all the other groups in the same super-group are also deleted whether higher or lower in the chain.
The owner-slave relationship is strictly one way; a group cannot own its own
owner, or equivalently be a slave of its own slave. If an attempt is
made to set up such an association using GRP_SOWN, then an error is reported,
and STATUS is returned set to GRP__SLAVE. Thus if group A is owned by group B,
and group B is owned by group C, group C may not be owned by either group A or
group B.
GRP Routines for Managing Groups of Objects