Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: derivations work.
now the only thing to do is specify all the classes, and DO it CLEAN.

@patrick: is it ok, how i treated your ObjectManager??

File size: 1.7 KB
RevLine 
[4591]1/*!
[4382]2    \file base_object.h
[4470]3    \brief Definition of the base object class.
4
5    This is a global handler for all classes.
6
7    \todo isA()
[3302]8*/
9
10
11#ifndef _BASE_OBJECT_H
12#define _BASE_OBJECT_H
13
[4318]14#include "class_list.h"
[4436]15#ifndef NULL
[4470]16#define NULL 0x0        //!< NULL
[4436]17#endif
[3302]18
[4436]19class TiXmlElement;
20
[4382]21//! A class all other classes are derived from
[3302]22class BaseObject {
23
24 public:
[4436]25  BaseObject (const TiXmlElement* root = NULL);
[3531]26  virtual ~BaseObject ();
[3302]27
[4436]28  void loadParams(const TiXmlElement* root);
29
[4539]30  void setName (const char* newName);
31  /** \brief returns the Name of this Object */
[4591]32  inline const char* getName (void)const { return this->objectName; };
[4318]33
[4382]34  /** \returns the className of the corresponding Object */
[4591]35  inline const char* getClassName(void) const { return this->className; };
[4382]36  /** \returns the classID of the corresponding Object */
[4591]37  inline int getClassID(void) const { return this->classID; }
[3302]38
[4592]39  bool isA (ClassID classID);
40  void whatIs(void) const;
[4470]41
[4382]42  /** \returns if the object is finalized */
[3651]43  inline bool isFinalized() { return this->finalized; }
[4539]44
45
46 protected:
[4591]47  void setClassID(long classID);
[4539]48  void setClassName(const char* className);
[4591]49  void setClassID(long classID, const char* className);
[4539]50
[4470]51  /** \brief this finalizes an object and makes it ready to be garbage collected */
52  void finalize(void) { this->finalized = true; };
[3646]53
[3302]54 private:
[4591]55  const char*    className;        //!< the name of the class
56  long           classID;          //!< this is the id from the class_list.h enumeration
57  char*          objectName;       //!< The name of this object
58
[4435]59  bool           finalized;        //!< is true if the object is ready to be garbage collected
[3302]60};
61
62#endif /* _BASE_OBJECT_H */
Note: See TracBrowser for help on using the repository browser.