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