Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7985 was 7954, checked in by patrick, 18 years ago

trunk: merged the network branche back to trunk.

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