1 // This file may be redistributed and modified only under the terms of
2 // the GNU Lesser General Public License (See COPYING for details).
3 // Copyright 2000-2001 Stefanus Du Toit and Aloril.
4 // Copyright 2001-2005 Alistair Riddoch.
5 // Automatically generated using gen_cpp.py.
6 
7 #ifndef ATLAS_OBJECTS_ENTITY_ENTITY_H
8 #define ATLAS_OBJECTS_ENTITY_ENTITY_H
9 
10 #include <Atlas/Objects/RootEntity.h>
11 #include <Atlas/Objects/Anonymous.h>
12 
13 
14 namespace Atlas { namespace Objects { namespace Entity {
15 
16 /** All classes and objects used for adminitrativive purposes
17 
18 Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
19 
20 */
21 
22 class AdminEntityData;
23 typedef SmartPtr<AdminEntityData> AdminEntity;
24 
25 static const int ADMIN_ENTITY_NO = 3;
26 
27 /// \brief All classes and objects used for adminitrativive purposes.
28 ///
29 /** Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
30  */
31 class AdminEntityData : public RootEntityData
32 {
33 protected:
34     /// Construct a AdminEntityData class definition.
35     AdminEntityData(AdminEntityData *defaults = NULL) :
36         RootEntityData((RootEntityData*)defaults)
37     {
38         m_class_no = ADMIN_ENTITY_NO;
39     }
40     /// Default destructor.
41     virtual ~AdminEntityData();
42 
43 public:
44     /// Copy this object.
45     virtual AdminEntityData * copy() const;
46 
47     /// Is this instance of some class?
48     virtual bool instanceOf(int classNo) const;
49 
50 
iterate(int & current_class,std::string & attr)51     virtual void iterate(int& current_class, std::string& attr) const
52         {if(current_class == ADMIN_ENTITY_NO) current_class = -1; RootEntityData::iterate(current_class, attr);}
53 
54     //freelist related things
55 public:
56     static AdminEntityData *alloc();
57     virtual void free();
58 
59     /// \brief Get the reference object that contains the default values for
60     /// attributes of instances of the same class as this object.
61     ///
62     /// @return a pointer to the default object.
63     virtual AdminEntityData *getDefaultObject();
64 
65     /// \brief Get the reference object that contains the default values for
66     /// attributes of instances of this class.
67     ///
68     /// @return a pointer to the default object.
69     static AdminEntityData *getDefaultObjectInstance();
70 private:
71     static AdminEntityData *defaults_AdminEntityData;
72     static AdminEntityData *begin_AdminEntityData;
73 };
74 
75 
76 /** Base class for accounts
77 
78 Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
79 
80 */
81 
82 class AccountData;
83 typedef SmartPtr<AccountData> Account;
84 
85 static const int ACCOUNT_NO = 4;
86 
87 /// \brief Base class for accounts.
88 ///
89 /** Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
90  */
91 class AccountData : public AdminEntityData
92 {
93 protected:
94     /// Construct a AccountData class definition.
95     AccountData(AccountData *defaults = NULL) :
96         AdminEntityData((AdminEntityData*)defaults)
97     {
98         m_class_no = ACCOUNT_NO;
99     }
100     /// Default destructor.
101     virtual ~AccountData();
102 
103 public:
104     /// Copy this object.
105     virtual AccountData * copy() const;
106 
107     /// Is this instance of some class?
108     virtual bool instanceOf(int classNo) const;
109 
110     /// Retrieve the attribute "name". Return non-zero if it does
111     /// not exist.
112     virtual int copyAttr(const std::string& name, Atlas::Message::Element & attr) const;
113     /// Set the attribute "name" to the value given by"attr"
114     virtual void setAttr(const std::string& name,
115                          const Atlas::Message::Element& attr);
116     /// Remove the attribute "name". This will not work for static attributes.
117     virtual void removeAttr(const std::string& name);
118 
119     /// Send the contents of this object to a Bridge.
120     virtual void sendContents(Atlas::Bridge & b) const;
121 
122     /// Write this object to an existing Element.
123     virtual void addToMessage(Atlas::Message::MapType &) const;
124 
125     /// Set the "username" attribute.
126     inline void setUsername(const std::string& val);
127     /// Set the "password" attribute.
128     inline void setPassword(const std::string& val);
129     /// Set the "characters" attribute.
130     inline void setCharacters(const std::list<std::string>& val);
131     /// Set the "characters" attribute AsList.
132     inline void setCharactersAsList(const Atlas::Message::ListType& val);
133 
134     /// Retrieve the "username" attribute.
135     inline const std::string& getUsername() const;
136     /// Retrieve the "username" attribute as a non-const reference.
137     inline std::string& modifyUsername();
138     /// Retrieve the "password" attribute.
139     inline const std::string& getPassword() const;
140     /// Retrieve the "password" attribute as a non-const reference.
141     inline std::string& modifyPassword();
142     /// Retrieve the "characters" attribute.
143     inline const std::list<std::string>& getCharacters() const;
144     /// Retrieve the "characters" attribute as a non-const reference.
145     inline std::list<std::string>& modifyCharacters();
146     /// Retrieve the "characters" attribute AsList.
147     inline const Atlas::Message::ListType getCharactersAsList() const;
148 
149     /// Is "username" value default?
150     inline bool isDefaultUsername() const;
151     /// Is "password" value default?
152     inline bool isDefaultPassword() const;
153     /// Is "characters" value default?
154     inline bool isDefaultCharacters() const;
155 
156 protected:
157     /// Find the class which contains the attribute "name".
158     virtual int getAttrClass(const std::string& name)const;
159     /// Find the flag for the attribute "name".
160     virtual int getAttrFlag(const std::string& name)const;
161     /// Username for account usually
162     std::string attr_username;
163     /// Password for account usually
164     std::string attr_password;
165     /// List of characters account can control
166     std::list<std::string> attr_characters;
167 
168     /// Send the "username" attribute to an Atlas::Bridge.
169     void sendUsername(Atlas::Bridge&) const;
170     /// Send the "password" attribute to an Atlas::Bridge.
171     void sendPassword(Atlas::Bridge&) const;
172     /// Send the "characters" attribute to an Atlas::Bridge.
173     void sendCharacters(Atlas::Bridge&) const;
174 
175     virtual void iterate(int& current_class, std::string& attr) const;
176 
177     //freelist related things
178 public:
179     static AccountData *alloc();
180     virtual void free();
181 
182     /// \brief Get the reference object that contains the default values for
183     /// attributes of instances of the same class as this object.
184     ///
185     /// @return a pointer to the default object.
186     virtual AccountData *getDefaultObject();
187 
188     /// \brief Get the reference object that contains the default values for
189     /// attributes of instances of this class.
190     ///
191     /// @return a pointer to the default object.
192     static AccountData *getDefaultObjectInstance();
193 private:
194     static AccountData *defaults_AccountData;
195     static AccountData *begin_AccountData;
196 
197     static std::map<std::string, int> * attr_flags_AccountData;
198 };
199 
200 //
201 // Attribute name strings follow.
202 //
203 
204 extern const std::string USERNAME_ATTR;
205 extern const std::string PASSWORD_ATTR;
206 extern const std::string CHARACTERS_ATTR;
207 
208 //
209 // Inlined member functions follow.
210 //
211 
212 const int USERNAME_FLAG = 1 << 11;
213 
setUsername(const std::string & val)214 void AccountData::setUsername(const std::string& val)
215 {
216     attr_username = val;
217     m_attrFlags |= USERNAME_FLAG;
218 }
219 
220 const int PASSWORD_FLAG = 1 << 12;
221 
setPassword(const std::string & val)222 void AccountData::setPassword(const std::string& val)
223 {
224     attr_password = val;
225     m_attrFlags |= PASSWORD_FLAG;
226 }
227 
228 const int CHARACTERS_FLAG = 1 << 13;
229 
setCharacters(const std::list<std::string> & val)230 void AccountData::setCharacters(const std::list<std::string>& val)
231 {
232     attr_characters = val;
233     m_attrFlags |= CHARACTERS_FLAG;
234 }
235 
setCharactersAsList(const Atlas::Message::ListType & val)236 void AccountData::setCharactersAsList(const Atlas::Message::ListType& val)
237 {
238     m_attrFlags |= CHARACTERS_FLAG;
239     attr_characters.resize(0);
240     for(Atlas::Message::ListType::const_iterator I = val.begin();
241         I != val.end();
242         I++)
243     {
244         if((*I).isString()) {
245             attr_characters.push_back((*I).asString());
246         }
247     }
248 }
249 
getUsername()250 const std::string& AccountData::getUsername() const
251 {
252     if(m_attrFlags & USERNAME_FLAG)
253         return attr_username;
254     else
255         return ((AccountData*)m_defaults)->attr_username;
256 }
257 
modifyUsername()258 std::string& AccountData::modifyUsername()
259 {
260     if(!(m_attrFlags & USERNAME_FLAG))
261         setUsername(((AccountData*)m_defaults)->attr_username);
262     return attr_username;
263 }
264 
getPassword()265 const std::string& AccountData::getPassword() const
266 {
267     if(m_attrFlags & PASSWORD_FLAG)
268         return attr_password;
269     else
270         return ((AccountData*)m_defaults)->attr_password;
271 }
272 
modifyPassword()273 std::string& AccountData::modifyPassword()
274 {
275     if(!(m_attrFlags & PASSWORD_FLAG))
276         setPassword(((AccountData*)m_defaults)->attr_password);
277     return attr_password;
278 }
279 
getCharacters()280 const std::list<std::string>& AccountData::getCharacters() const
281 {
282     if(m_attrFlags & CHARACTERS_FLAG)
283         return attr_characters;
284     else
285         return ((AccountData*)m_defaults)->attr_characters;
286 }
287 
modifyCharacters()288 std::list<std::string>& AccountData::modifyCharacters()
289 {
290     if(!(m_attrFlags & CHARACTERS_FLAG))
291         setCharacters(((AccountData*)m_defaults)->attr_characters);
292     return attr_characters;
293 }
294 
getCharactersAsList()295 const Atlas::Message::ListType AccountData::getCharactersAsList() const
296 {
297     const std::list<std::string>& lst_in = getCharacters();
298     Atlas::Message::ListType lst_out;
299     for(std::list<std::string>::const_iterator I = lst_in.begin();
300         I != lst_in.end();
301         I++)
302     {
303         lst_out.push_back(std::string(*I));
304     }
305     return lst_out;
306 }
307 
isDefaultUsername()308 bool AccountData::isDefaultUsername() const
309 {
310     return (m_attrFlags & USERNAME_FLAG) == 0;
311 }
312 
isDefaultPassword()313 bool AccountData::isDefaultPassword() const
314 {
315     return (m_attrFlags & PASSWORD_FLAG) == 0;
316 }
317 
isDefaultCharacters()318 bool AccountData::isDefaultCharacters() const
319 {
320     return (m_attrFlags & CHARACTERS_FLAG) == 0;
321 }
322 
323 
324 
325 /** Player accounts
326 
327 Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
328 
329 */
330 
331 class PlayerData;
332 typedef SmartPtr<PlayerData> Player;
333 
334 static const int PLAYER_NO = 5;
335 
336 /// \brief Player accounts.
337 ///
338 /** Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
339  */
340 class PlayerData : public AccountData
341 {
342 protected:
343     /// Construct a PlayerData class definition.
344     PlayerData(PlayerData *defaults = NULL) :
345         AccountData((AccountData*)defaults)
346     {
347         m_class_no = PLAYER_NO;
348     }
349     /// Default destructor.
350     virtual ~PlayerData();
351 
352 public:
353     /// Copy this object.
354     virtual PlayerData * copy() const;
355 
356     /// Is this instance of some class?
357     virtual bool instanceOf(int classNo) const;
358 
359 
iterate(int & current_class,std::string & attr)360     virtual void iterate(int& current_class, std::string& attr) const
361         {if(current_class == PLAYER_NO) current_class = -1; AccountData::iterate(current_class, attr);}
362 
363     //freelist related things
364 public:
365     static PlayerData *alloc();
366     virtual void free();
367 
368     /// \brief Get the reference object that contains the default values for
369     /// attributes of instances of the same class as this object.
370     ///
371     /// @return a pointer to the default object.
372     virtual PlayerData *getDefaultObject();
373 
374     /// \brief Get the reference object that contains the default values for
375     /// attributes of instances of this class.
376     ///
377     /// @return a pointer to the default object.
378     static PlayerData *getDefaultObjectInstance();
379 private:
380     static PlayerData *defaults_PlayerData;
381     static PlayerData *begin_PlayerData;
382 };
383 
384 
385 /** Privileged accounts
386 
387 Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
388 
389 */
390 
391 class AdminData;
392 typedef SmartPtr<AdminData> Admin;
393 
394 static const int ADMIN_NO = 6;
395 
396 /// \brief Privileged accounts.
397 ///
398 /** Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
399  */
400 class AdminData : public AccountData
401 {
402 protected:
403     /// Construct a AdminData class definition.
404     AdminData(AdminData *defaults = NULL) :
405         AccountData((AccountData*)defaults)
406     {
407         m_class_no = ADMIN_NO;
408     }
409     /// Default destructor.
410     virtual ~AdminData();
411 
412 public:
413     /// Copy this object.
414     virtual AdminData * copy() const;
415 
416     /// Is this instance of some class?
417     virtual bool instanceOf(int classNo) const;
418 
419 
iterate(int & current_class,std::string & attr)420     virtual void iterate(int& current_class, std::string& attr) const
421         {if(current_class == ADMIN_NO) current_class = -1; AccountData::iterate(current_class, attr);}
422 
423     //freelist related things
424 public:
425     static AdminData *alloc();
426     virtual void free();
427 
428     /// \brief Get the reference object that contains the default values for
429     /// attributes of instances of the same class as this object.
430     ///
431     /// @return a pointer to the default object.
432     virtual AdminData *getDefaultObject();
433 
434     /// \brief Get the reference object that contains the default values for
435     /// attributes of instances of this class.
436     ///
437     /// @return a pointer to the default object.
438     static AdminData *getDefaultObjectInstance();
439 private:
440     static AdminData *defaults_AdminData;
441     static AdminData *begin_AdminData;
442 };
443 
444 
445 /** Games this server hosts
446 
447 Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
448 
449 */
450 
451 class GameData;
452 typedef SmartPtr<GameData> Game;
453 
454 static const int GAME_NO = 7;
455 
456 /// \brief Games this server hosts.
457 ///
458 /** Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
459  */
460 class GameData : public AdminEntityData
461 {
462 protected:
463     /// Construct a GameData class definition.
464     GameData(GameData *defaults = NULL) :
465         AdminEntityData((AdminEntityData*)defaults)
466     {
467         m_class_no = GAME_NO;
468     }
469     /// Default destructor.
470     virtual ~GameData();
471 
472 public:
473     /// Copy this object.
474     virtual GameData * copy() const;
475 
476     /// Is this instance of some class?
477     virtual bool instanceOf(int classNo) const;
478 
479 
iterate(int & current_class,std::string & attr)480     virtual void iterate(int& current_class, std::string& attr) const
481         {if(current_class == GAME_NO) current_class = -1; AdminEntityData::iterate(current_class, attr);}
482 
483     //freelist related things
484 public:
485     static GameData *alloc();
486     virtual void free();
487 
488     /// \brief Get the reference object that contains the default values for
489     /// attributes of instances of the same class as this object.
490     ///
491     /// @return a pointer to the default object.
492     virtual GameData *getDefaultObject();
493 
494     /// \brief Get the reference object that contains the default values for
495     /// attributes of instances of this class.
496     ///
497     /// @return a pointer to the default object.
498     static GameData *getDefaultObjectInstance();
499 private:
500     static GameData *defaults_GameData;
501     static GameData *begin_GameData;
502 };
503 
504 
505 /** All In Game classes and objects
506 
507 Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
508 
509 */
510 
511 class GameEntityData;
512 typedef SmartPtr<GameEntityData> GameEntity;
513 
514 static const int GAME_ENTITY_NO = 8;
515 
516 /// \brief All In Game classes and objects.
517 ///
518 /** Later in hierarchy tree objtype changes to 'object' when actual game objects are made.
519  */
520 class GameEntityData : public RootEntityData
521 {
522 protected:
523     /// Construct a GameEntityData class definition.
524     GameEntityData(GameEntityData *defaults = NULL) :
525         RootEntityData((RootEntityData*)defaults)
526     {
527         m_class_no = GAME_ENTITY_NO;
528     }
529     /// Default destructor.
530     virtual ~GameEntityData();
531 
532 public:
533     /// Copy this object.
534     virtual GameEntityData * copy() const;
535 
536     /// Is this instance of some class?
537     virtual bool instanceOf(int classNo) const;
538 
539 
iterate(int & current_class,std::string & attr)540     virtual void iterate(int& current_class, std::string& attr) const
541         {if(current_class == GAME_ENTITY_NO) current_class = -1; RootEntityData::iterate(current_class, attr);}
542 
543     //freelist related things
544 public:
545     static GameEntityData *alloc();
546     virtual void free();
547 
548     /// \brief Get the reference object that contains the default values for
549     /// attributes of instances of the same class as this object.
550     ///
551     /// @return a pointer to the default object.
552     virtual GameEntityData *getDefaultObject();
553 
554     /// \brief Get the reference object that contains the default values for
555     /// attributes of instances of this class.
556     ///
557     /// @return a pointer to the default object.
558     static GameEntityData *getDefaultObjectInstance();
559 private:
560     static GameEntityData *defaults_GameEntityData;
561     static GameEntityData *begin_GameEntityData;
562 };
563 
564 } } } // namespace Atlas::Objects::Entity
565 
566 #endif // ATLAS_OBJECTS_ENTITY_ENTITY_H
567