next up previous index
Next: The TYPE_DATA Macro Up: Implementation of the Previous: RTTI Operation: Run-Time

Automatic Creation of Type_infos for C++ Classes

The previous sections presented the implementation of the RTTI operations in terms of the Type_info class. We assumed that for each C++ application class, there exists exactly one Type_info object which is correctly created to represent all type information for that class. Moreover, we assumed that the application C++ classes contain a number of virtual methods which are called back by the RTTI operations.

In Section 4.2 we presented the two steps the user has to take in order to add RTTI to a C++ class: the insertion of the TYPE_DATA keyword in the class declaration and of the RTTI_DEF and RTTI_DEF_INST keywords in the file containing the class definition. This section describes the actions which are automatically taken by the RTTI system when those keywords are inserted in a C++ source and describe how the Type_info objects are initialized.

As one might have already guessed, TYPE_DATA and RTTI_DEF are C++ macros which expand into code for declaration and initialization of some features of the RTTI system. They are described in detail in the following.





Alexandru Telea