You must build RTTI support into any class you derive from one of the abstract base classes. You also can build the RTTI facility into your own object classes that are not derived from base classes.
#include <apt_framework/orchestrate.h>
class ExampleOperator: public APT_Operator
{
APT_DECLARE_RTTI(ExampleOperator);
APT_DECLARE_PERSISTENT(ExampleOperator);
public:
ExampleOperator();
protected:
virtual APT_Status describeOperator();
virtual APT_Status runLocally();
};
The macro APT_DECLARE_RTTI() is used to declare ExampleOperator as
a class that supports the RTTI facility. With the APT_DECLARE_PERSISTENT
macro, which is required, object persistence for operator objects
transmitted to the processing nodes is declared.#include "example.h"
APT_IMPLEMENT_RTTI_ONEBASE(ExampleOperator, APT_Operator);
APT_IMPLEMENT_PERSISTENT(ExampleOperator);
...
The macro APT_IMPLEMENT_RTTI_ONEBASE() is used to implement
the RTTI facility for a derived class with a single base class, and
the macro APT_IMPLEMENT_PERSISTENT() is used to implement the persistence
mechanism.class MI_Class: public B1, public B2
{
APT_DECLARE_RTTI(MI_Class);
APT_DECLARE_PERSISTENT(MI_Class);
public:
...
};
The class MI_Class is derived from two base classes:
B1 and B2. Typically, both base classes must support the RTTI facility. If a base class does not support RTTI, that class cannot be used as part of a checked cast. MI_Class is a user-defined class; it is not derived from a supplied base class.
APT_IMPLEMENT_RTTI_BEGIN(MI_Class);
APT_IMPLEMENT_RTTI_BASE(MI_Class, B1);
APT_IMPLEMENT_RTTI_BASE(MI_Class, B2);
APT_IMPLEMENT_RTTI_END(MI_Class);
...
The APT_IMPLEMENT_RTTI_BEGIN() macro starts a block
defining the base classes of MI_Class, the APT_IMPLEMENT_RTTI_BASE()
macros specify the base classes of MI_Class, and the APT_IMPLEMENT_RTTI_END()
macro ends the definition.An APT_IMPLEMENT_RTTI_BEGIN() - APT_IMPLEMENT_RTTI_END() block can contain only a sequence of APT_IMPLEMENT_RTTI_BASE() macros.
A checked cast to an ambiguous base class yields the first base class defined in an APT_IMPLEMENT_RTTI_BEGIN() - APT_IMPLEMENT_RTTI_END() block.
For cases in which the class being defined has no bases or only one base, the APT_IMPLEMENT_RTTI_NOBASE() and APT_IMPLEMENT_RTTI_ONEBASE() macros can be used instead.