Dev Essential  1.6.3
Loading...
Searching...
No Matches
rpc_object_registry.h
Go to the documentation of this file.
1
14
15#ifndef PKG_RPC_OBJECTSERVER_REGISTRY_H_INCLUDED
16#define PKG_RPC_OBJECTSERVER_REGISTRY_H_INCLUDED
17
20#include <rpc/rpc_server.h>
21
22#include <map>
23
24namespace rpc {
25
30public: // types
32 typedef std::pair<std::unique_ptr<a_util::concurrency::shared_mutex>, IRPCObject*> tRPCItem;
33
34public:
38 virtual a_util::result::Result RegisterRPCObject(const char* strName, IRPCObject* pObject);
39
43 virtual a_util::result::Result UnregisterRPCObject(const char* strName);
44
48 class cLockedRPCObject final {
49 typedef std::pair<a_util::concurrency::shared_mutex*, IRPCObject*> tRPCRawItem;
50 tRPCRawItem m_oItem;
51
52 public:
54 cLockedRPCObject() = default;
87 operator bool() const;
88 };
89
95 virtual cLockedRPCObject GetRPCObject(const char* strName) const;
96
97private:
98 mutable a_util::concurrency::shared_mutex m_oObjectsLock;
99 typedef std::map<std::string, tRPCItem> tRPCObjects;
100 tRPCObjects m_oRPCObjects;
101};
102
103} // namespace rpc
104
105#endif // PKG_RPC_OBJECTSERVER_REGISTRY_H_INCLUDED
Definition shared_mutex.h:26
Definition result_type_decl.h:34
Definition rpc_server.h:47
Definition rpc_server.h:64
Definition rpc_object_registry.h:48
cLockedRPCObject(const cLockedRPCObject &other)
cLockedRPCObject(cLockedRPCObject &&)=default
Default move construction.
cLockedRPCObject & operator=(cLockedRPCObject &&)=default
Default move assignment.
cLockedRPCObject & operator=(const cLockedRPCObject &other)
Definition rpc_object_registry.h:29
std::pair< std::unique_ptr< a_util::concurrency::shared_mutex >, IRPCObject * > tRPCItem
Type granting thread safe access to an object of type rpc::IRPCObject.
Definition rpc_object_registry.h:32
virtual a_util::result::Result RegisterRPCObject(const char *strName, IRPCObject *pObject)
virtual a_util::result::Result UnregisterRPCObject(const char *strName)
virtual cLockedRPCObject GetRPCObject(const char *strName) const
definition of the rpc namespace
Definition json_rpc_impl.h:20