Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/lang/base_object.h @ 4939

Last change on this file since 4939 was 4933, checked in by bensch, 19 years ago

orxonox/trunk: more elaborate FastFactory, that should work…
now i have to test it… this will generate segfaults for sure :/

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