6 #include <Atlas/Objects/ObjectsFwd.h> 7 #include <wfmath/timestamp.h> 10 #include <sigc++/trackable.h> 11 #include <sigc++/signal.h> 12 #include <sigc++/slot.h> 13 #include <sigc++/connection.h> 20 #include <unordered_map> 37 class View :
public sigc::trackable
97 typedef sigc::slot<void, Entity*> EntitySightSlot;
118 sigc::signal<void, Entity*> Appearance;
119 sigc::signal<void, Entity*> Disappearance;
132 void dumpLookQueue();
140 return m_lookQueue.size();
157 void appear(
const std::string& eid,
float stamp);
158 void disappear(
const std::string& eid);
159 void sight(
const Atlas::Objects::Entity::RootEntity& ge);
160 void create(
const Atlas::Objects::Entity::RootEntity& ge);
161 void deleteEntity(
const std::string& eid);
162 void unseen(
const std::string& eid);
164 void setEntityVisible(
Entity* ent,
bool vis);
167 bool isPending(
const std::string& eid)
const;
169 void addToPrediction(
Entity* ent);
170 void removeFromPrediction(
Entity* ent);
185 Entity* initialSight(
const Atlas::Objects::Entity::RootEntity& ge);
188 void getEntityFromServer(
const std::string& eid);
191 void setTopLevelEntity(
Entity* newTopLevel);
193 Entity* createEntity(
const Atlas::Objects::Entity::RootEntity&);
199 void issueQueuedLook();
201 void eraseFromLookQueue(
const std::string& eid);
203 typedef std::unordered_map<std::string, Entity*> IdEntityMap;
206 IdEntityMap m_contents;
208 WFMath::TimeStamp m_lastUpdateTime;
222 typedef std::unordered_map<std::string, SightAction> PendingSightMap;
223 PendingSightMap m_pending;
232 std::deque<std::string> m_lookQueue;
234 unsigned int m_maxPendingCount;
236 typedef sigc::signal<void, Entity*> EntitySightSignal;
238 typedef std::unordered_map<std::string, EntitySightSignal> NotifySightMap;
239 NotifySightMap m_notifySights;
241 typedef std::set<Entity*> EntitySet;
247 class FactoryOrdering
256 typedef std::multiset<Factory*, FactoryOrdering> FactoryStore;
257 FactoryStore m_factories;
259 std::set<Task*> m_progressingTasks;
264 #endif // of ERIS_VIEW_H void registerFactory(Factory *)
Register an Entity Factory with this view.
Definition: View.cpp:71
void entityDeleted(Entity *ent)
this is a hook that Entity's destructor calls to remove itself from the View's content map...
Definition: View.cpp:454
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.
Definition: View.cpp:76
Factory is used to allow custom entity creation by client libraries.
Definition: Factory.h:14
bool isPending(const std::string &eid) const
test if the specified entity ID is pending initial sight on the View
Definition: View.cpp:366
Entity * getTopLevel() const
return the current top-level entity.
Definition: View.h:56
void update()
once-per-frame update of the View - clients should call this method once per game loop (or similar)...
Definition: View.cpp:105
sigc::signal< void, Entity * > EntityCreated
emitted when a SIGHT(CREATE) op is received for an entity
Definition: View.h:110
sigc::signal< void > TopLevelEntityChanged
emitted when the TLVE changes
Definition: View.h:122
View encapsulates the set of entities currently visible to an Avatar, as well as those that have rece...
Definition: View.h:37
Definition: IGRouter.h:13
void taskRateChanged(Task *)
Method to register and unregister tasks with with view, so they can have their progress updated autom...
Definition: View.cpp:139
sigc::signal< void, Entity * > EntityDeleted
emitted when a SIGHT(DELETE) op is received for an entity
Definition: View.h:113
Every Eris class and type lives inside the Eris namespace; certain utility functions live in the Util...
Definition: Account.cpp:34
Underlying Atlas connection, providing a send interface, and receive (dispatch) system.
Definition: Connection.h:36
void sendLookAt(const std::string &eid)
Issue a LOOK operation for the specified entity ID.
Definition: View.cpp:390
Handles polling of the IO system as well as making sure that registered handlers are run on the main ...
Definition: EventService.h:43
An entity which is bound to an Eris::View.
Definition: ViewEntity.h:21
TypeService & getTypeService()
Gets the TypeService attached to the view.
Definition: View.cpp:88
A service class querying and caching types.
Definition: TypeService.h:24
Entity is a concrete (instantiable) class representing one game entity.
Definition: Entity.h:58
unsigned int lookQueueSize() const
Retrieve the current look queue size, for debugging / statistics purposes.
Definition: View.h:138
Entity * getEntity(const std::string &eid) const
Retrieve an entity in the view by id.
Definition: View.cpp:53
The player's avatar representation.
Definition: Avatar.h:34
sigc::signal< void, Entity * > EntitySeen
emitted whenever the View creates a new Entity instance.
Definition: View.h:107
sigc::signal< void > AvatarEntityDeleted
emitted AFTER the avatar entity was deleted due to a SIGHT(DELETE) op is received ...
Definition: View.h:116
EventService & getEventService()
Gets the EventService used by the view.
Definition: View.cpp:96
virtual int priority()
retrieve this factory's priority level; higher priority factories get first chance to process a recei...
Definition: Factory.cpp:11
sigc::signal< void, Entity * > InitialSightEntity
Emitted after a new Entity has been created and initialized.
Definition: View.h:130