Overview

The RoseReference class represents a external reference to an instance in another file. It is a ROSE library internal object and is kept in a separate data section. It is roughly equivalent to the EXPRESS shown below, but when saved to a P21 file, will appear in the P21e3 REFERENCE section, rather than as an instance in the DATA section.

ENTITY RoseReference; 
    uri:	STRING;
    resolved:  	RoseObject;
END_ENTITY;

Use rose_ref_put() to associate a reference with a particular object field and rose_ref_get() to find a reference associated with a field. See References Between Data Sets for more information on linking STEP files using the mechanisms introduced by the third edition of the Part 21 format.

RoseReference Constructor

A RoseReference object is a subtype of RoseObject, but instances should be created using the rose_ref_make() function to make sure that the object is put into the special data section reserved for external references.

isResolved()

int isResolved();
The isResolved() member returns true if the reference is has been resolved to an in-memory object. This function just tests whether resolved() is not null.

isUsed()

int isUsed();
The isUsed() member returns true if the reference is used by the attributes of any other object. This function just tests whether usage() is not null.

remove_usage()

void remove_usage()

The remove_usage() function removes all associations between the external reference and any fields that use it. The RoseReference object is left without any usages, but it is still present and will appear in the REFERENCE section when the design is saved. Move the RoseReference to the trash or call the C++ delete operator to delete it from the design.

Use rose_ref_remove() to clear a reference from a particular field. Deleting the reference object will also remove all usage.

resolve_usage()

RoseBoolean resolve_usage (RoseObject * obj);

The resolve_usage() function sets the resolved() value of the reference and assigns that value to all fields in the usage() list. The function returns true if all assignments succeeded, or false if any of the assignments failed. An assignment can fail if the object is not the correct type for an attribute field.

resolved()

RoseObject * resolved();
void resolved (RoseObject * obj);
The resolved() member holds a pointer to the local object that the URI was resolved to. This will return NULL if the reference has not yet been resolved. Use resolve_usage() to propogate a value to all of the fields that use a reference.

uri()

char * uri();
void uri (const char * var);
The uri() member holds a string value containing the web address of the externally referenced object.

usage()

RoseRefUsage * usage();
The usage() member returns the start of the descriptor chain that holds all uses of the reference by data objects. These usage descriptors are maintained by the rose_ref_put() function.