Planet
navi homeaboutscreenshotsdownloaddevelopmentforum

CoreIncludes

TracNav(TracNav/TOC_Development)?

Description

CoreIncludes.h is a header-file in the core library, declaring several macros for Identifiers and the Factory.

Macros

Object Registration

  • RegisterObject(ClassName): This macro is used by classes that want to have an Identifier. Use the macro at the beginning of the constructor. It adds new instances of this class to the corresponding ObjectListBase and helps building the class hierarchy.
  • RegisterRootObject(ClassName): This is the same as RegisterObject(ClassName), but for root-classes like Interfaces (Tickable, network/Synchronisable and others) and the BaseObject.

Class Registration

  • RegisterClass(ClassName): Registers the given class in the framework and adds a ClassFactory to the corresponding Identifier. This macro has to be used outside the class-functions as a static call (preferably just before the constructor).

Identifiers

Examples

// Create the factory for MyClass
RegisterClass(MyClass);

// Constructor:
MyClass::MyClass()
{
    // Register the object in the Identifier of MyClass
    RegisterObject(MyClass);
}
// Assigns the Identifier of MyClass
Identifier* identifier = Class(MyClass);
// Assigns the Identifier of a class named "MyClass"
Identifier* identifier = ClassByString("MyClass");
Last modified 18 months ago Last modified on Oct 4, 2015, 9:37:30 PM