Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 8570 was 8035, checked in by bensch, 19 years ago

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