Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 9338 was 9329, checked in by bensch, 18 years ago

orxonox/proxy: bo cleanup

File size: 2.1 KB
RevLine 
[4591]1/*!
[5039]2 * @file base_object.h
[9329]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 */
[4470]11
[3302]12
[9329]13#ifndef __BASE_OBJECT_H_
14#define __BASE_OBJECT_H_
[3302]15
[4742]16#include "class_id.h"
[8035]17#include <string>
[3302]18
[6517]19class TiXmlNode;
[4436]20class TiXmlElement;
[6280]21class ClassList;
[4436]22
[4382]23//! A class all other classes are derived from
[8350]24class BaseObject
25{
[3302]26
[8350]27public:
28  BaseObject (const std::string& objectName = "");
[7779]29
[3531]30  virtual ~BaseObject ();
[3302]31
[6512]32  virtual void loadParams(const TiXmlElement* root);
[7221]33  void setName (const std::string& newName);
[5113]34  /** returns the Name of this Object */
[7221]35  inline const char* getName ()const { return this->objectName.c_str(); };
[6587]36  /** @returns the XML-Element with whicht this Object was loaded */
37  inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
[4318]38
[4836]39  /** @returns the className of the corresponding Object */
[7221]40  inline const char* getClassName() const { return this->className.c_str(); };
[4836]41  /** @returns the classID of the corresponding Object */
[4933]42  inline int getClassID() const { return this->classID; };
[7954]43  const ClassID& getLeafClassID() const;
[3302]44
[6077]45  bool isA (ClassID classID) const;
[7221]46  bool isA (const std::string& className) const;
[4470]47
[6077]48  /** @param classID comparer for a ClassID @returns true on match, false otherwise */
[9329]49  bool operator==(ClassID classID) const  { return this->isA(classID); };
50  bool operator==(const std::string& objectName) const;
[5626]51
[8350]52protected:
53  void setClassID(ClassID classID, const std::string& className);
[4539]54
[8350]55protected:
56  std::string        objectName;       //!< The name of this object
[6280]57
[8350]58private:
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).
[3302]66};
67
[9329]68#endif /* __BASE_OBJECT_H_ */
Note: See TracBrowser for help on using the repository browser.