Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/proxy/src/lib/lang/base_object.h @ 9375

Last change on this file since 9375 was 9371, checked in by bensch, 18 years ago

orxonox/trunk: ORXONOX is now completely std::stringed

File size: 2.5 KB
Line 
1/*!
2 * @file base_object.h
3 * @brief Definition of the BaseObject class.
4 *
5 * This is a global handler for all classes Object and Class names
6 *
7 * BaseObject is the class, that handles object registration and
8 * is the only write-access member of ClassList, where the Objects
9 * References are stored.
10 */
11
12
13#ifndef __BASE_OBJECT_H_
14#define __BASE_OBJECT_H_
15
16#include "class_id.h"
17#include <string>
18
19#include "sigslot/slot.h"
20
21class TiXmlNode;
22class TiXmlElement;
23class ClassList;
24
25//! A class all other classes are derived from
26class BaseObject : public sigslot::has_slots<>
27{
28
29public:
30  BaseObject (const std::string& objectName = "");
31
32  virtual ~BaseObject ();
33
34  virtual void loadParams(const TiXmlElement* root);
35  void setName (const std::string& newName);
36  /** returns the Name of this Object */
37  inline const std::string& getName() const { return this->objectName; };
38  /** returns the Name of this Object as a C-compliant string (const char*) */
39  inline const char* getCName() const { return this->objectName.c_str(); };
40  /** @returns the XML-Element with whicht this Object was loaded */
41  inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
42
43  /** @returns the className of the corresponding Object */
44  inline const std::string& getClassName() const { return this->className; }
45  /** @returns the className of the corresponding Object as a C-compliant string (const char*) */
46  inline const char* getClassCName() const { return this->className.c_str(); };
47  /** @returns the classID of the corresponding Object */
48  inline int getClassID() const { return this->classID; };
49  const ClassID& getLeafClassID() const;
50
51  bool isA (ClassID classID) const;
52  bool isA (const std::string& className) const;
53
54  /** @param classID comparer for a ClassID @returns true on match, false otherwise */
55  bool operator==(ClassID classID) const  { return this->isA(classID); };
56  bool operator==(const std::string& objectName) const;
57
58protected:
59  void setClassID(ClassID classID, const std::string& className);
60
61protected:
62  std::string        objectName;       //!< The name of this object
63
64private:
65  std::string        className;        //!< the name of the class
66  long               classID;          //!< this is the id from the class_id.h enumeration
67  ClassID            leafClassID;      //!< The Leaf Class ID
68
69  ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of
70
71  TiXmlNode*         xmlElem;          //!< The XML Element with wich this Object was loaded(saved).
72};
73
74#endif /* __BASE_OBJECT_H_ */
Note: See TracBrowser for help on using the repository browser.