Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 7952 was 7779, checked in by bensch, 19 years ago

3088 linews changed :): trunk: namespaces

File size: 2.1 KB
RevLine 
[4591]1/*!
[5039]2 * @file base_object.h
[4836]3  *  Definition of the base object class.
[4470]4
5    This is a global handler for all classes.
[3302]6*/
7
8
9#ifndef _BASE_OBJECT_H
10#define _BASE_OBJECT_H
11
[4742]12#include "class_id.h"
[5511]13#include "debug.h"
[4436]14#ifndef NULL
[5279]15#define NULL     0    //!< NULL
[4436]16#endif
[3302]17
[7221]18#include <string>
[6341]19#include "stdincl.h"
20
[6517]21class TiXmlNode;
[4436]22class TiXmlElement;
[6280]23class ClassList;
[4436]24
[4382]25//! A class all other classes are derived from
[3302]26class BaseObject {
27
28 public:
[7661]29   BaseObject (const std::string& objectName = "");
[7779]30
[3531]31  virtual ~BaseObject ();
[3302]32
[6512]33  virtual void loadParams(const TiXmlElement* root);
[7221]34  void setName (const std::string& newName);
[5113]35  /** returns the Name of this Object */
[7221]36  inline const char* getName ()const { return this->objectName.c_str(); };
[6587]37  /** @returns the XML-Element with whicht this Object was loaded */
38  inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
[4318]39
[4836]40  /** @returns the className of the corresponding Object */
[7221]41  inline const char* getClassName() const { return this->className.c_str(); };
[4836]42  /** @returns the classID of the corresponding Object */
[4933]43  inline int getClassID() const { return this->classID; };
[6280]44  ClassID    getLeafClassID() const;
[3302]45
[6077]46  bool isA (ClassID classID) const;
[7221]47  bool isA (const std::string& className) const;
[4746]48  void whatIs() const;
[4470]49
[7221]50  bool operator==(const std::string& objectName);
[6077]51  /** @param classID comparer for a ClassID @returns true on match, false otherwise */
52  bool operator==(ClassID classID) { return this->isA(classID); };
[5626]53
[6341]54  int       writeState(const byte* data, int length, int sender);
55  int       readState(byte* data, int maxLength );
[6517]56
[4539]57 protected:
[7221]58   void setClassID(ClassID classID, const std::string& className);
[4539]59
[6517]60 private:
[7221]61    std::string        className;        //!< the name of the class
[4744]62    long               classID;          //!< this is the id from the class_id.h enumeration
[7221]63    std::string        objectName;       //!< The name of this object
[6280]64
65    ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of
[6517]66
67    TiXmlNode*         xmlElem;          //!< The XML Element with wich this Object was loaded(saved).
[3302]68};
69
70#endif /* _BASE_OBJECT_H */
Note: See TracBrowser for help on using the repository browser.