For example, the isClosed attribute of the Valve object type is embedded by value as a data member inside the Valve structure:
struct Valve {
/*** User explicit entries ***/
RiCBoolean isClosed; /*## attribute isClosed ##*/
};
The RiCBoolean type is the C equivalent of OMBoolean, a Boolean data type defined in the IBM® Rational® Rhapsody® Developer for C++ framework.
An accessor operation enables you to access the data, whereas a mutator operation enables you to modify the data. The accessor is generated if the C_CG::Attribute::AccessorGenerate property is set to Checked. Similarly, the mutator is generated if the C_CG::Attribute::MutatorGenerate property is set to Always. The default AccessorGenerate is Cleared. The default for MutatorGenerate is Never.
Accessor and mutator operations are generated in the user implicit entries area of the specification file for the object type. For example, prototypes for the _getIsClosed() accessor operation and the _setIsClosed() mutator operation are generated for the isClosed attribute in the Valve.h file:
/*** User implicit entries ***/
RiCBoolean Valve _getIsClosed(const Valve* const me);
void Valve _setIsClosed(Valve* const me, RiCBoolean
p_isClosed);
The bodies of the accessor and mutator operations are generated in the implementation file for the object type. For example, the following implementations are generated for the _getIsClosed() and _setIsClosed() operations in the Valve.c file:
/*** Methods implementation ***/
RiCBoolean Valve_getIsClosed(const Valve* const me) {
return me->isClosed;
}
void Valve _setIsClosed(Valve* const me, RiCBoolean
p_isClosed) {
me->isClosed = p_isClosed;
}
Rational Rhapsody generates attributes in the following order: