Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/terrain.old/src/lib/lang/base_object.h @ 9167

Last change on this file since 9167 was 8362, checked in by bensch, 18 years ago

orxonox/trunk: removed stupid included in base_object.h
this should lead to faster compile-times

File size: 1.9 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 <string>
14
15class TiXmlNode;
16class TiXmlElement;
17class ClassList;
18
19//! A class all other classes are derived from
20class BaseObject
21{
22
23public:
24  BaseObject (const std::string& objectName = "");
25
26  virtual ~BaseObject ();
27
28  virtual void loadParams(const TiXmlElement* root);
29  void setName (const std::string& newName);
30  /** returns the Name of this Object */
31  inline const char* getName ()const { return this->objectName.c_str(); };
32  /** @returns the XML-Element with whicht this Object was loaded */
33  inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
34
35  /** @returns the className of the corresponding Object */
36  inline const char* getClassName() const { return this->className.c_str(); };
37  /** @returns the classID of the corresponding Object */
38  inline int getClassID() const { return this->classID; };
39  const ClassID& getLeafClassID() const;
40
41  bool isA (ClassID classID) const;
42  bool isA (const std::string& className) const;
43  void whatIs() const;
44
45  bool operator==(const std::string& objectName);
46  /** @param classID comparer for a ClassID @returns true on match, false otherwise */
47  bool operator==(ClassID classID) { return this->isA(classID); };
48
49protected:
50  void setClassID(ClassID classID, const std::string& className);
51
52protected:
53  std::string        objectName;       //!< The name of this object
54
55private:
56
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).
64};
65
66#endif /* _BASE_OBJECT_H */
Note: See TracBrowser for help on using the repository browser.