7 #ifndef ATLAS_OBJECTS_ENTITY_ENTITY_H
8 #define ATLAS_OBJECTS_ENTITY_ENTITY_H
10 #include <Atlas/Objects/RootEntity.h>
11 #include <Atlas/Objects/Anonymous.h>
14 namespace Atlas {
namespace Objects {
namespace Entity {
22 class AdminEntityData;
23 typedef SmartPtr<AdminEntityData> AdminEntity;
25 static const int ADMIN_ENTITY_NO = 3;
38 m_class_no = ADMIN_ENTITY_NO;
51 virtual void iterate(
int& current_class, std::string& attr)
const
85 static const int ACCOUNT_NO = 4;
98 m_class_no = ACCOUNT_NO;
114 virtual void setAttr(
const std::string& name,
117 virtual void removeAttr(
const std::string& name);
123 virtual void addToMessage(Atlas::Message::MapType &)
const;
130 inline void setCharacters(
const std::list<std::string>& val);
160 virtual int getAttrFlag(
const std::string& name)
const;
175 virtual void iterate(
int& current_class, std::string& attr)
const;
197 static std::map<std::string, int> * attr_flags_AccountData;
204 extern const std::string USERNAME_ATTR;
205 extern const std::string PASSWORD_ATTR;
206 extern const std::string CHARACTERS_ATTR;
212 const int USERNAME_FLAG = 1 << 11;
217 m_attrFlags |= USERNAME_FLAG;
220 const int PASSWORD_FLAG = 1 << 12;
225 m_attrFlags |= PASSWORD_FLAG;
228 const int CHARACTERS_FLAG = 1 << 13;
233 m_attrFlags |= CHARACTERS_FLAG;
238 m_attrFlags |= CHARACTERS_FLAG;
240 for(Atlas::Message::ListType::const_iterator I = val.begin();
244 if((*I).isString()) {
252 if(m_attrFlags & USERNAME_FLAG)
260 if(!(m_attrFlags & USERNAME_FLAG))
267 if(m_attrFlags & PASSWORD_FLAG)
275 if(!(m_attrFlags & PASSWORD_FLAG))
282 if(m_attrFlags & CHARACTERS_FLAG)
285 return ((
AccountData*)m_defaults)->attr_characters;
290 if(!(m_attrFlags & CHARACTERS_FLAG))
298 Atlas::Message::ListType lst_out;
299 for(std::list<std::string>::const_iterator I = lst_in.begin();
303 lst_out.push_back(std::string(*I));
310 return (m_attrFlags & USERNAME_FLAG) == 0;
315 return (m_attrFlags & PASSWORD_FLAG) == 0;
320 return (m_attrFlags & CHARACTERS_FLAG) == 0;
334 static const int PLAYER_NO = 5;
347 m_class_no = PLAYER_NO;
360 virtual void iterate(
int& current_class, std::string& attr)
const
394 static const int ADMIN_NO = 6;
407 m_class_no = ADMIN_NO;
420 virtual void iterate(
int& current_class, std::string& attr)
const
454 static const int GAME_NO = 7;
467 m_class_no = GAME_NO;
480 virtual void iterate(
int& current_class, std::string& attr)
const
511 class GameEntityData;
514 static const int GAME_ENTITY_NO = 8;
527 m_class_no = GAME_ENTITY_NO;
540 virtual void iterate(
int& current_class, std::string& attr)
const
566 #endif // ATLAS_OBJECTS_ENTITY_ENTITY_H
std::list< std::string > & modifyCharacters()
Retrieve the "characters" attribute as a non-const reference.
Definition: Entity.h:288
virtual void free()
Free an instance of this class, returning it to the memory pool.
static AdminEntityData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class...
void setCharactersAsList(const Atlas::Message::ListType &val)
Set the "characters" attribute AsList.
Definition: Entity.h:236
void setCharacters(const std::list< std::string > &val)
Set the "characters" attribute.
Definition: Entity.h:230
virtual PlayerData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
virtual int getAttrClass(const std::string &name) const
Find the class which contains the attribute "name".
virtual void free()
Free an instance of this class, returning it to the memory pool.
virtual bool instanceOf(int classNo) const
Is this instance of some class?
static GameData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class...
virtual bool instanceOf(int classNo) const
Is this instance of some class?
Atlas stream bridge.
Definition: Bridge.h:35
void sendPassword(Atlas::Bridge &) const
Send the "password" attribute to an Atlas::Bridge.
virtual GameData * copy() const
Copy this object.
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
void setPassword(const std::string &val)
Set the "password" attribute.
Definition: Entity.h:222
virtual AccountData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
virtual void free()
Free an instance of this class, returning it to the memory pool.
virtual AdminData * copy() const
Copy this object.
std::string attr_username
Username for account usually.
Definition: Entity.h:162
static PlayerData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class...
const std::list< std::string > & getCharacters() const
Retrieve the "characters" attribute.
Definition: Entity.h:280
virtual AccountData * copy() const
Copy this object.
virtual void free()
Free an instance of this class, returning it to the memory pool.
AdminData(AdminData *defaults=NULL)
Construct a AdminData class definition.
Definition: Entity.h:404
virtual GameEntityData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
std::list< std::string > attr_characters
List of characters account can control.
Definition: Entity.h:166
Multi-type container.
Definition: Element.h:59
virtual ~AdminEntityData()
Default destructor.
virtual ~AdminData()
Default destructor.
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:420
virtual bool instanceOf(int classNo) const
Is this instance of some class?
All In Game classes and objects.
Definition: Entity.h:520
PlayerData(PlayerData *defaults=NULL)
Construct a PlayerData class definition.
Definition: Entity.h:344
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:51
virtual PlayerData * copy() const
Copy this object.
virtual bool instanceOf(int classNo) const
Is this instance of some class?
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:480
The Atlas namespace.
Definition: Bridge.h:20
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
virtual ~PlayerData()
Default destructor.
virtual AdminData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
virtual AdminEntityData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
bool isDefaultCharacters() const
Is "characters" value default?
Definition: Entity.h:318
All classes and objects used for adminitrativive purposes.
Definition: Entity.h:31
virtual ~AccountData()
Default destructor.
static GameEntityData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class...
virtual GameData * getDefaultObject()
Get the reference object that contains the default values for attributes of instances of the same cla...
Games this server hosts.
Definition: Entity.h:460
virtual bool instanceOf(int classNo) const
Is this instance of some class?
virtual void free()
Free an instance of this class, returning it to the memory pool.
GameEntityData(GameEntityData *defaults=NULL)
Construct a GameEntityData class definition.
Definition: Entity.h:524
Player accounts.
Definition: Entity.h:340
virtual int copyAttr(const std::string &name, Atlas::Message::Element &attr) const
Retrieve the attribute "name".
virtual GameEntityData * copy() const
Copy this object.
virtual void setAttr(const std::string &name, const Atlas::Message::Element &attr)
Set the attribute "name" to the value given by"attr".
bool isDefaultPassword() const
Is "password" value default?
Definition: Entity.h:313
virtual void removeAttr(const std::string &name)
Remove the attribute "name". This will not work for static attributes.
void setUsername(const std::string &val)
Set the "username" attribute.
Definition: Entity.h:214
const std::string & getPassword() const
Retrieve the "password" attribute.
Definition: Entity.h:265
void sendCharacters(Atlas::Bridge &) const
Send the "characters" attribute to an Atlas::Bridge.
static AdminData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class...
virtual void free()
Free an instance of this class, returning it to the memory pool.
virtual ~GameEntityData()
Default destructor.
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:360
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
void sendUsername(Atlas::Bridge &) const
Send the "username" attribute to an Atlas::Bridge.
static AccountData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class...
Starting point for entity hierarchy.
Definition: RootEntity.h:30
bool isDefaultUsername() const
Is "username" value default?
Definition: Entity.h:308
virtual ~GameData()
Default destructor.
virtual int getAttrFlag(const std::string &name) const
Find the flag for the attribute "name".
Privileged accounts.
Definition: Entity.h:400
std::string attr_password
Password for account usually.
Definition: Entity.h:164
const Atlas::Message::ListType getCharactersAsList() const
Retrieve the "characters" attribute AsList.
Definition: Entity.h:295
AccountData(AccountData *defaults=NULL)
Construct a AccountData class definition.
Definition: Entity.h:95
std::string & modifyPassword()
Retrieve the "password" attribute as a non-const reference.
Definition: Entity.h:273
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:540
const std::string & getUsername() const
Retrieve the "username" attribute.
Definition: Entity.h:250
virtual bool instanceOf(int classNo) const
Is this instance of some class?
Base class for accounts.
Definition: Entity.h:91
GameData(GameData *defaults=NULL)
Construct a GameData class definition.
Definition: Entity.h:464
AdminEntityData(AdminEntityData *defaults=NULL)
Construct a AdminEntityData class definition.
Definition: Entity.h:35
std::string & modifyUsername()
Retrieve the "username" attribute as a non-const reference.
Definition: Entity.h:258
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
virtual AdminEntityData * copy() const
Copy this object.