6 #include "ViewEntity.h"
7 #include <Atlas/Objects/ObjectsFwd.h>
8 #include <wfmath/timestamp.h>
11 #include <sigc++/trackable.h>
12 #include <sigc++/signal.h>
13 #include <sigc++/slot.h>
14 #include <sigc++/connection.h>
21 #include <unordered_map>
22 #include <Atlas/Message/Element.h>
40 class View :
public sigc::trackable
100 double getSimulationSpeed()
const;
102 typedef sigc::slot<void, ViewEntity*> EntitySightSlot;
131 void dumpLookQueue();
139 return m_lookQueue.size();
149 size_t pruneAbandonedPendingEntities();
159 void appear(
const std::string& eid,
double stamp);
160 void disappear(
const std::string& eid);
161 void sight(
const Atlas::Objects::Entity::RootEntity& ge);
162 void deleteEntity(
const std::string& eid);
163 void unseen(
const std::string& eid);
166 bool isPending(
const std::string& eid)
const;
179 ViewEntity* initialSight(
const Atlas::Objects::Entity::RootEntity& ge);
181 void getEntityFromServer(
const std::string& eid);
184 void setTopLevelEntity(
Entity* newTopLevel);
186 std::unique_ptr<ViewEntity> createEntity(
const Atlas::Objects::Entity::RootEntity&);
188 void parseSimulationSpeed(
const Atlas::Message::Element& element);
194 void issueQueuedLook();
196 void eraseFromLookQueue(
const std::string& eid);
198 typedef std::unordered_map<std::string, std::unique_ptr<ViewEntity>> IdEntityMap;
203 std::unique_ptr<ViewEntity> entity;
204 std::unique_ptr<EntityRouter> entityRouter;
206 std::unordered_map<std::string, EntityEntry> m_contents;
208 WFMath::TimeStamp m_lastUpdateTime;
213 double m_simulationSpeed;
218 enum class SightAction
227 struct PendingStatus {
228 SightAction sightAction;
229 std::chrono::steady_clock::time_point registrationTime = std::chrono::steady_clock::now();
232 std::map<std::string, PendingStatus> m_pending;
241 std::deque<std::string> m_lookQueue;
243 sigc::connection m_simulationSpeedConnection;
245 unsigned int m_maxPendingCount;
247 typedef sigc::signal<void, ViewEntity*> EntitySightSignal;
249 typedef std::unordered_map<std::string, EntitySightSignal> NotifySightMap;
250 NotifySightMap m_notifySights;
252 typedef std::set<ViewEntity*> EntitySet;
258 struct FactoryOrdering
260 bool operator()(
const std::unique_ptr<Factory>& a,
const std::unique_ptr<Factory>& b)
const
262 return a->priority() > b->priority();
266 typedef std::multiset<std::unique_ptr<Factory>, FactoryOrdering> FactoryStore;
267 FactoryStore m_factories;
269 std::set<Task*> m_progressingTasks;
Entity is a concrete (instantiable) class representing one game entity.
Handles polling of the IO system as well as making sure that registered handlers are run on the main ...
An entity which is bound to an Eris::View. This subclass of Eris::Entity is intimately bound to a Vie...
void registerFactory(std::unique_ptr< Factory > factory)
sigc::signal< void, ViewEntity * > InitialSightEntity
EventService & getEventService()
Gets the EventService used by the view.
Entity * getTopLevel() const
sigc::signal< void, ViewEntity * > EntityCreated
std::size_t lookQueueSize() const
sigc::signal< void, ViewEntity * > EntityDeleted
ViewEntity * getEntity(const std::string &eid) const
void sendLookAt(const std::string &eid)
sigc::connection notifyWhenEntitySeen(const std::string &eid, const EntitySightSlot &slot)
bool isPending(const std::string &eid) const
test if the specified entity ID is pending initial sight on the View
void taskRateChanged(Task *)
sigc::signal< void > TopLevelEntityChanged
emitted when the TLVE changes
TypeService & getTypeService()
Gets the TypeService attached to the view.
sigc::signal< void, ViewEntity * > EntitySeen