Eris  1.3.21
TypeService.h
1 #ifndef ERIS_TYPE_SERVICE_H
2 #define ERIS_TYPE_SERVICE_H
3 
4 #include <Atlas/Objects/ObjectsFwd.h>
5 
6 #include <sigc++/trackable.h>
7 #include <sigc++/signal.h>
8 
9 #include <map>
10 #include <set>
11 #include <string>
12 
13 namespace Eris {
14 
15 class Connection;
16 class TypeInfo;
17 
18 typedef TypeInfo* TypeInfoPtr;
19 typedef std::set<TypeInfoPtr> TypeInfoSet;
20 
24 class TypeService : virtual public sigc::trackable
25 {
26 public:
27  TypeService(Connection *con);
28  virtual ~TypeService();
29 
30  void init();
31 
35  TypeInfoPtr getTypeByName(const std::string &tynm);
36 
39  TypeInfoPtr getTypeForAtlas(const Atlas::Objects::Root &obj);
40 
42  TypeInfoPtr findTypeByName(const std::string &tynm);
43 
45  sigc::signal<void, TypeInfoPtr> BoundType;
46 
48  sigc::signal<void, TypeInfoPtr> BadType;
49 
50  void listUnbound();
51 
52  void handleOperation(const Atlas::Objects::Operation::RootOperation&);
53 
54  protected:
58  void sendRequest(const std::string& id);
59  void recvTypeInfo(const Atlas::Objects::Root &atype);
60  void recvError(const Atlas::Objects::Operation::Get& get);
61 
62  TypeInfoPtr defineBuiltin(const std::string& name, TypeInfoPtr parent);
63 
64  typedef std::map<std::string, TypeInfoPtr> TypeInfoMap;
68  TypeInfoMap m_types;
69 
70  Connection* m_con;
71  bool m_inited;
72 };
73 
74 } // of namespace Eris
75 
76 #endif // of ERIS_TYPE_SERVICE_H