typeService.h
00001 #ifndef ERIS_TYPE_SERVICE_H
00002 #define ERIS_TYPE_SERVICE_H
00003
00004 #include <sigc++/object.h>
00005 #include <sigc++/signal.h>
00006
00007 #include <map>
00008 #include <set>
00009
00010
00011 namespace Atlas {
00012 namespace Message { class Element; }
00013 namespace Objects {
00014 class Root;
00015 namespace Operation {
00016 class Get;
00017 class Error;
00018 }
00019 }
00020 }
00021
00022 namespace Eris {
00023
00024 class Connection;
00025 class TypeInfo;
00026
00027 typedef TypeInfo* TypeInfoPtr;
00028 typedef std::set<TypeInfoPtr> TypeInfoSet;
00029
00030 class TypeService : virtual public SigC::Object
00031 {
00032 public:
00033 TypeService(Connection *conn);
00034
00035 void init();
00036
00038 void readAtlasSpec(const std::string &specfile);
00042 TypeInfoPtr getTypeByName(const std::string &tynm);
00043
00046 TypeInfoPtr getTypeForAtlas(const Atlas::Message::Element &msg);
00047 TypeInfoPtr getTypeForAtlas(const Atlas::Objects::Root &obj);
00048
00050 TypeInfoPtr findTypeByName(const std::string &tynm);
00051
00053 SigC::Signal1<void, TypeInfoPtr> BoundType;
00054
00055 void listUnbound();
00056
00057 protected:
00058
00059 friend class TypeInfo;
00060
00061 TypeInfoSet extractDependantsForType(TypeInfoPtr ty);
00062
00063 void markTypeDependantOnType(TypeInfoPtr dep, TypeInfoPtr ancestor);
00064
00065 private:
00066
00067 void sendInfoRequest(const std::string &id);
00068 void recvInfoOp(const Atlas::Objects::Root &atype);
00069
00070 void recvTypeError(const Atlas::Objects::Operation::Error &error,
00071 const Atlas::Objects::Operation::Get &get);
00072
00074 void registerLocalType(const Atlas::Objects::Root &def);
00075
00076 typedef std::map<std::string, TypeInfoPtr> TypeInfoMap;
00080 TypeInfoMap globalTypeMap;
00081
00082 typedef std::map<TypeInfoPtr, TypeInfoSet> TypeDepMap;
00083
00088 TypeDepMap _dependancyMap;
00089
00090 Connection* _conn;
00091 bool _inited;
00092 };
00093
00094 }
00095
00096 #endif // of ERIS_TYPE_SERVICE_H
Generated on Thu Jul 29 08:12:34 2004 for Eris by
1.3.7