Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/network/src/lib/lang/base_object.h @ 6262

Last change on this file since 6262 was 6257, checked in by rennerc, 19 years ago

class_id.h: changed CL_ENTITY_MANAGER to CL_NETWORK_GAME_MANAGER
base_object: added realClassID which can be used with factory
network_game_manager: fixed some bugs again, can now spawn entities over network :D

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