Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

Eris::Entity Class Reference

Entity encapsulates the state and tracking of one game entity; this includes it's location in the containership tree (graph?), it's name and unique and id, and so on. More...

#include <Entity.h>

Inheritance diagram for Eris::Entity:

List of all members.

Public Member Functions

 Entity (const Atlas::Objects::Entity::GameEntity &ge, World *world)
EntitygetContainer () const
unsigned int getNumMembers () const
bool hasBBox () const
EntitygetMember (unsigned int index)
virtual const Atlas::Message::Element & getProperty (const std::string &p)
 access a property; thows UnknownProperty if not found

virtual bool hasProperty (const std::string &p) const
 test whether the named property exists on this entity

virtual WFMath::Point< 3 > getPosition () const
virtual WFMath::Vector< 3 > getVelocity () const
virtual WFMath::Quaternion getOrientation () const
 retrieve the orientation as a quaternion

virtual WFMath::AxisBox< 3 > getBBox () const
const std::string & getID () const
 retrieve the unique entity ID

const std::string & getName () const
float getStamp () const
 access the current time-stamp of the entity

StringSet getInherits () const
 Get a set of the parent objects of the entity.

TypeInfogetType () const
WorldgetWorld () const
bool isVisible () const
 Query the visiblity of this entity; this is controlled by Appearance/Disappearance ops from the server.

template<class C> C toParentCoords (const C &c) const
template<class C> C fromParentCoords (const C &c) const
WFMath::Vector< 3 > toParentCoords (const WFMath::Vector< 3 > &v) const
WFMath::Vector< 3 > fromParentCoords (const WFMath::Vector< 3 > &v) const
template<class T> void connectOpToSlot (const std::string &op, const SigC::Slot1< void, const T & > &slot)
 Emitted when this entity originates the specified class of operation; note the derived operations will also invoke the signal.

template<class T> void connectOpFromSlot (const std::string &op, SigC::Slot1< void, const T & > &slot)
 Emitted when this entity receives a specified class of operations; again derived operations will also trigger the signal to be invoked.

void observeProperty (const std::string &nm, const SigC::Slot1< void, const Atlas::Message::Element & > slot)

Public Attributes

SigC::Signal1< void, Entity * > AddedMember
SigC::Signal1< void, Entity * > RemovedMember
SigC::Signal2< void, Entity *,
Entity * > 
Recontainered
 Emitted when the entity's container changes; note if the entity has just been created, or is being deleted, then one of the arguments may be NULL (but not both).

SigC::Signal1< void, const
StringSet & > 
Changed
 Emitted when a macro change occurs.

SigC::Signal1< void, const
WFMath::Point< 3 > & > 
Moved
 Emitted when then entity's position or orientation have changed; i.e the displayed model/sprite/etc needs to be updated.

SigC::Signal1< void, const
std::string & > 
Say
 Emitted with this entity speaks.


Protected Member Functions

 Entity (const std::string &id, World *world)
 constructor for use by derived classes only!

virtual void handleMove ()
virtual void handleTalk (const std::string &msg)
virtual void setProperty (const std::string &p, const Atlas::Message::Element &v)
 set the property value; this protected so only Entity / World may use it

virtual void setPosition (const WFMath::Point< 3 > &pt)
virtual void setContainer (Entity *pr)
 update the container of this entity (may be NULL)

virtual void setContents (const Atlas::Message::Element::ListType &contents)
virtual void addMember (Entity *e)
 add a contained entity to this object (sets container)

virtual void rmvMember (Entity *e)
 remove a contained entity; throws InvalidOperation if not found.

virtual void setVisible (bool vis)
 called by World in response to Appearance/Disappearance messages : note that after a disappearance (vis = false), the server will not send any futher messages to the entity.

void setContainerById (const std::string &id)
void beginUpdate ()
void endUpdate ()

Protected Attributes

const std::string _id
 the Atlas object ID

std::string _name
 a human readable name

float _stamp
 last modification time (in seconds)

std::string _description
StringSet _parents
bool _visible
Entity_container
 The container entity, NULL for the root-entity, or if un-parented.

EntityArray _members
WFMath::AxisBox< 3 > _bbox
WFMath::Point< 3 > _position
WFMath::Vector< 3 > _velocity
WFMath::Quaternion _orientation
PropertyMap _properties
bool _inUpdate
 This flag is set if a property update is in progress.

bool _hasBBox
 This flag should be set when the server notifies that this entity has a bounding box.

StringSet _modified
 When a batched property update is in progress, the set tracks the names of each modified property.


Detailed Description

Entity encapsulates the state and tracking of one game entity; this includes it's location in the containership tree (graph?), it's name and unique and id, and so on.

This class may be sub-classed by users (and those sub-classes built via a Factory), to allow specific functionality. This means there are two integration strategies; either subclassing and over-riding virtual functions, or creating peer clases and attaching them to the signals.


Member Function Documentation

void Eris::Entity::rmvMember Entity e  )  [protected, virtual]
 

remove a contained entity; throws InvalidOperation if not found.

Note that the container of e is not<i/> reset

void Eris::Entity::setVisible bool  vis  )  [protected, virtual]
 

called by World in response to Appearance/Disappearance messages : note that after a disappearance (vis = false), the server will not send any futher messages to the entity.

At some point, invisible entities get flushed by Eris using an LRU scheme.


Member Data Documentation

bool Eris::Entity::_hasBBox [protected]
 

This flag should be set when the server notifies that this entity has a bounding box.

If this flag is not true, the contents of the BBox attribute are undefined.

bool Eris::Entity::_inUpdate [protected]
 

This flag is set if a property update is in progress.

This supresses emission of the Changed signal until endUpdate is called, so that a number of attributes may be updated en-masse, generating just one signal.

StringSet Eris::Entity::_modified [protected]
 

When a batched property update is in progress, the set tracks the names of each modified property.

This set is passed as a parameter of the Changed callback when endUpdate is called, to allow clients to determine what was changed.

SigC::Signal1<void, const WFMath::Point<3>&> Eris::Entity::Moved
 

Emitted when then entity's position or orientation have changed; i.e the displayed model/sprite/etc needs to be updated.

The argument is the new position

SigC::Signal1<void, const std::string&> Eris::Entity::Say
 

Emitted with this entity speaks.

In the future langauge may be specified


The documentation for this class was generated from the following files:
Generated on Thu Jul 29 08:12:34 2004 for Eris by doxygen 1.3.7