This is Unofficial EPICS BASE Doxygen Site
epics::pvAccess::ChannelRPCServiceImpl Class Reference
+ Inheritance diagram for epics::pvAccess::ChannelRPCServiceImpl:
+ Collaboration diagram for epics::pvAccess::ChannelRPCServiceImpl:

Public Member Functions

 ChannelRPCServiceImpl (Channel::shared_pointer const &channel, ChannelRPCRequester::shared_pointer const &channelRPCRequester, RPCServiceAsync::shared_pointer const &rpcService)
 
virtual ~ChannelRPCServiceImpl ()
 
virtual void requestDone (epics::pvData::Status const &status, epics::pvData::PVStructure::shared_pointer const &result)
 
virtual void request (epics::pvData::PVStructure::shared_pointer const &pvArgument)
 
void lastRequest ()
 
virtual Channel::shared_pointer getChannel ()
 
virtual void cancel ()
 
virtual void destroy ()
 
- Public Member Functions inherited from epics::pvAccess::ChannelRPC
 POINTER_DEFINITIONS (ChannelRPC)
 
virtual ~ChannelRPC ()
 
- Public Member Functions inherited from epics::pvAccess::ChannelRequest
 POINTER_DEFINITIONS (ChannelRequest)
 
 ChannelRequest ()
 
virtual ~ChannelRequest ()
 
- Public Member Functions inherited from epics::pvAccess::Destroyable
 POINTER_DEFINITIONS (Destroyable)
 
- Public Member Functions inherited from epics::pvAccess::Lockable
 POINTER_DEFINITIONS (Lockable)
 
virtual ~Lockable ()
 
virtual void lock ()
 
virtual void unlock ()
 
- Public Member Functions inherited from epics::pvAccess::RPCResponseCallback
 POINTER_DEFINITIONS (RPCResponseCallback)
 
virtual ~RPCResponseCallback ()
 

Additional Inherited Members

- Public Types inherited from epics::pvAccess::ChannelRPC
typedef ChannelRPCRequester requester_type
 
- Static Public Attributes inherited from epics::pvAccess::ChannelRequest
static size_t num_instances
 
- Protected Member Functions inherited from epics::pvAccess::Destroyable
virtual ~Destroyable ()
 

Detailed Description

Definition at line 23 of file rpcServer.cpp.

Constructor & Destructor Documentation

epics::pvAccess::ChannelRPCServiceImpl::ChannelRPCServiceImpl ( Channel::shared_pointer const &  channel,
ChannelRPCRequester::shared_pointer const &  channelRPCRequester,
RPCServiceAsync::shared_pointer const &  rpcService 
)
inline

Definition at line 35 of file rpcServer.cpp.

38  :
39  m_channel(channel),
40  m_channelRPCRequester(channelRPCRequester),
41  m_rpcService(rpcService),
42  m_lastRequest()
43  {
44  }
virtual epics::pvAccess::ChannelRPCServiceImpl::~ChannelRPCServiceImpl ( )
inlinevirtual

Definition at line 46 of file rpcServer.cpp.

47  {
48  destroy();
49  }

Member Function Documentation

virtual void epics::pvAccess::ChannelRPCServiceImpl::cancel ( )
inlinevirtual

Cancel any pending request. Completion will be reported via request's response callback:

  • if cancel() request is issued after the request was already complete, request success/failure completion will be reported and cancel() request ignored.
  • if the request was actually canceled, cancellation completion is reported.

Implements epics::pvAccess::ChannelRequest.

Definition at line 103 of file rpcServer.cpp.

104  {
105  // noop
106  }
virtual void epics::pvAccess::ChannelRPCServiceImpl::destroy ( )
inlinevirtual

Destroy this instance.

Implements epics::pvAccess::Destroyable.

Definition at line 108 of file rpcServer.cpp.

109  {
110  // noop
111  }
virtual Channel::shared_pointer epics::pvAccess::ChannelRPCServiceImpl::getChannel ( )
inlinevirtual

Get a channel instance this request belongs to.

Returns
the channel instance.

Implements epics::pvAccess::ChannelRequest.

Definition at line 98 of file rpcServer.cpp.

99  {
100  return m_channel;
101  }
void epics::pvAccess::ChannelRPCServiceImpl::lastRequest ( )
inlinevirtual

Announce next request as last request. When last request will be completed (regardless of completion status) the remote and local instance will be destroyed.

Implements epics::pvAccess::ChannelRequest.

Definition at line 93 of file rpcServer.cpp.

94  {
95  m_lastRequest.set();
96  }
virtual void epics::pvAccess::ChannelRPCServiceImpl::request ( epics::pvData::PVStructure::shared_pointer const &  pvArgument)
inlinevirtual

Issue an RPC request to the channel.

Completion status is reported by calling ChannelRPCRequester::requestDone() callback, which may be called from this method.

Precondition
The underlying Channel must be connected, and this ChannelRPC valid. Otherwise the ChannelRPCRequester::requestDone() is called with an error.
Postcondition
After calling request(), the requestDone() callback will be called at some later time. May call ChannelRPC::cancel() to request to abort() this operation.
Parameters
pvArgumentThe argument structure for an RPC request.

Implements epics::pvAccess::ChannelRPC.

Definition at line 62 of file rpcServer.cpp.

63  {
64  try
65  {
66  m_rpcService->request(pvArgument, shared_from_this());
67  }
68  catch (std::exception& ex)
69  {
70  // handle user unexpected errors
71  Status errorStatus(Status::STATUSTYPE_FATAL, ex.what());
72 
73  m_channelRPCRequester->requestDone(errorStatus, shared_from_this(), PVStructure::shared_pointer());
74 
75  if (m_lastRequest.get())
76  destroy();
77  }
78  catch (...)
79  {
80  // handle user unexpected errors
81  Status errorStatus(Status::STATUSTYPE_FATAL,
82  "Unexpected exception caught while calling RPCServiceAsync.request(PVStructure, RPCResponseCallback).");
83 
84  m_channelRPCRequester->requestDone(errorStatus, shared_from_this(), PVStructure::shared_pointer());
85 
86  if (m_lastRequest.get())
87  destroy();
88  }
89 
90  // we wait for callback to be called
91  }
virtual void epics::pvAccess::ChannelRPCServiceImpl::requestDone ( epics::pvData::Status const &  status,
epics::pvData::PVStructure::shared_pointer const &  result 
)
inlinevirtual

Implements epics::pvAccess::RPCResponseCallback.

Definition at line 51 of file rpcServer.cpp.

55  {
56  m_channelRPCRequester->requestDone(status, shared_from_this(), result);
57 
58  if (m_lastRequest.get())
59  destroy();
60  }
pvac::PutEvent result
Definition: clientSync.cpp:117
pvd::Status status

The documentation for this class was generated from the following file: