Using Group Definitions

A group definition specifies a type of group based on the managed types of objects that the group can contain and in which databases the group can be created. A group definition consists of:

A group definition is one of two oaGroupDef derived types. oaFlatGroupDef is an oaGroupDef derived object, which defines a group that may contain only managed types of objects; it may not contain other groups as members. oaHierGroupDef is an oaGroupDef derived object, which defines a group that may contain both managed objects and other groups as members.

When an oaGroup is created, the GroupDef defines what type of group it is. This in turn determines the types of objects that can be added to the group when using oaGroupMem::create().

OpenAccess provides a number of built-in definitions that implicitly use an oaGroupPurposeType. The oaGroupDef::get function takes an oaGroupPurposeType and returns pointer to a pre-created oaGroupDef. At startup, the built-in group definitions are created for each of the oaGroupPurposeType values. These built-in group definitions provide for the commonly used types of groups, which you can augment with your own definitions. The built-in group definitions use the following oaGroupPurposeTypes:

The following table describes the semantics for these group purpose types and the associated built-in group definitions.

oaGroupPurposeTypeEnum Description Objects
Unrestricted The oacUnrestrictedGroupPurposeType is associated with the oaHierGroupDef definition and specifies that all types of objects and all types of other groups can be members of the group. Usually, if a group definition allows other groups as members, the member groups are restricted to groups that have the same group definition as the containing group. The Unrestricted type does not have this restriction, and it can contain any group regardless of its definition. This definition is identical to the definition that is implied in databases based on dataModels that preceded dataModel 4. Any object or oaGroup
Differential Net Pair The oacDiffNetPairGroupPurposeType is associated with the oaFlatGroupDef definition and specifies that the group may only contain oaBitNet objects as members and implies that the group consists of a net pair.

oaBitNet
Matched Nets The oacMatchedNetGroupPurposeType is associated with the oaFlatGroupDef definition and specifies that the group may only contain oaBitNet objects as members. oaBitNet
Nets The oacNetGroupPurposeType is associated with the oaFlatGroupDef definition and specifies that the group may only contain oaNet objects. oaNet
Nets and Groups The oacNestedNetGroupPurposeType is associated with the oaHierGroupDef definition and specifies that the group may only contain oaNet objects and other groups that are also associated with the oacNestedNetGroupPurposeType definition. oaNet, oaGroup
Symmetric Nets The oacSymmetricNetGroupPurposeType is associated with the oaFlatGroupDef definition and specifies that the group may only contain oaBitNet objects. oaBitNet

User Defined Group Definitions

User-defined group definitions can be used to create object groups that are specific to a user or application requirement. For example, you might restrict the valid types or valid databases to a set of object types that are different from a built-in group definition.

A group definition uses an oaManagedTypeArray object to identify the members that are allowed in an associated group. The list of allowed objects always comprises one or more managed objects. If the only element of the oaManagedTypeArray is the oaObject type of object, group membership is unrestricted because oaObject is the base class for all managed objects.

Abstract and Concrete Object Types

The managed object types can be classified in two general categories:

Specifying abstract objects such as oaNet, oaFig, oaPin, or oaTechObject as the allowed group members implies that all concrete types derived from these classes can also be members of those groups associated with the definition. For example, specifying oaNet as an allowed member in a group definition implies that oaBundleNet, oaBusNet, oaScalarNet, and oaBusBitNet are also allowed members. If a new derived oaNet type is defined later, that new derived type will be automatically recognized as an allowed member type for the group. See oaAbstractType for a complete listing of the OpenAccess abstract object types. When the list of allowed types are only concrete types, only the types specified by the definition are allowed. Other concrete types derived from the same abstract base class are not implied.

The oacUnrestrictedGroupPurposeType group definition is intended to include any other group as a member. In contrast, all other built-in group definitions are intended to include only groups of the same type. This means that for built-in group definitions other than oacUnrestrictedGroupPurposeType, groups should be associated with the same group definition.

Adding an object that is not allowed by the group definition is an error, and adding a non-managed object, such as oaString, is also an error.

Associating a Group Definition

You create a group by using one of the oaGroup::create() functions. The oaGroupDef object did not exist prior to dataModel 4. Therefore, overloaded oaGroup::create() functions are provided to create groups associated with a group definition, and others are provided to create groups compatible with the earlier dataModels that do not support a group definition. All groups created in databases based on dataModel 4 or later must use group definitions.

Databases that use a built-in group definition (other than oacUnrestrictedGroupPurposeType) or use a user-defined group definition, cannot be opened by applications that are not based on dataModel 4 or later. Group data in databases that predate dataModel 4 is associated with the oacUnrestrictedGroupPurposeType when read by applications that are based on libraries using dataModel 4 or later.