Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6445 was 6341, checked in by bensch, 19 years ago

orxonox/trunk: merged the network branche back to the trunk, so we do not get away from each other to fast

File size: 1.8 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 "stdincl.h"
19
20class TiXmlElement;
21class ClassList;
22
23//! A class all other classes are derived from
24class BaseObject {
25
26 public:
27  BaseObject (const TiXmlElement* root = NULL);
28  virtual ~BaseObject ();
29
30  void loadParams(const TiXmlElement* root);
31  void setName (const char* newName);
32  /** returns the Name of this Object */
33  inline const char* getName ()const { return this->objectName; };
34
35  /** @returns the className of the corresponding Object */
36  inline const char* getClassName() const { return this->className; };
37  /** @returns the classID of the corresponding Object */
38  inline int getClassID() const { return this->classID; };
39  ClassID    getLeafClassID() const;
40
41  bool isA (ClassID classID) const;
42  bool isA (const char* className) const;
43  void whatIs() const;
44
45  bool operator==(const char* objectName);
46  /** @param classID comparer for a ClassID @returns true on match, false otherwise */
47  bool operator==(ClassID classID) { return this->isA(classID); };
48
49  int       writeState(const byte* data, int length, int sender);
50  int       readState(byte* data, int maxLength );
51 protected:
52  void setClassID(ClassID classID, const char* className);
53
54  private:
55    const char*        className;        //!< the name of the class
56    long               classID;          //!< this is the id from the class_id.h enumeration
57    char*              objectName;       //!< The name of this object
58
59    ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of
60};
61
62#endif /* _BASE_OBJECT_H */
Note: See TracBrowser for help on using the repository browser.