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.
virtual GameData * copy() const
Copy this object.
virtual void sendContents(Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
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...
bool isDefaultPassword() const
Is "password" value default?
Definition: Entity.h:313
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?
virtual int getAttrFlag(const std::string &name) const
Find the flag for the attribute "name".
static GameData * getDefaultObjectInstance()
Get the reference object that contains the default values for attributes of instances of this class.
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:360
Atlas stream bridge.
Definition: Bridge.h:35
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.
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.
virtual void addToMessage(Atlas::Message::MapType &) const
Write this object to an existing Element.
virtual void free()
Free an instance of this class, returning it to the memory pool.
virtual int getAttrClass(const std::string &name) const
Find the class which contains the attribute "name".
AdminData(AdminData *defaults=NULL)
Construct a AdminData class definition.
Definition: Entity.h:404
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
const std::string & getPassword() const
Retrieve the "password" attribute.
Definition: Entity.h:265
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
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:540
virtual bool instanceOf(int classNo) const
Is this instance of some class?
Multi-type container.
Definition: Element.h:60
virtual ~AdminEntityData()
Default destructor.
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:51
void sendCharacters(Atlas::Bridge &) const
Send the "characters" attribute to an Atlas::Bridge.
virtual ~AdminData()
Default destructor.
All In Game classes and objects.
Definition: Entity.h:520
PlayerData(PlayerData *defaults=NULL)
Construct a PlayerData class definition.
Definition: Entity.h:344
virtual bool instanceOf(int classNo) const
Is this instance of some class?
virtual GameEntityData * copy() const
Copy this object.
virtual AdminEntityData * copy() const
Copy this object.
The Atlas namespace.
Definition: Bridge.h:20
virtual ~PlayerData()
Default destructor.
virtual AdminData * copy() const
Copy this object.
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...
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 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 PlayerData * 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".
virtual void removeAttr(const std::string &name)
Remove the attribute "name". This will not work for static attributes.
bool isDefaultUsername() const
Is "username" value default?
Definition: Entity.h:308
virtual bool instanceOf(int classNo) const
Is this instance of some class?
void setUsername(const std::string &val)
Set the "username" attribute.
Definition: Entity.h:214
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
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 AccountData * copy() const
Copy this object.
const std::string & getUsername() const
Retrieve the "username" attribute.
Definition: Entity.h:250
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
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:420
virtual ~GameData()
Default destructor.
const std::list< std::string > & getCharacters() const
Retrieve the "characters" attribute.
Definition: Entity.h:280
Privileged accounts.
Definition: Entity.h:400
std::string attr_password
Password for account usually.
Definition: Entity.h:164
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 bool instanceOf(int classNo) const
Is this instance of some class?
void sendPassword(Atlas::Bridge &) const
Send the "password" attribute to an Atlas::Bridge.
Base class for accounts.
Definition: Entity.h:91
bool isDefaultCharacters() const
Is "characters" value default?
Definition: Entity.h:318
virtual void iterate(int ¤t_class, std::string &attr) const
Iterate over the attributes of this instance.
Definition: Entity.h:480
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 bool instanceOf(int classNo) const
Is this instance of some class?
void sendUsername(Atlas::Bridge &) const
Send the "username" attribute to an Atlas::Bridge.
const Atlas::Message::ListType getCharactersAsList() const
Retrieve the "characters" attribute AsList.
Definition: Entity.h:295