Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

CoreIncludes

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

  • Class(ClassName): Returns the ClassIdentifier of the given class.
  • ClassByString(String): Returns the Identifier of the class with the given name if the entry in the Factory exists
  • ClassByID(NetworkID): Returns the Identifier of the class with the given networkID if the entry in the Factory exists

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 7 years ago Last modified on Apr 12, 2017, 11:06:19 PM