Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/powerups/src/lib/lang/base_object.h @ 6461

Last change on this file since 6461 was 6280, checked in by bensch, 19 years ago

orxonox/trunk: ClassList now supports getLeafID() to retriefe the ID on hot to generate an object of the same type

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#include "debug.h"
14#ifndef NULL
15#define NULL     0    //!< NULL
16#endif
17
18class TiXmlElement;
19class ClassList;
20
21//! A class all other classes are derived from
22class BaseObject {
23
24 public:
25  BaseObject (const TiXmlElement* root = NULL);
26  virtual ~BaseObject ();
27
28  void loadParams(const TiXmlElement* root);
29  void setName (const char* newName);
30  /** returns the Name of this Object */
31  inline const char* getName ()const { return this->objectName; };
32
33  /** @returns the className of the corresponding Object */
34  inline const char* getClassName() const { return this->className; };
35  /** @returns the classID of the corresponding Object */
36  inline int getClassID() const { return this->classID; };
37  ClassID    getLeafClassID() const;
38
39  bool isA (ClassID classID) const;
40  bool isA (const char* className) const;
41  void whatIs() const;
42
43  bool operator==(const char* objectName);
44  /** @param classID comparer for a ClassID @returns true on match, false otherwise */
45  bool operator==(ClassID classID) { return this->isA(classID); };
46
47 protected:
48  void setClassID(ClassID classID, const char* className);
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    ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of
56};
57
58#endif /* _BASE_OBJECT_H */
Note: See TracBrowser for help on using the repository browser.