eris 1.4.0
A WorldForge client library.
Eris::View Class Reference

#include <View.h>

Inheritance diagram for Eris::View:
Collaboration diagram for Eris::View:

Public Types

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

Public Member Functions

 View (Avatar &av)
 
ViewEntitygetEntity (const std::string &eid) const
 
AvatargetAvatar () const
 
EntitygetTopLevel () const
 
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 ()
 
void registerFactory (std::unique_ptr< Factory > factory)
 
double getSimulationSpeed () const
 
sigc::connection notifyWhenEntitySeen (const std::string &eid, const EntitySightSlot &slot)
 
void dumpLookQueue ()
 
std::size_t lookQueueSize () const
 
void sendLookAt (const std::string &eid)
 
size_t pruneAbandonedPendingEntities ()
 
ConnectiongetConnection () const
 

Public Attributes

sigc::signal< void, ViewEntity * > EntitySeen
 
sigc::signal< void, ViewEntity * > EntityCreated
 
sigc::signal< void, ViewEntity * > EntityDeleted
 
sigc::signal< void > TopLevelEntityChanged
 emitted when the TLVE changes More...
 
sigc::signal< void, ViewEntity * > InitialSightEntity
 

Protected Member Functions

void appear (const std::string &eid, double stamp)
 
void disappear (const std::string &eid)
 
void sight (const Atlas::Objects::Entity::RootEntity &ge)
 
void deleteEntity (const std::string &eid)
 
void unseen (const std::string &eid)
 
bool isPending (const std::string &eid) const
 test if the specified entity ID is pending initial sight on the View More...
 
void addToPrediction (ViewEntity *ent)
 
void removeFromPrediction (ViewEntity *ent)
 
void taskRateChanged (Task *)
 

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.

Definition at line 40 of file View.h.

Member Typedef Documentation

◆ EntitySightSlot

typedef sigc::slot<void, ViewEntity*> Eris::View::EntitySightSlot

Definition at line 102 of file View.h.

Constructor & Destructor Documentation

◆ View()

Eris::View::View ( Avatar av)
explicit

Definition at line 27 of file View.cpp.

◆ ~View()

Eris::View::~View ( )

Definition at line 34 of file View.cpp.

Member Function Documentation

◆ addToPrediction()

void Eris::View::addToPrediction ( ViewEntity ent)
protected

Definition at line 123 of file View.cpp.

◆ appear()

void Eris::View::appear ( const std::string &  eid,
double  stamp 
)
protected

Definition at line 144 of file View.cpp.

◆ deleteEntity()

void Eris::View::deleteEntity ( const std::string &  eid)
protected

Definition at line 264 of file View.cpp.

◆ disappear()

void Eris::View::disappear ( const std::string &  eid)
protected

Definition at line 171 of file View.cpp.

◆ dumpLookQueue()

void Eris::View::dumpLookQueue ( )

Definition at line 455 of file View.cpp.

◆ getAvatar()

Avatar & Eris::View::getAvatar ( ) const
inline

Definition at line 52 of file View.h.

◆ getConnection()

Connection & Eris::View::getConnection ( ) const

Definition at line 340 of file View.cpp.

◆ getEntity()

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

Retrieve an entity in the view by id. Returns nullptr if no such entity exists in the view.

Definition at line 45 of file View.cpp.

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

◆ getEventService() [1/2]

EventService & Eris::View::getEventService ( )

Gets the EventService used by the view.

Returns
The main EventService instance.

Definition at line 77 of file View.cpp.

◆ getEventService() [2/2]

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

Gets the EventService used by the view.

Returns
The main EventService instance.

Definition at line 81 of file View.cpp.

◆ getSimulationSpeed()

double Eris::View::getSimulationSpeed ( ) const

Definition at line 85 of file View.cpp.

◆ getTopLevel()

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

return the current top-level entity. This will return nullptr until the first emission of the TopLevelEntityChanged signal.

Definition at line 59 of file View.h.

◆ getTypeService() [1/2]

TypeService & Eris::View::getTypeService ( )

Gets the TypeService attached to the view.

Returns
A typeservice instance.

Definition at line 69 of file View.cpp.

◆ getTypeService() [2/2]

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

Gets the TypeService attached to the view.

Returns
A typeservice instance.

Definition at line 73 of file View.cpp.

◆ isPending()

bool Eris::View::isPending ( const std::string &  eid) const
protected

test if the specified entity ID is pending initial sight on the View

Definition at line 336 of file View.cpp.

◆ lookQueueSize()

std::size_t 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)

Definition at line 137 of file View.h.

◆ notifyWhenEntitySeen()

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

Connect 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)

Definition at line 58 of file View.cpp.

◆ pruneAbandonedPendingEntities()

size_t Eris::View::pruneAbandonedPendingEntities ( )

Definition at line 359 of file View.cpp.

◆ registerFactory()

void Eris::View::registerFactory ( std::unique_ptr< Factory factory)

Register an Entity Factory with this view

Definition at line 54 of file View.cpp.

◆ removeFromPrediction()

void Eris::View::removeFromPrediction ( ViewEntity ent)
protected

Definition at line 129 of file View.cpp.

◆ 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.

Definition at line 375 of file View.cpp.

◆ sight()

void Eris::View::sight ( const Atlas::Objects::Entity::RootEntity &  ge)
protected

Definition at line 185 of file View.cpp.

◆ taskRateChanged()

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

Method to register and unregister tasks with with view, so they can have their progress updated automatically by update(). Only certain tasks (those with linear progress) are handled this way, but all tasks are submitted to this method.

Definition at line 134 of file View.cpp.

Referenced by Eris::ViewEntity::onTaskAdded(), and Eris::ViewEntity::task_ProgressRateChanged().

◆ unseen()

void Eris::View::unseen ( const std::string &  eid)
protected

Definition at line 328 of file View.cpp.

◆ 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.

Definition at line 89 of file View.cpp.

Friends And Related Function Documentation

◆ Avatar

friend class Avatar
friend

Definition at line 156 of file View.h.

◆ IGRouter

friend class IGRouter
friend

Definition at line 154 of file View.h.

◆ Task

friend class Task
friend

Definition at line 157 of file View.h.

◆ ViewEntity

friend class ViewEntity
friend

Definition at line 155 of file View.h.

Member Data Documentation

◆ EntityCreated

sigc::signal<void, ViewEntity*> Eris::View::EntityCreated

emitted when a SIGHT(CREATE) op is received for an entity

Definition at line 115 of file View.h.

◆ EntityDeleted

sigc::signal<void, ViewEntity*> Eris::View::EntityDeleted

emitted when a SIGHT(DELETE) op is received for an entity

Definition at line 118 of file View.h.

◆ EntitySeen

sigc::signal<void, ViewEntity*> 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

Definition at line 112 of file View.h.

◆ InitialSightEntity

sigc::signal<void, ViewEntity*> 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.

Definition at line 129 of file View.h.

◆ TopLevelEntityChanged

sigc::signal<void> Eris::View::TopLevelEntityChanged

emitted when the TLVE changes

Definition at line 121 of file View.h.


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