eris  1.4.0
A WorldForge client library.
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 <unordered_map>
10 #include <set>
11 #include <string>
12 #include <memory>
13 
14 namespace Eris {
15 
16 class Connection;
17 class TypeInfo;
18 
19 
23 class TypeService : virtual public sigc::trackable
24 {
25 public:
26  explicit TypeService(Connection &con);
27  virtual ~TypeService();
28 
29  void init();
30 
34  TypeInfo* getTypeByName(const std::string &tynm);
35 
38  TypeInfo* getTypeForAtlas(const Atlas::Objects::Root &obj);
39 
41  TypeInfo* findTypeByName(const std::string &tynm);
42 
44  sigc::signal<void, TypeInfo*> BoundType;
45 
47  sigc::signal<void, TypeInfo*> BadType;
48 
49  void handleOperation(const Atlas::Objects::Operation::RootOperation&);
50 
54  void sendRequest(const std::string& id);
55 
64  void setTypeProviderId(std::string id);
65 
66 protected:
67 
68  void recvTypeInfo(const Atlas::Objects::Root &atype);
69  void recvError(const Atlas::Objects::Operation::Get& get);
70  void recvTypeUpdate(const Atlas::Objects::Root &atype);
71 
72  TypeInfo* defineBuiltin(const std::string& name, TypeInfo* parent);
73 
77  std::unordered_map<std::string, std::unique_ptr<TypeInfo>> m_types;
78 
79  Connection& m_con;
80  bool m_inited;
81 
85  std::string m_type_provider_id;
86 };
87 
88 } // of namespace Eris
89 
90 #endif // of ERIS_TYPE_SERVICE_H
Eris::TypeService::getTypeForAtlas
TypeInfo * getTypeForAtlas(const Atlas::Objects::Root &obj)
Definition: TypeService.cpp:77
Eris::TypeService::BadType
sigc::signal< void, TypeInfo * > BadType
Definition: TypeService.h:47
Eris::TypeService::sendRequest
void sendRequest(const std::string &id)
Definition: TypeService.cpp:155
Eris::TypeService::BoundType
sigc::signal< void, TypeInfo * > BoundType
Definition: TypeService.h:44
Eris::TypeService::m_types
std::unordered_map< std::string, std::unique_ptr< TypeInfo > > m_types
Definition: TypeService.h:77
Eris::TypeService
Definition: TypeService.h:24
Eris::TypeService::getTypeByName
TypeInfo * getTypeByName(const std::string &tynm)
Definition: TypeService.cpp:61
Eris
Definition: Account.cpp:33
Eris::TypeInfo
The representation of an Atlas type (i.e a class or operation definition). This class supports effice...
Definition: TypeInfo.h:33
Eris::TypeService::findTypeByName
TypeInfo * findTypeByName(const std::string &tynm)
Definition: TypeService.cpp:51
Eris::TypeService::setTypeProviderId
void setTypeProviderId(std::string id)
Set another provider of type data than the connection.
Definition: TypeService.cpp:213
Eris::Connection
Definition: Connection.h:45
Eris::TypeService::m_type_provider_id
std::string m_type_provider_id
Definition: TypeService.h:85