pvAccessCPP  7.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
rpcServer.h
1 
7 #ifndef RPCSERVER_H
8 #define RPCSERVER_H
9 
10 #ifdef epicsExportSharedSymbols
11 # define rpcServerEpicsExportSharedSymbols
12 # undef epicsExportSharedSymbols
13 #endif
14 
15 #include <pv/sharedPtr.h>
16 
17 #ifdef rpcServerEpicsExportSharedSymbols
18 # define epicsExportSharedSymbols
19 # undef rpcServerEpicsExportSharedSymbols
20 #endif
21 
22 #include <pv/pvAccess.h>
23 #include <pv/rpcService.h>
24 #include <pv/serverContext.h>
25 
26 #include <shareLib.h>
27 
28 namespace epics {
29 namespace pvAccess {
30 
31 class ServerContext;
32 class RPCChannelProvider;
33 
35 class epicsShareClass RPCServer :
36  public std::tr1::enable_shared_from_this<RPCServer>
37 {
38 private:
39 
40  std::tr1::shared_ptr<ServerContext> m_serverContext;
41  std::tr1::shared_ptr<RPCChannelProvider> m_channelProviderImpl;
42 
43 public:
44  POINTER_DEFINITIONS(RPCServer);
45 
46  explicit RPCServer(const Configuration::const_shared_pointer& conf = Configuration::const_shared_pointer());
47 
48  virtual ~RPCServer();
49 
50  void registerService(std::string const & serviceName, RPCServiceAsync::shared_pointer const & service);
51 
52  void unregisterService(std::string const & serviceName);
53 
54  void run(int seconds = 0);
55 
58  void runInNewThread(int seconds = 0);
59 
60  void destroy();
61 
65  void printInfo();
66 
67  const std::tr1::shared_ptr<ServerContext>& getServer() const { return m_serverContext; }
68 };
69 
70 epicsShareFunc Channel::shared_pointer createRPCChannel(ChannelProvider::shared_pointer const & provider,
71  std::string const & channelName,
72  ChannelRequester::shared_pointer const & channelRequester,
73  RPCServiceAsync::shared_pointer const & rpcService);
74 
75 }
76 }
77 
78 #endif /* RPCSERVER_H */
duration< int64_t > seconds
Serves (only) RPCServiceAsync and RPCService instances.
Definition: rpcServer.h:35