Eris  1.3.21
EntityRef.h
1 #ifndef ERIS_ENTITY_REF_H
2 #define ERIS_ENTITY_REF_H
3 
4 #include <sigc++/trackable.h>
5 #include <sigc++/signal.h>
6 #include <string>
7 
8 namespace Eris
9 {
10 
11 class Entity;
12 class View;
13 
14 class EntityRef : public sigc::trackable
15 {
16 public:
17  EntityRef() : m_inner(NULL)
18  {
19  }
20 
21  EntityRef(View* v, const std::string& eid);
22 
23  EntityRef(Entity*);
24 
25  ~EntityRef()
26  {
27  }
28 
29  EntityRef(const EntityRef& ref);
30 
31  EntityRef& operator=(const EntityRef& ref);
32 
33  const Entity& operator*() const
34  {
35  return *m_inner;
36  }
37 
38  Entity& operator*()
39  {
40  return *m_inner;
41  }
42 
43  const Entity* operator->() const
44  {
45  return m_inner;
46  }
47 
48  Entity* operator->()
49  {
50  return m_inner;
51  }
52 
53  Entity* get() const
54  {
55  return m_inner;
56  }
57 
58  operator bool() const
59  {
60  return (m_inner != NULL);
61  }
62 
63  bool operator!() const
64  {
65  return (m_inner == NULL);
66  }
67 
68  bool operator==(const EntityRef& e) const
69  {
70  return (m_inner == e.m_inner);
71  }
72 
73  bool operator==(const Entity* e) const
74  {
75  return (m_inner == e);
76  }
77 
78  bool operator<(const EntityRef& e) const
79  {
80  return (m_inner < e.m_inner);
81  }
82 
83  sigc::signal0<void> Changed;
84 private:
85  void onEntityDeleted();
86  void onEntitySeen(Entity* e);
87 
88  Entity* m_inner;
89 };
90 
91 } // of namespace Eris
92 
93 #endif // of ERIS_ENTITY_REF_H
Definition: EntityRef.h:14
View encapsulates the set of entities currently visible to an Avatar, as well as those that have rece...
Definition: View.h:33
Definition: Account.cpp:35
Entity is a concrete (instantiable) class representing one game entity.
Definition: Entity.h:57