pvAccessCPP 7.1.8
Loading...
Searching...
No Matches
rpcService.h
1
7#ifndef RPCSERVICE_H
8#define RPCSERVICE_H
9
10#include <stdexcept>
11
12#ifdef epicsExportSharedSymbols
13# define rpcServiceEpicsExportSharedSymbols
14# undef epicsExportSharedSymbols
15#endif
16
17#include <pv/sharedPtr.h>
18#include <pv/status.h>
19
20#ifdef rpcServiceEpicsExportSharedSymbols
21# define epicsExportSharedSymbols
22# undef rpcServiceEpicsExportSharedSymbols
23#endif
24
25#include <pv/pvAccess.h>
26
27#include <shareLib.h>
28
29namespace epics {
30namespace pvAccess {
31
32class RPCRequestException : public std::runtime_error {
33public:
34
35 explicit RPCRequestException(std::string const & message) :
36 std::runtime_error(message), m_status(epics::pvData::Status::STATUSTYPE_ERROR)
37 {}
38
39 RPCRequestException(epics::pvData::Status::StatusType status, std::string const & message) :
40 std::runtime_error(message), m_status(status)
41 {}
42
43 epics::pvData::Status::StatusType getStatus() const {
44 return m_status;
45 }
46
47 epics::pvData::Status asStatus() const {
48 return epics::pvData::Status(m_status, what());
49 }
50private:
52};
53
54class epicsShareClass RPCResponseCallback
55{
56public:
57 POINTER_DEFINITIONS(RPCResponseCallback);
58
59 virtual ~RPCResponseCallback() {};
60
61 virtual void requestDone(
62 epics::pvData::Status const & status,
63 epics::pvData::PVStructure::shared_pointer const & result
64 ) = 0;
65};
66
67class epicsShareClass RPCServiceAsync
68{
69public:
70 POINTER_DEFINITIONS(RPCServiceAsync);
71
72 virtual ~RPCServiceAsync() {};
73
74 virtual void request(
75 epics::pvData::PVStructure::shared_pointer const & args,
76 RPCResponseCallback::shared_pointer const & callback
77 ) = 0;
78};
79
80class epicsShareClass RPCService :
81 public RPCServiceAsync
82{
83public:
84 POINTER_DEFINITIONS(RPCService);
85
86 virtual ~RPCService() {};
87
88 virtual epics::pvData::PVStructure::shared_pointer request(
89 epics::pvData::PVStructure::shared_pointer const & args
90 ) = 0;
91
92private:
93 virtual void request(
94 epics::pvData::PVStructure::shared_pointer const & args,
95 RPCResponseCallback::shared_pointer const & callback
96 ) OVERRIDE FINAL;
97};
98
99}
100}
101
102#endif /* RPCSERVICE_H */
virtual const char * what() const noexcept
runtime_error(const string &__arg) _GLIBCXX_TXN_SAFE
Copyright - See the COPYRIGHT that is included with this distribution.