Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/std/src/lib/lang/base_object.h @ 7203

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

orxonox/trunk: compiles again, BUT well…. i do not expect it to run anymore

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