TypeDef

From emergent
Jump to: navigation, search
Reference info for type TypeDef: Wiki | Emergent Help Browser
Emergent Logo
Main Developer Docs

IMPORTANT: Programmers must put a TypeDef_Of declaration of the global class TypeDef for a given class within the header file that defines that class (new as of version 6.2).

The TypeAccess system provides meta-type information for all C++ types, both built-in types such as double and int, as well as user-defined class types. A global TypeDef object is instantiated for each such type. For example, there is:

  • one TypeDef object created called TA_double that represents the double built-in type,
  • one TypeDef object created called TA_int that represents ints,
    • etc. for other built-in types,
  • one TypeDef object created for each class, typedef, enum, etc., with naming convention TA_ClassName.

Keep in mind that there may be many instances (objects) of a class created, but there is only one TypeDef instance representing the class itself.

Since a C++ class can contain data members, and those data members also have types, it makes sense for TypeDefs that represent classes to contain information about the data members of the class. Intuitively, this list of members in the TypeDef would need to include the name of each member and its type. This information (and more) is stored in the MemberDef class. A MemberDef object will be created for each data member of each class.

Each TypeDef object has an "it" pointer to an object (of type taiType) that knows how to render the type as a GUI widget. Each MemberDef object has an "im" pointer to an object that knows more specifically how that member should be rendered. For more information on how this rendering occurs, see the documentation on the taiType page.