Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6781 was 6587, checked in by bensch, 19 years ago

retrieve the XML-Element

File size: 2.0 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
[6341]18#include "stdincl.h"
19
[6517]20class TiXmlNode;
[4436]21class TiXmlElement;
[6280]22class ClassList;
[4436]23
[4382]24//! A class all other classes are derived from
[3302]25class BaseObject {
26
27 public:
[6517]28  BaseObject ();
[3531]29  virtual ~BaseObject ();
[3302]30
[6512]31  virtual void loadParams(const TiXmlElement* root);
[4539]32  void setName (const char* newName);
[5113]33  /** returns the Name of this Object */
[4746]34  inline const char* getName ()const { return this->objectName; };
[6587]35  /** @returns the XML-Element with whicht this Object was loaded */
36  inline TiXmlNode* getXmlElem() const { return this->xmlElem; };
[4318]37
[4836]38  /** @returns the className of the corresponding Object */
[4746]39  inline const char* getClassName() const { return this->className; };
[4836]40  /** @returns the classID of the corresponding Object */
[4933]41  inline int getClassID() const { return this->classID; };
[6280]42  ClassID    getLeafClassID() const;
[3302]43
[6077]44  bool isA (ClassID classID) const;
[5513]45  bool isA (const char* className) const;
[4746]46  void whatIs() const;
[4470]47
[5791]48  bool operator==(const char* objectName);
[6077]49  /** @param classID comparer for a ClassID @returns true on match, false otherwise */
50  bool operator==(ClassID classID) { return this->isA(classID); };
[5626]51
[6341]52  int       writeState(const byte* data, int length, int sender);
53  int       readState(byte* data, int maxLength );
[6517]54
[4539]55 protected:
[5791]56  void setClassID(ClassID classID, const char* className);
[4539]57
[6517]58 private:
[4742]59    const char*        className;        //!< the name of the class
[4744]60    long               classID;          //!< this is the id from the class_id.h enumeration
[4742]61    char*              objectName;       //!< The name of this object
[6280]62
63    ClassList*         classList;        //!< Pointer to the ClassList this Object is inside of
[6517]64
65    TiXmlNode*         xmlElem;          //!< The XML Element with wich this Object was loaded(saved).
[3302]66};
67
68#endif /* _BASE_OBJECT_H */
Note: See TracBrowser for help on using the repository browser.