1 | /*! |
---|
2 | \file base_object.h |
---|
3 | \brief Definition of the base object class. |
---|
4 | |
---|
5 | This is a global handler for all classes. |
---|
6 | |
---|
7 | \todo isA() |
---|
8 | */ |
---|
9 | |
---|
10 | |
---|
11 | #ifndef _BASE_OBJECT_H |
---|
12 | #define _BASE_OBJECT_H |
---|
13 | |
---|
14 | #include "class_list.h" |
---|
15 | #ifndef NULL |
---|
16 | #define NULL 0x0 //!< NULL |
---|
17 | #endif |
---|
18 | |
---|
19 | class TiXmlElement; |
---|
20 | |
---|
21 | //! A class all other classes are derived from |
---|
22 | class BaseObject { |
---|
23 | |
---|
24 | public: |
---|
25 | BaseObject (const TiXmlElement* root = NULL); |
---|
26 | virtual ~BaseObject (); |
---|
27 | |
---|
28 | void loadParams(const TiXmlElement* root); |
---|
29 | |
---|
30 | void setClassID(int id); |
---|
31 | void setClassName(const char* className); |
---|
32 | void setClassID(int id, const char* className); |
---|
33 | |
---|
34 | /** \returns the className of the corresponding Object */ |
---|
35 | inline const char* getClassName(void) const { return this->className;}; |
---|
36 | /** \returns the classID of the corresponding Object */ |
---|
37 | inline int getClassID(void) const { return this->id; } |
---|
38 | |
---|
39 | // bool isA (char* className); |
---|
40 | |
---|
41 | /** \returns if the object is finalized */ |
---|
42 | inline bool isFinalized() { return this->finalized; } |
---|
43 | /** \brief this finalizes an object and makes it ready to be garbage collected */ |
---|
44 | void finalize(void) { this->finalized = true; }; |
---|
45 | |
---|
46 | void setName (const char* newName); |
---|
47 | /** \brief returns the Name of this Object */ |
---|
48 | const char* getName (void)const { return this->objectName; }; |
---|
49 | |
---|
50 | private: |
---|
51 | const char* className; //!< the name of the class |
---|
52 | int id; //!< this is the id from the class_list.h enumeration |
---|
53 | bool finalized; //!< is true if the object is ready to be garbage collected |
---|
54 | |
---|
55 | char* objectName; //!< The name of this object |
---|
56 | }; |
---|
57 | |
---|
58 | #endif /* _BASE_OBJECT_H */ |
---|