EntityRef.h

00001 #ifndef ERIS_ENTITY_REF_H
00002 #define ERIS_ENTITY_REF_H
00003 
00004 #include <sigc++/trackable.h>
00005 #include <sigc++/signal.h>
00006 
00007 namespace Eris
00008 {
00009 
00010 class Entity;
00011 class View;
00012 
00013 class EntityRef : public sigc::trackable
00014 {
00015 public:
00016         EntityRef() : m_inner(NULL)
00017         {
00018         }
00019 
00020         EntityRef(View* v, const std::string& eid);
00021         
00022     EntityRef(Entity*);
00023     
00024         ~EntityRef()
00025         {
00026         }
00027         
00028         EntityRef(const EntityRef& ref);
00029         
00030         EntityRef& operator=(const EntityRef& ref);
00031     
00032         const Entity& operator*() const
00033         {
00034                 return *m_inner;
00035         }
00036 
00037         Entity& operator*()
00038         {
00039                 return *m_inner;
00040         }
00041 
00042         const Entity* operator->() const
00043         {
00044                 return m_inner;
00045         }
00046 
00047         Entity* operator->()
00048         {
00049                 return m_inner;
00050         }
00051 
00052         Entity* get() const
00053         {
00054                 return m_inner;
00055         }
00056     
00057     operator bool() const
00058         {
00059                 return (m_inner != NULL);
00060         }
00061         
00062         bool operator!() const
00063         {
00064                 return (m_inner == NULL);
00065         }
00066 
00067         sigc::signal0<void> Changed;
00068 private:
00069         void onEntityDeleted();
00070         void onEntitySeen(Entity* e);
00071         
00072         Entity* m_inner;
00073 };
00074 
00075 } // of namespace Eris
00076 
00077 #endif // of ERIS_ENTITY_REF_H

Generated on Tue Feb 7 13:20:24 2006 for Eris by  doxygen 1.4.6