Atlas::Objects::BaseObjectData

Section: C Library Functions (3)
Updated: 24 Jul 2009
Index Return to Main Contents
 

NAME

Atlas::Objects::BaseObjectData - Atlas base object class.

 

SYNOPSIS


#include <BaseObject.h>

Inherited by Atlas::Objects::RootData.

 

Classes


class const_iterator

class iterator
The iterator first iterates over the contents of m_obj->m_attributes, holding an iterator to the attributes map in m_I.  

Public Member Functions


BaseObjectData (BaseObjectData *defaults)
Construct a new BaseObjectData from a subclass.
int getClassNo () const
Get class number:.
int getAttrFlags () const

virtual BaseObjectData * copy () const =0

virtual bool instanceOf (int classNo) const
Is this instance of some class?
bool hasAttr (const std::string &name) const
Check whether the attribute 'name' exists.
bool hasAttrFlag (int flag) const
Check whether the attribute 'name' exists.
const Atlas::Message::Element getAttr (const std::string &name) const throw (NoSuchAttrException)
Retrieve the attribute 'name'.
virtual int copyAttr (const std::string &name, Atlas::Message::Element &attr) const
Retrieve the attribute 'name'.
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'.
virtual void removeAttrFlag (int flag)
Remove the attribute 'name'.
const Atlas::Message::MapType asMessage () const
Convert this object to a Object.
virtual void addToMessage (Atlas::Message::MapType &) const
Write this object to an existing Element.
virtual void sendContents (Atlas::Bridge &b) const
Send the contents of this object to a Bridge.
void incRef ()

void decRef ()

virtual void free ()=0
Free an instance of this class, returning it to the memory pool.
iterator begin ()

iterator end ()

iterator find (const std::string &)

const_iterator begin () const

const_iterator end () const

const_iterator find (const std::string &) const
 

Static Public Member Functions


static BaseObjectData * alloc ()
Allocate a new instance of this class, using an existing instance if available.  

Protected Member Functions


virtual int getAttrClass (const std::string &name) const
Find the class which contains the attribute 'name'.
virtual int getAttrFlag (const std::string &name) const
Find the flag for the attribute 'name'.
virtual void iterate (int &current_class, std::string &attr) const
Iterate over the attributes of this instance.  

Protected Attributes


int m_class_no

int m_refCount

BaseObjectData * m_defaults

BaseObjectData * m_next

std::map< std::string, Atlas::Message::Element > m_attributes

int m_attrFlags
 

Friends


class iterator

class const_iterator
 

Detailed Description

Atlas base object class.

This is class is the base from which all classes used to represent high level objects are derived. In this release of Atlas-C++, all classes that inherit from BaseObjectData are designed to be used with SmartPtr and should have the suffix Data on the end of their name. All the subclasses of BaseObjectData included with Atlas-C++ are automatically generated from the Atlas spec at release time. For each subclass a typedef is created of a specialisation of SmartPtr aliasing it to the name of the class without the Data suffix. Thus RootOperationData has an associate type RootOperation which is a typedef for SmartPtr<RootOperationData>. Each class also has an associated integer identifier used to identify classes of its type. The SmartPtr class is designed to store unused instances of the data objects in a memory pool, and reuse instances as they are required. In order to re-use instances without re-constructing all their members, a system of flags is used to mark which members are in use. When an instance is re-used these flags are cleared, indicating that none of the members are in use.  

Constructor & Destructor Documentation

 

Atlas::Objects::BaseObjectData::BaseObjectData (BaseObjectData * defaults)

Construct a new BaseObjectData from a subclass.

Initialises flags to zero, and stores a pointer to the reference object that provides default values for all attributes. Subclasses must pass in a pointer to their class specific reference object.  

Member Function Documentation

 

static BaseObjectData* Atlas::Objects::BaseObjectData::alloc () [inline, static]

Allocate a new instance of this class, using an existing instance if available.

This is the key function for implementing the memory pool for the Atlas::Objects API.

