i6engine  1.0
ObjectConfig.h
Go to the documentation of this file.
1 /*
2  * i6engine
3  * Copyright (2016) Daniel Bonrath, Michael Baer, All rights reserved.
4  *
5  * This file is part of i6engine; i6engine is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
25 #ifndef __I6ENGINE_API_OBJECTCONFIG_H__
26 #define __I6ENGINE_API_OBJECTCONFIG_H__
27 
29 
32 
36 
37 #include "boost/function.hpp"
38 
39 namespace i6e {
40 namespace api {
41 
42  class Component;
43  class GameObject;
44 
45  typedef utils::sharedPtr<Component, Component> ComPtr;
46  typedef boost::function<ComPtr(const int64_t, const attributeMap &)> createGOCCallback;
47  typedef utils::sharedPtr<GameObject, GameObject> GOPtr;
48  typedef utils::weakPtr<GameObject, GameObject> WeakGOPtr;
49  typedef void (*CreateGO)(GOPtr, const attributeMap &);
50 
51 namespace objects {
53  ObjReset = 0,
68  };
69 
74  std::string _template;
75  int64_t _id;
77  bool _owner;
78  std::string _identifier;
79  bool _deleted;
80 
81  GOTemplateComponent() : _template(), _id(-1), _params(), _owner(false), _identifier(), _deleted(false) {
82  }
83 
84  GOTemplateComponent(const std::string & t, int64_t i, const attributeMap & p, bool b, const std::string & id, bool deleted) : _template(t), _id(i), _params(p), _owner(b), _identifier(id), _deleted(deleted) {
85  }
86 
87  GOTemplateComponent(const std::string & t, const attributeMap & p, const std::string & id, bool deleted, bool owner) : _template(t), _id(-1), _params(p), _owner(owner), _identifier(id), _deleted(deleted) {
88  }
89 
90  template<class Archive>
91  void serialize(Archive & ar, const unsigned int) {
92  ar & _template;
93  ar & _id;
94  ar & _params;
95  ar & _owner;
96  ar & _identifier;
97  ar & _deleted;
98  }
100 
104  typedef struct ISIXE_MODULES_API GOTemplate {
105  std::string _type; // Type of the GO
106  std::vector<GOTemplateComponent> _components; // template name, id, params, owner
107  template<class Archive>
108  void serialize(Archive & ar, const unsigned int) {
109  ar & _type;
110  ar & _components;
111  }
112  } GOTemplate;
113 
118  std::string tpl;
120  uint64_t uuid;
122  bool send;
124  Object_Create_Create(const int64_t i, const std::string & t, const core::IPKey & own, uint64_t u, const GOTemplate & g, const bool b);
125  template<class Archive>
126  void serialize(Archive & ar, const unsigned int) {
127  ar & boost::serialization::base_object<GameMessageStruct>(*this);
128  ar & tpl;
129  ar & owner;
130  ar & uuid;
131  ar & tmpl;
132  ar & send;
133  }
134  Object_Create_Create * copy() { return new Object_Create_Create(*this); }
136 
143  Object_Create_Delete(const int64_t i, const core::IPKey & o);
144  template<class Archive>
145  void serialize(Archive & ar, const unsigned int) {
146  ar & boost::serialization::base_object<GameMessageStruct>(*this);
147  ar & owner;
148  }
149  Object_Create_Delete * copy() { return new Object_Create_Delete(*this); }
151 
156  std::string file;
157  std::string flags;
158  std::function<void(uint16_t)> callback;
159  std::function<void(void)> func;
161  Object_Level_Create(const std::string & fi, const std::string & fl, const std::function<void(uint16_t)> & cb, const std::function<void(void)> & fu);
162  template<class Archive>
163  void serialize(Archive & ar, const unsigned int) {
164  ar & boost::serialization::base_object<GameMessageStruct>(*this);
165  ar & file;
166  ar & flags;
167  }
168  Object_Level_Create * copy() { return new Object_Level_Create(*this); }
170 
175  std::string type;
177  Object_Type_Delete(const std::string & t);
178  template<class Archive>
179  void serialize(Archive & ar, const unsigned int) {
180  ar & boost::serialization::base_object<GameMessageStruct>(*this);
181  ar & type;
182  }
183  Object_Type_Delete * copy() { return new Object_Type_Delete(*this); }
185 
191  std::string name;
192  createGOCCallback func;
194  Object_RegisterCTemplate_Create(const std::string & n, const createGOCCallback & f);
197 
205  Object_State_Update(const core::IPKey & r);
206  Object_State_Update * copy() { return new Object_State_Update(*this); }
208 
214  std::string tpl;
216  uint64_t uuid;
218  bool send;
219  boost::function<void(const GOPtr &)> func;
221  Object_CreateAndCall_Create(const int64_t i, const std::string & t, const core::IPKey & own, uint64_t u, const GOTemplate & g, const bool b, const boost::function<void(const GOPtr &)> & f);
224 
231  boost::function<bool(const GOPtr &)> func;
232  bool sync;
233  uint32_t comFamID;
235  Object_ConditionalMessage_Update(const GameMessage::Ptr & m, const boost::function<bool(const GOPtr &)> & f, bool s, uint32_t c);
238 
245  Object_KillMe_Update * copy() { return new Object_KillMe_Update(*this); }
247 
255 
256  Position_Update();
257  Position_Update(const int64_t i, const int64_t ci, const Vec3 & p, const Quaternion & r, const Vec3 & s);
258  Position_Update * copy() { return new Position_Update(*this); }
259  template<class Archive>
260  void serialize(Archive & ar, const unsigned int) {
261  ar & boost::serialization::base_object<GameMessageStruct>(*this);
262  ar & pos;
263  ar & rot;
264  ar & scale;
265  }
266  } Position_Update;
267 
274  Object_Clean_Delete * copy() {
275  return new Object_Clean_Delete(*this);
276  }
278 
284  bool pause;
285  Object_Pause_Update(bool p) : pause(p) {
286  }
288  return new Object_Pause_Update(*this);
289  }
291 
298  Object_ComponentTicking_Update(bool a) : allowTicking(a) {
299  }
301  return new Object_ComponentTicking_Update(*this);
302  }
304 
305 } /* namespace objects */
306 } /* namespace api */
307 } /* namespace i6e */
308 
309 #endif /* __I6ENGINE_API_OBJECTCONFIG_H__ */
310 
struct for registering component templates never send through network
Definition: ObjectConfig.h:190
void serialize(Archive &ar, const unsigned int)
Definition: ObjectConfig.h:163
utils::sharedPtr< GameObject, GameObject > GOPtr
Definition: Component.h:55
void serialize(Archive &ar, const unsigned int)
Definition: ObjectConfig.h:108
void serialize(Archive &ar, const unsigned int)
Definition: ObjectConfig.h:260
struct for deletion of all GameObjects never send through network
Definition: ObjectConfig.h:272
struct for saying the Object subsystem to send its state through network never send through network ...
Definition: ObjectConfig.h:202
i6e::api::objects::Object_Pause_Update Object_Pause_Update
pauses the subsystem never send through network
GOTemplateComponent(const std::string &t, const attributeMap &p, const std::string &id, bool deleted, bool owner)
Definition: ObjectConfig.h:87
internal representation of a Component within a GameObject template
Definition: ObjectConfig.h:73
struct for sending messages to special GameObjects fullfilling the given method never send through ne...
Definition: ObjectConfig.h:229
Class describing a 3d rotation.
Definition: i6eQuaternion.h:58
void serialize(Archive &ar, const unsigned int)
Definition: ObjectConfig.h:91
Object_Type_Delete * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:183
i6e::api::objects::Object_CreateAndCall_Create Object_CreateAndCall_Create
struct for creation of a GameObject and calling a callback with it never send through network ...
i6e::api::objects::Object_Type_Delete Object_Type_Delete
deletes all objects of given type
#define ISIXE_MODULES_API
i6e::api::objects::Object_Create_Delete Object_Create_Delete
deletes a GameObject
Object_Create_Create * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:134
boost::shared_ptr< Message > Ptr
Definition: Message.h:66
struct ISIXE_MODULES_API i6e::api::objects::GOTemplateComponent GOTemplateComponent
internal representation of a Component within a GameObject template
std::map< std::string, std::string > attributeMap
Definition: attributeMap.h:42
Object_RegisterCTemplate_Create * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:195
Object_Level_Create * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:168
utils::weakPtr< GameObject > WeakGOPtr
Definition: Component.h:57
Implements 3-dimensional vectors.
Definition: i6eVector.h:48
void serialize(Archive &ar, const unsigned int)
Definition: ObjectConfig.h:145
i6e::api::objects::Object_RegisterCTemplate_Create Object_RegisterCTemplate_Create
struct for registering component templates never send through network
Object_Clean_Delete * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:274
i6e::api::objects::Object_Level_Create Object_Level_Create
loads a level
enables or disables ticking of Components never send through network
Definition: ObjectConfig.h:296
creates a GameObject out of a template file
Definition: ObjectConfig.h:117
Object_KillMe_Update * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:245
void(* CreateGO)(GOPtr, const attributeMap &)
Definition: ObjectConfig.h:49
std::vector< GOTemplateComponent > _components
Definition: ObjectConfig.h:106
internal representation of all GameObject templates
Definition: ObjectConfig.h:104
i6e::api::objects::Object_ConditionalMessage_Update Object_ConditionalMessage_Update
struct for sending messages to special GameObjects fullfilling the given method never send through ne...
struct for creation of a GameObject and calling a callback with it never send through network ...
Definition: ObjectConfig.h:213
i6e::api::objects::Position_Update Position_Update
message for creation of new Position
std::function< void(void)> func
Definition: ObjectConfig.h:159
boost::function< ComPtr(const int64_t, const attributeMap &)> createGOCCallback
Definition: Component.h:58
deletes all objects of given type
Definition: ObjectConfig.h:174
struct for deletion of GameObject using ConditionalMessage never send through network ...
Definition: ObjectConfig.h:243
GOTemplateComponent(const std::string &t, int64_t i, const attributeMap &p, bool b, const std::string &id, bool deleted)
Definition: ObjectConfig.h:84
void serialize(Archive &ar, const unsigned int)
Definition: ObjectConfig.h:179
boost::function< bool(const GOPtr &)> func
Definition: ObjectConfig.h:231
pauses the subsystem never send through network
Definition: ObjectConfig.h:283
i6e::api::objects::Object_KillMe_Update Object_KillMe_Update
struct for deletion of GameObject using ConditionalMessage never send through network ...
i6e::api::objects::Object_State_Update Object_State_Update
struct for saying the Object subsystem to send its state through network never send through network ...
boost::function< void(const GOPtr &)> func
Definition: ObjectConfig.h:219
Object_CreateAndCall_Create * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:222
Position_Update * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:258
i6e::api::objects::Object_Create_Create Object_Create_Create
creates a GameObject out of a template file
Object_State_Update * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:206
std::function< void(uint16_t)> callback
Definition: ObjectConfig.h:158
utils::sharedPtr< Component, Component > ComPtr
Definition: Component.h:52
Object_ConditionalMessage_Update * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:236
message for creation of new Position
Definition: ObjectConfig.h:251
i6e::api::objects::Object_Clean_Delete Object_Clean_Delete
struct for deletion of all GameObjects never send through network
struct ISIXE_MODULES_API i6e::api::objects::GOTemplate GOTemplate
internal representation of all GameObject templates
Object_ComponentTicking_Update * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:300
i6e::api::objects::Object_ComponentTicking_Update Object_ComponentTicking_Update
enables or disables ticking of Components never send through network
Object_Pause_Update * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:287
void serialize(Archive &ar, const unsigned int)
Definition: ObjectConfig.h:126
Object_Create_Delete * copy()
Copy method returning an exact copy of itself.
Definition: ObjectConfig.h:149