External objects

External objects are objects that are generated outside of the current Rhapsody® project. They could have been created in Rhapsody or some other environment.

The referencing of external objects allows you, for example, to relate to external frameworks or legacy code from within a Rhapsody model. All objects, or object types, that are read‑only are assumed to be external.

You can mark an object as external by setting the CG::Class::UseAsExternal property to Checked. No assumption is made regarding implicit interfaces of external objects, such as accessors or mutators. Because they might not have been generated in the product, they are assumed to be non‑instrumented.

If you override the file name of an external object using the CG::Class::FileName property, an #include statement is added to the implementation file whenever the element is added to a regular object (package, dependency, relation, and so on). It is not necessary to add a file extension because Rhapsody automatically adds the extension .h to the file name. For example, if you set the FileName property of an external object B to myB, the #include directive is generated in the .c file for the package:


#include "myB.h"

You can also override the file name of an external object by adding the file to the component model by adding the element to a file in the model.

If any other objects in the model have Usage dependencies to the external object, the same #include directive is added to the specification files of those objects. See Dependencies for more information.

For the model to compile, the location of the external file must be specified as either an include path or under the compiler switches at the component or configuration level (using the Settings tab of the Features window for the configuration). If you added the external object to a file with the correct path, no modification of the search path is needed.