Eris  1.4.0
Classes | Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
Eris::View Class Reference

View encapsulates the set of entities currently visible to an Avatar, as well as those that have recently been seen. More...

#include <View.h>

Inheritance diagram for Eris::View:

Public Types

typedef sigc::slot< void, Entity * > EntitySightSlot
 

Public Member Functions

 View (Avatar *av)
 
EntitygetEntity (const std::string &eid) const
 Retrieve an entity in the view by id. More...
 
AvatargetAvatar () const
 
EntitygetTopLevel () const
 return the current top-level entity. More...
 
TypeServicegetTypeService ()
 Gets the TypeService attached to the view. More...
 
TypeServicegetTypeService () const
 Gets the TypeService attached to the view. More...
 
EventServicegetEventService ()
 Gets the EventService used by the view. More...
 
EventServicegetEventService () const
 Gets the EventService used by the view. More...
 
void update ()
 once-per-frame update of the View - clients should call this method once per game loop (or similar), to allow the View to update Entity state. More...
 
void registerFactory (Factory *)
 Register an Entity Factory with this view.
 
sigc::connection notifyWhenEntitySeen (const std::string &eid, const EntitySightSlot &slot)
 Conenct up a slot to be fired when an Entity with the specified ID is seen. More...
 
void dumpLookQueue ()
 
unsigned int lookQueueSize () const
 Retrieve the current look queue size, for debugging / statistics purposes. More...
 
void sendLookAt (const std::string &eid)
 Issue a LOOK operation for the specified entity ID. More...
 

Public Attributes

sigc::signal< void, Entity * > EntitySeen
 emitted whenever the View creates a new Entity instance. More...
 
sigc::signal< void, Entity * > EntityCreated
 emitted when a SIGHT(CREATE) op is received for an entity
 
sigc::signal< void, Entity * > EntityDeleted
 emitted when a SIGHT(DELETE) op is received for an entity
 
sigc::signal< void > AvatarEntityDeleted
 emitted AFTER the avatar entity was deleted due to a SIGHT(DELETE) op is received
 
sigc::signal< void, Entity * > Appearance
 
sigc::signal< void, Entity * > Disappearance
 
sigc::signal< void > TopLevelEntityChanged
 emitted when the TLVE changes
 
sigc::signal< void, Entity * > InitialSightEntity
 Emitted after a new Entity has been created and initialized. More...
 

Protected Member Functions

void appear (const std::string &eid, float stamp)
 
void disappear (const std::string &eid)
 
void sight (const Atlas::Objects::Entity::RootEntity &ge)
 
void create (const Atlas::Objects::Entity::RootEntity &ge)
 
void deleteEntity (const std::string &eid)
 
void unseen (const std::string &eid)
 
void setEntityVisible (Entity *ent, bool vis)
 
bool isPending (const std::string &eid) const
 test if the specified entity ID is pending initial sight on the View
 
void addToPrediction (Entity *ent)
 
void removeFromPrediction (Entity *ent)
 
void entityDeleted (Entity *ent)
 this is a hook that Entity's destructor calls to remove itself from the View's content map. More...
 
void taskRateChanged (Task *)
 Method to register and unregister tasks with with view, so they can have their progress updated automatically by update(). More...
 

Friends

class IGRouter
 
class ViewEntity
 
class Avatar
 
class Task
 

Detailed Description

View encapsulates the set of entities currently visible to an Avatar, as well as those that have recently been seen.

It receives visibility-affecting ops from the IGRouter, and uses them to update its state and emit signals.

Member Function Documentation

◆ entityDeleted()

void Eris::View::entityDeleted ( Entity ent)
protected

this is a hook that Entity's destructor calls to remove itself from the View's content map.

The name is unfortantely similar to the public 'EntityDeleted' signal - alternative naming suggestions appreciated.

References Eris::Entity::getId().

Referenced by lookQueueSize(), and Eris::ViewEntity::shutdown().

◆ getEntity()

Entity * Eris::View::getEntity ( const std::string &  eid) const

Retrieve an entity in the view by id.

Returns NULL if no such entity exists in the view.

Referenced by Eris::ViewEntity::getEntity().

◆ getEventService() [1/2]

EventService & Eris::View::getEventService ( )

Gets the EventService used by the view.

Returns
The main EventService instance.

Referenced by getTopLevel().

◆ getEventService() [2/2]

EventService & Eris::View::getEventService ( ) const

Gets the EventService used by the view.

Returns
The main EventService instance.

◆ getTopLevel()

Entity* Eris::View::getTopLevel ( ) const
inline

return the current top-level entity.

This will return NULL until the first emission of the TopLevelEntityChanged signal.

References getEventService(), getTypeService(), notifyWhenEntitySeen(), registerFactory(), and update().

◆ getTypeService() [1/2]

TypeService & Eris::View::getTypeService ( )

Gets the TypeService attached to the view.

Returns
A typeservice instance.

Referenced by getTopLevel().

◆ getTypeService() [2/2]

TypeService & Eris::View::getTypeService ( ) const

Gets the TypeService attached to the view.

Returns
A typeservice instance.

◆ lookQueueSize()

unsigned int Eris::View::lookQueueSize ( ) const
inline

Retrieve the current look queue size, for debugging / statistics purposes.

Eg, this could be displayed as a bar-chart on screen in a client (optionally)

References entityDeleted(), isPending(), Eris::Factory::priority(), sendLookAt(), and taskRateChanged().

◆ notifyWhenEntitySeen()

sigc::connection Eris::View::notifyWhenEntitySeen ( const std::string &  eid,
const EntitySightSlot &  slot 
)

Conenct up a slot to be fired when an Entity with the specified ID is seen.

If the entity is already visible, this is a no-op (and will log an error)

Referenced by getTopLevel().

◆ sendLookAt()

void Eris::View::sendLookAt ( const std::string &  eid)

Issue a LOOK operation for the specified entity ID.

The id may be empty for an anonymous look. The pending sight map will be updated with the appropriate information.

References Eris::Entity::getLocation().

Referenced by lookQueueSize().

◆ taskRateChanged()

void Eris::View::taskRateChanged ( Task t)
protected

◆ update()

void Eris::View::update ( )

once-per-frame update of the View - clients should call this method once per game loop (or similar), to allow the View to update Entity state.

This includes motion prediction for moving entities, and confidence levels for disappeared entities.

References Eris::Entity::isMoving().

Referenced by getTopLevel().

Member Data Documentation

◆ EntitySeen

sigc::signal<void, Entity*> Eris::View::EntitySeen

emitted whenever the View creates a new Entity instance.

This signal is emitted once the entity has been fully bound into the View

◆ InitialSightEntity

sigc::signal<void, Entity*> Eris::View::InitialSightEntity

Emitted after a new Entity has been created and initialized.

This signal is mainly meant for debugging or authoring; normal entity presentation logic should use EntitySeen or EntityCreated instead.


The documentation for this class was generated from the following files: