= !CoreIncludes = [[TracNav(TracNav/TOC_Development)]] [[TOC]] == Description == !CoreIncludes.h is a header-file in the [wiki:Core core library], declaring several macros for [wiki:Identifier Identifiers] and the [wiki:Factory]. == Macros == === Object Registration === * '''!RegisterObject('''''!ClassName''''')''': This macro is used by classes that want to have an [wiki:Identifier]. Use the macro at the beginning of the constructor. It adds new instances of this class to the corresponding [wiki:ObjectListBase] and helps building the [wiki:Identifier class hierarchy]. * '''!RegisterRootObject('''''!ClassName''''')''': This is the same as !RegisterObject(!ClassName), but for root-classes like Interfaces ([wiki:Tickable], [wiki:network/Synchronisable] and others) and the [wiki:BaseObject]. === Factory === * '''!CreateFactory('''''!ClassName''''')''': Creates the entry in the [wiki:Factory] for the given class and adds a [wiki:ClassFactory] to the corresponding [wiki: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 [wiki:ClassIdentifier] of the given class. * '''ClassByString('''''String''''')''': Returns the [wiki:Identifier] of the class with the given name if the entry in the [wiki:Factory] exists * '''ClassByID('''''NetworkID''''')''': Returns the [wiki:Identifier] of the class with the given networkID if the entry in the [wiki:Factory] exists == Examples == {{{ // Create the factory for MyClass CreateFactory(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 = ClassByName("MyClass"); }}}