00001 #ifndef ERIS_TYPE_INFO_H
00002 #define ERIS_TYPE_INFO_H
00003
00004 #include <Eris/Types.h>
00005 #include <Eris/typeService.h>
00006
00007 #include <sigc++/object.h>
00008
00009 #include <set>
00010
00011 namespace Atlas { namespace Objects {
00012 class Root;
00013
00014 } }
00015
00016 namespace Eris {
00017
00018
00019 class TypeInfo;
00020 class TypeService;
00021 class Connection;
00022
00023 const int INVALID_TYPEID = -1;
00024
00025 typedef TypeInfo* TypeInfoPtr;
00026 typedef std::set<TypeInfoPtr> TypeInfoSet;
00027
00043 class TypeInfo : virtual public SigC::Object
00044 {
00045 public:
00048 bool isA(TypeInfoPtr ti);
00049
00052 bool safeIsA(TypeInfoPtr ti);
00053
00056 bool isBound();
00057
00058
00060 bool operator==(const TypeInfo &x) const;
00061
00063 bool operator<(const TypeInfo &x) const;
00064
00065
00067 const std::string& getName() const;
00068 const TypeInfoSet & getChildren() const {
00069 return _children;
00070 }
00071
00073 int getTypeId() const
00074 { return _typeid; }
00075
00078 SigC::Signal0<void> & getBoundSignal();
00079
00081 StringSet getParentsAsSet();
00082
00083 protected:
00084 friend class TypeService;
00085
00087 TypeInfo(const std::string &id, TypeService*);
00088
00090 TypeInfo(const Atlas::Objects::Root &atype, TypeService*);
00091
00092 void addParent(TypeInfoPtr tp);
00093 void addChild(TypeInfoPtr tp);
00094
00096 void addAncestor(TypeInfoPtr tp);
00097
00099 void processTypeData(const Atlas::Objects::Root &atype);
00100
00101 void validateBind();
00102 void setupDepends();
00103
00104
00105
00106
00108 TypeInfoSet _parents;
00110 TypeInfoSet _children;
00111
00113 TypeInfoSet _ancestors;
00114
00115 bool _bound;
00116 const std::string _name;
00117 int _typeid;
00118
00123 SigC::Signal0<void> Bound;
00124
00125 TypeService* _engine;
00126 };
00127
00129
00130
00133
00134
00135 }
00136
00137 #endif