Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8361 was 8350, checked in by bensch, 18 years ago

fixed out some warnings

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