Reimplemented in Atlas::Objects::Entity::AnonymousData, Atlas::Objects::Entity::AdminEntityData, Atlas::Objects::Entity::AccountData, Atlas::Objects::Entity::PlayerData, Atlas::Objects::Entity::AdminData, Atlas::Objects::Entity::GameData, Atlas::Objects::Entity::GameEntityData, Atlas::Objects::Operation::GenericData, Atlas::Objects::Operation::ActionData, Atlas::Objects::Operation::CreateData, Atlas::Objects::Operation::CombineData, Atlas::Objects::Operation::DivideData, Atlas::Objects::Operation::CommunicateData, Atlas::Objects::Operation::TalkData, Atlas::Objects::Operation::DeleteData, Atlas::Objects::Operation::SetData, Atlas::Objects::Operation::AffectData, Atlas::Objects::Operation::MoveData, Atlas::Objects::Operation::WieldData, Atlas::Objects::Operation::GetData, Atlas::Objects::Operation::PerceiveData, Atlas::Objects::Operation::LookData, Atlas::Objects::Operation::ListenData, Atlas::Objects::Operation::SniffData, Atlas::Objects::Operation::TouchData, Atlas::Objects::Operation::LoginData, Atlas::Objects::Operation::LogoutData, Atlas::Objects::Operation::ImaginaryData, Atlas::Objects::Operation::UseData, Atlas::Objects::Operation::InfoData, Atlas::Objects::Operation::PerceptionData, Atlas::Objects::Operation::SightData, Atlas::Objects::Operation::AppearanceData, Atlas::Objects::Operation::DisappearanceData, Atlas::Objects::Operation::SoundData, Atlas::Objects::Operation::SmellData, Atlas::Objects::Operation::FeelData, Atlas::Objects::Operation::ErrorData, Atlas::Objects::RootData, Atlas::Objects::Entity::RootEntityData, and Atlas::Objects::Operation::RootOperationData.  

const Atlas::Message::MapType Atlas::Objects::BaseObjectData::asMessage () const

Convert this object to a Object.

This is now legacy, and implemented using addToMessage.  

virtual int Atlas::Objects::BaseObjectData::copyAttr (const std::string & name, Atlas::Message::Element & attr) const [virtual]

Retrieve the attribute 'name'.

Return non-zero if it does not exist.

Reimplemented in Atlas::Objects::Entity::AccountData, Atlas::Objects::RootData, Atlas::Objects::Entity::RootEntityData, and Atlas::Objects::Operation::RootOperationData.  

virtual void Atlas::Objects::BaseObjectData::free () [pure virtual]

Free an instance of this class, returning it to the memory pool.

This function in combination with alloc() handle the memory pool.

Implemented in Atlas::Objects::Entity::AnonymousData, Atlas::Objects::Entity::AdminEntityData, Atlas::Objects::Entity::AccountData, Atlas::Objects::Entity::PlayerData, Atlas::Objects::Entity::AdminData, Atlas::Objects::Entity::GameData, Atlas::Objects::Entity::GameEntityData, Atlas::Objects::Operation::GenericData, Atlas::Objects::Operation::ActionData, Atlas::Objects::Operation::CreateData, Atlas::Objects::Operation::CombineData, Atlas::Objects::Operation::DivideData, Atlas::Objects::Operation::CommunicateData, Atlas::Objects::Operation::TalkData, Atlas::Objects::Operation::DeleteData, Atlas::Objects::Operation::SetData, Atlas::Objects::Operation::AffectData, Atlas::Objects::Operation::MoveData, Atlas::Objects::Operation::WieldData, Atlas::Objects::Operation::GetData, Atlas::Objects::Operation::PerceiveData, Atlas::Objects::Operation::LookData, Atlas::Objects::Operation::ListenData, Atlas::Objects::Operation::SniffData, Atlas::Objects::Operation::TouchData, Atlas::Objects::Operation::LoginData, Atlas::Objects::Operation::LogoutData, Atlas::Objects::Operation::ImaginaryData, Atlas::Objects::Operation::UseData, Atlas::Objects::Operation::InfoData, Atlas::Objects::Operation::PerceptionData, Atlas::Objects::Operation::SightData, Atlas::Objects::Operation::AppearanceData, Atlas::Objects::Operation::DisappearanceData, Atlas::Objects::Operation::SoundData, Atlas::Objects::Operation::SmellData, Atlas::Objects::Operation::FeelData, Atlas::Objects::Operation::ErrorData, Atlas::Objects::RootData, Atlas::Objects::Entity::RootEntityData, and Atlas::Objects::Operation::RootOperationData.  

const Atlas::Message::Element Atlas::Objects::BaseObjectData::getAttr (const std::string & name) const throw (NoSuchAttrException)

Retrieve the attribute 'name'.

Throws NoSuchAttrException if it does not exist.

 

Author

Generated automatically by Doxygen for Atlas-C++ from the source code.