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