|
Last change
on this file since 4428 was
4382,
checked in by bensch, 20 years ago
|
|
orxonox/trunk: BaseObject virtual public in PNode and Player(for test).
This is, so only one Object of type BaseObject is being created when deriving with multiple inheritance
@patrick: read it in a book at the lake today 
|
|
File size:
1.1 KB
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | \file base_object.h |
|---|
| 3 | \brief Definition of the base object class. that is a global handler for all classes. |
|---|
| 4 | */ |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | #ifndef _BASE_OBJECT_H |
|---|
| 8 | #define _BASE_OBJECT_H |
|---|
| 9 | |
|---|
| 10 | #include "class_list.h" |
|---|
| 11 | |
|---|
| 12 | //! A class all other classes are derived from |
|---|
| 13 | class BaseObject { |
|---|
| 14 | |
|---|
| 15 | public: |
|---|
| 16 | BaseObject (); |
|---|
| 17 | virtual ~BaseObject (); |
|---|
| 18 | |
|---|
| 19 | void setClassID(int id); |
|---|
| 20 | void setClassName(const char* className); |
|---|
| 21 | void setClassID(int id, const char* className); |
|---|
| 22 | |
|---|
| 23 | /** \returns the className of the corresponding Object */ |
|---|
| 24 | inline const char* getClassName(void) const { return this->className;}; |
|---|
| 25 | /** \returns the classID of the corresponding Object */ |
|---|
| 26 | inline int getClassID(void) const { return this->id; } |
|---|
| 27 | bool isA (char* className); |
|---|
| 28 | |
|---|
| 29 | /** \returns if the object is finalized */ |
|---|
| 30 | inline bool isFinalized() { return this->finalized; } |
|---|
| 31 | void finalize(); |
|---|
| 32 | |
|---|
| 33 | private: |
|---|
| 34 | const char* className; //!< the name of the class |
|---|
| 35 | int id; //!< this is the id from the class_list.h enumeration |
|---|
| 36 | bool finalized; //!< is true if the object is ready to be garbage collected |
|---|
| 37 | }; |
|---|
| 38 | |
|---|
| 39 | #endif /* _BASE_OBJECT_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.