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