= BaseObject = The BaseObject is the top-most !SuperClass of (most but not) all Classes in orxonox. source:/trunk/src/lib/lang/base_object.h#HEAD [[br]] __Derived From__: * nothing == Description == BaseObject is a container for * The Name of the Object (how the object is called) * The Class' Name of the Object (in what class this object is) * The ClassID of the Object (what is the Identity of the class (see [source:/trunk/src/lib/lang/class_id.h#HEAD ClassID] == Usage == * __Registration__:[[br]] Each class, that extends BaseObject must implement the following function: 1. In the Class-Declaration use the following syntax (taken your class is named OrxClass) {{{ #!cpp class OrxClass : public BaseObject // here you could also specify any class derived from BaseObject { ObjectListDeclaration(OrxClass); /// ... rest of the Declaration; }; }}} 1. At the top of the cc-file of the Class (in the definiton) write: {{{ #!cpp ObjectListDefinition(OrxClass); }}} 1. In the constructor of each class implementing BaseObject write the following: {{{ #!cpp this->registerObject(this, OrxClass::_objectList); }}} 1. you can then set a Name to the Object using {{{ #!cpp this->setName("the name"); }}} * __isA__:[[br]] isA is a function, that queries, if the Object is of a Specified type. e.g. given a class Player that is derived from BaseObject and [wiki:ParentNode PNode] one can do the following check : {{{ #!cpp Player* player = new Player(); if (player->isA(PNode::staticClassID()) { /* do something terrible with it */ } }}} == Advanced Topics == An interessting Function, that BaseObject provides is the ObjectList. With it, one can retrieve lists of any one kind of derived classes from BaseObject.