]> jfr.im git - irc/gameservirc.git/blob - gameserv-2.0/libgameservgldl/include/GameServ/GameLayer/GameObjects/GameObject.h
Changed the ItemGO class to be abstract so you cannot define a simple ItemGO object...
[irc/gameservirc.git] / gameserv-2.0 / libgameservgldl / include / GameServ / GameLayer / GameObjects / GameObject.h
1 #ifndef __GS__GAMEOBJECT_H__
2 #define __GS__GAMEOBJECT_H__
3
4 #include <GameServ/Types.h>
5 using GameServ::Types::ObjectTypes;
6
7 #include <functional>
8 #include <string>
9 using std::string;
10 using std::unary_function;
11
12 #include <boost/smart_ptr/shared_ptr.hpp>
13 using boost::shared_ptr;
14
15 namespace GameServ { namespace GameLayer { namespace GameObjects
16 {
17 class GameObject
18 {
19 public:
20 GameObject(void);
21 GameObject(const string &Id);
22 virtual ~GameObject();
23
24 //! Returns the Id of this Game Object
25 string Id(void) const;
26 //! Set the Id for this Game Object
27 void Id(const string &value);
28
29 //! Clone the entire game object
30 /*!
31 Overridden to allow deep cloning to prevent slicing.
32 \return Pointer to new Game object
33 */
34 virtual GameObject *Clone(void) const = 0;
35
36 virtual ObjectTypes::ObjectType ObjectType(void) const = 0;
37
38 bool operator==(const GameObject &right) const;
39 bool operator!=(const GameObject &right) const;
40
41
42 protected:
43 string mId;
44 friend class GameObjectIds_Eq;
45 };
46
47 //! Functor to compare Id's of Game Objects
48 class GameObjectIds_Eq : public unary_function<shared_ptr<GameObject>, bool>
49 {
50 public:
51 explicit GameObjectIds_Eq(const string &Id);
52
53 //! Comparison against shared_ptr types
54 bool operator()(const shared_ptr<GameObject> &BO) const;
55
56 private:
57 string mId;
58 };
59 }}}
60 #endif
61
62
63
64
65
66
67
68
69