| [4591] | 1 | /*! | 
|---|
| [5039] | 2 |  * @file base_object.h | 
|---|
| [4836] | 3 |   *  Definition of the base object class. | 
|---|
| [4470] | 4 |  | 
|---|
 | 5 |     This is a global handler for all classes. | 
|---|
| [3302] | 6 | */ | 
|---|
 | 7 |  | 
|---|
 | 8 |  | 
|---|
 | 9 | #ifndef _BASE_OBJECT_H | 
|---|
 | 10 | #define _BASE_OBJECT_H | 
|---|
 | 11 |  | 
|---|
| [4742] | 12 | #include "class_id.h" | 
|---|
| [5511] | 13 | #include "debug.h" | 
|---|
| [8035] | 14 | #include <string> | 
|---|
| [3302] | 15 |  | 
|---|
| [6341] | 16 | #include "stdincl.h" | 
|---|
 | 17 |  | 
|---|
| [6517] | 18 | class TiXmlNode; | 
|---|
| [4436] | 19 | class TiXmlElement; | 
|---|
| [6280] | 20 | class ClassList; | 
|---|
| [4436] | 21 |  | 
|---|
| [4382] | 22 | //! A class all other classes are derived from | 
|---|
| [3302] | 23 | class BaseObject { | 
|---|
 | 24 |  | 
|---|
 | 25 |  public: | 
|---|
| [7661] | 26 |    BaseObject (const std::string& objectName = ""); | 
|---|
| [7779] | 27 |  | 
|---|
| [3531] | 28 |   virtual ~BaseObject (); | 
|---|
| [3302] | 29 |  | 
|---|
| [6512] | 30 |   virtual void loadParams(const TiXmlElement* root); | 
|---|
| [7221] | 31 |   void setName (const std::string& newName); | 
|---|
| [5113] | 32 |   /** returns the Name of this Object */ | 
|---|
| [7221] | 33 |   inline const char* getName ()const { return this->objectName.c_str(); }; | 
|---|
| [6587] | 34 |   /** @returns the XML-Element with whicht this Object was loaded */ | 
|---|
 | 35 |   inline TiXmlNode* getXmlElem() const { return this->xmlElem; }; | 
|---|
| [4318] | 36 |  | 
|---|
| [4836] | 37 |   /** @returns the className of the corresponding Object */ | 
|---|
| [7221] | 38 |   inline const char* getClassName() const { return this->className.c_str(); }; | 
|---|
| [4836] | 39 |   /** @returns the classID of the corresponding Object */ | 
|---|
| [4933] | 40 |   inline int getClassID() const { return this->classID; }; | 
|---|
| [7954] | 41 |   const ClassID& getLeafClassID() const; | 
|---|
| [3302] | 42 |  | 
|---|
| [6077] | 43 |   bool isA (ClassID classID) const; | 
|---|
| [7221] | 44 |   bool isA (const std::string& className) const; | 
|---|
| [4746] | 45 |   void whatIs() const; | 
|---|
| [4470] | 46 |  | 
|---|
| [7221] | 47 |   bool operator==(const std::string& objectName); | 
|---|
| [6077] | 48 |   /** @param classID comparer for a ClassID @returns true on match, false otherwise */ | 
|---|
 | 49 |   bool operator==(ClassID classID) { return this->isA(classID); }; | 
|---|
| [5626] | 50 |  | 
|---|
| [4539] | 51 |  protected: | 
|---|
| [7221] | 52 |    void setClassID(ClassID classID, const std::string& className); | 
|---|
| [7954] | 53 |    std::string        objectName;        //!< The name of this object | 
|---|
| [4539] | 54 |  | 
|---|
| [6517] | 55 |  private: | 
|---|
| [7221] | 56 |     std::string        className;        //!< the name of the class | 
|---|
| [4744] | 57 |     long               classID;          //!< this is the id from the class_id.h enumeration | 
|---|
| [7954] | 58 |     ClassID            leafClassID;      //!< The Leaf Class ID | 
|---|
| [6280] | 59 |  | 
|---|
 | 60 |     ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of | 
|---|
| [6517] | 61 |  | 
|---|
 | 62 |     TiXmlNode*         xmlElem;          //!< The XML Element with wich this Object was loaded(saved). | 
|---|
| [3302] | 63 | }; | 
|---|
 | 64 |  | 
|---|
 | 65 | #endif /* _BASE_OBJECT_H */ | 
|---|