00001 #ifndef ERIS_TYPE_SERVICE_H
00002 #define ERIS_TYPE_SERVICE_H
00003
00004 #include <sigc++/trackable.h>
00005 #include <sigc++/signal.h>
00006
00007 #include <Eris/Types.h>
00008 #include <Atlas/Objects/ObjectsFwd.h>
00009
00010 #include <map>
00011 #include <set>
00012
00013 namespace Eris {
00014
00015 class Connection;
00016 class TypeInfo;
00017
00018 typedef TypeInfo* TypeInfoPtr;
00019 typedef std::set<TypeInfoPtr> TypeInfoSet;
00020
00024 class TypeService : virtual public sigc::trackable
00025 {
00026 public:
00027 TypeService(Connection *con);
00028 virtual ~TypeService();
00029
00030 void init();
00031
00035 TypeInfoPtr getTypeByName(const std::string &tynm);
00036
00039 TypeInfoPtr getTypeForAtlas(const Atlas::Objects::Root &obj);
00040
00042 TypeInfoPtr findTypeByName(const std::string &tynm);
00043
00045 sigc::signal<void, TypeInfoPtr> BoundType;
00046
00048 sigc::signal<void, TypeInfoPtr> BadType;
00049
00050 void listUnbound();
00051
00052 void handleOperation(const Atlas::Objects::Operation::RootOperation&);
00053
00054 private:
00058 void sendRequest(const std::string& id);
00059 void recvTypeInfo(const Atlas::Objects::Root &atype);
00060 void recvError(const Atlas::Objects::Operation::Get& get);
00061
00062 TypeInfoPtr defineBuiltin(const std::string& name, TypeInfoPtr parent);
00063
00064 typedef std::map<std::string, TypeInfoPtr> TypeInfoMap;
00068 TypeInfoMap m_types;
00069
00070 Connection* m_con;
00071 bool m_inited;
00072 };
00073
00074 }
00075
00076 #endif // of ERIS_TYPE_SERVICE_H