Overview

The ROSE data dictionary stores EXPRESS definitions as RoseDomain and RoseAttribute objects. Each domain has a list of attributes and each attribute stores a name and a data type. An entity domain stores the explicit attributes defined by the entity. Select and aggregate domains also have attributes, but these attributes have generated names and indicate the types of values that can be held by the select or aggregate. Aggregate domains only have one attribute while selects have attributes for each underlying type. EXPRESS Data Dictionary describes how these objects are used.

is<type>()

RoseBoolean isAggregate();
RoseBoolean isBinary();
RoseBoolean isBoolean();
RoseBoolean isDouble();
RoseBoolean isEntity();
RoseBoolean isEnumeration();
RoseBoolean isFloat();
RoseBoolean isInteger();
RoseBoolean isLogical();
RoseBoolean isObject();
RoseBoolean isPrimitive();  // deprecated, use isSimple()
RoseBoolean isSelect();
RoseBoolean isSimple();
RoseBoolean isString();

The is<type>() functions test the general data structure stored by an attribute. The slotNodeType() function can aslo be used to return an enumeration of similar information. The is<type>() functions is useful in a conditional statement and the RoseNodeType value from slotNodeType() is more useful in a switch statement. For detailed type information, use the slotDomain() function.

The isSimple() function returns true if the underlying type of the attribute is one of the EXPRESS simple types (integer, real, string, boolean, logical, binary, or an enumeration). The isObject() function is the opposite of isSimple(). The isObject() function returns true if the underlying type of the attribute is a reference to an object type (entity, aggregate, or select).

isOptional()

RoseBoolean isOptional();

The isOptional() function returns true if the attribute was declared OPTIONAL in the original EXPRESS.

name()

char * name();

The name() function returns the name of the attribute. Only entity definitions have attributes with meaningful names. The names of select attributes are generated by prepending an underscore to the name of the attribute type and the name of an aggregate attribute is taken directly from the attribute type.

nonPersistentView()

RoseAttribute * nonPersistentView();

Each RoseDomain keeps a two lists of attributes. The first list contains attributes defined by the domain. These are sometimes called immediate attributes and are stored in the ROSE compiled schema file.

The second list contains inherited as well as locally defined attributes and is constructed when a domain is read into memory. It is constructed by making non-presistent copies of each local or inherited attribute. Each non-persistent copy keeps a pointer back to the original persistent object. The copies hold extra C++ specific information such as offsets and byte alignment, that is used internally by the ROSE library.

The nonPersistentView() function returns searches the owning domain for a non-persistent copy of the RoseAttribute. If the attribute is already a non-persistent view, the function returns the same object. The nonPersistentViewIn() function is used to find the copy in a particular domain. The persistentView() function finds the immediate attribute that an attribute was copied from. These functions are mostly for internal use.

RoseAttribute * att; 
printf (The %s attribute is defined by the %s type\n,
	att-> name(),
	att-> persistentView()-> slotDomain()-> name());

nonPersistentViewIn()

RoseAttribute * nonPersistentViewIn (
	RoseDomain * domain
	);

The nonPersistentViewIn() function searches the supplied domain for a non-persistent copy of the attribute. Refer to the nonPersistentView() function for more information on the non-persistent attribute copies.

persistentView()

RoseAttribute * persistentView();

The persistentView() function returns the original peristent immediate attribute that this attribute was copied from. If the object is already an immediate attribute the function returns the same object. Refer to the nonPersistentView() function for more information on the non-persistent attribute copies.

slotDomain()

RoseDomain * slotDomain();

The slotDomain() function returns the EXPRESS data definition for the type of data that can be stored in the attribute.

The example below prints out some information about the attributes of a domain.

RoseDomain * domain;
RoseAttribute * att;
ListOfRoseAttribute * atts;
unsigned i, sz;

atts = domain-> typeAttributes();
printf (Printing the attributes of %s\n, domain-> name());
for (i=0, sz=atts-> size(); i<sz; i++) {
    att = atts-> get(i);
    printf (Attribute %s\n, att-> name());
    printf (EXPRESS Type %s\n, att-> slotDomain()-> name());
    printf (C++ Type %s\n,     att-> slotRoseType()-> name());
}

slotNodeType()

RoseNodeType slotNodeType();

The slotNodeType() function returns an enumeration value indicating the basic category of EXPRESS data that can be stored in the attribute.

slotOwner()

RoseDomain * slotOwner();

The slotOwner() function returns the domain that the attribute is part of. Note that each attribute is owned by only one domain. Attributes that are inherited are copied and the copy points to the inheriting class. Use persistentView() to find the original.

RoseAttribute * att; 
printf (The %s attribute is part of the %s definition\n,
	att-> name(), att-> slotOwner()-> name());
printf (And was originally defined by the %s type\n,
	att-> persistentView()-> slotDomain()-> name());

slotRoseType()

RoseTypePtr& slotRoseType();

The slotRoseType() function returns the RoseType definition for the C++ type of data that can be stored in the attribute. Refer to slotDomain() for an example.