This is Unofficial EPICS BASE Doxygen Site
pvas::detail::SharedRPC Struct Reference

#include "sharedstateimpl.h"

+ Inheritance diagram for pvas::detail::SharedRPC:
+ Collaboration diagram for pvas::detail::SharedRPC:

Public Member Functions

 SharedRPC (const std::tr1::shared_ptr< SharedChannel > &channel, const requester_type::shared_pointer &requester, const pvd::PVStructure::const_shared_pointer &pvRequest)
 
virtual ~SharedRPC ()
 
virtual void destroy () OVERRIDE FINAL
 
virtual std::tr1::shared_ptr< pva::ChannelgetChannel () OVERRIDE FINAL
 
virtual void cancel () OVERRIDE FINAL
 
virtual void lastRequest () OVERRIDE FINAL
 
virtual void request (epics::pvData::PVStructure::shared_pointer const &pvArgument) OVERRIDE FINAL
 
- 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 Attributes

const std::tr1::shared_ptr< SharedChannelchannel
 
const requester_type::weak_pointer requester
 
const pvd::PVStructure::const_shared_pointer pvRequest
 
bool connected
 

Static Public Attributes

static size_t num_instances
 
- Static Public Attributes inherited from epics::pvAccess::ChannelRequest
static size_t num_instances
 

Additional Inherited Members

- Public Types inherited from epics::pvAccess::ChannelRPC
typedef ChannelRPCRequester requester_type
 
- Protected Member Functions inherited from epics::pvAccess::Destroyable
virtual ~Destroyable ()
 

Detailed Description

Definition at line 105 of file sharedstateimpl.h.

Constructor & Destructor Documentation

pvas::detail::SharedRPC::SharedRPC ( const std::tr1::shared_ptr< SharedChannel > &  channel,
const requester_type::shared_pointer &  requester,
const pvd::PVStructure::const_shared_pointer &  pvRequest 
)

Definition at line 86 of file sharedstate_rpc.cpp.

92  ,connected(false)
93 {
94  REFTRACE_INCREMENT(num_instances);
95 }
const pvd::PVStructure::const_shared_pointer pvRequest
const std::tr1::shared_ptr< SharedChannel > channel
const requester_type::weak_pointer requester
pvas::detail::SharedRPC::~SharedRPC ( )
virtual

Definition at line 97 of file sharedstate_rpc.cpp.

97  {
98  Guard G(channel->owner->mutex);
99  channel->owner->rpcs.remove(this);
100  REFTRACE_DECREMENT(num_instances);
101 }
const std::tr1::shared_ptr< SharedChannel > channel

Member Function Documentation

void pvas::detail::SharedRPC::cancel ( )
virtual

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 110 of file sharedstate_rpc.cpp.

110 {}
void pvas::detail::SharedRPC::destroy ( )
virtual

Destroy this instance.

Implements epics::pvAccess::Destroyable.

Definition at line 103 of file sharedstate_rpc.cpp.

103 {}
std::tr1::shared_ptr< pva::Channel > pvas::detail::SharedRPC::getChannel ( )
virtual

Get a channel instance this request belongs to.

Returns
the channel instance.

Implements epics::pvAccess::ChannelRequest.

Definition at line 105 of file sharedstate_rpc.cpp.

106 {
107  return channel;
108 }
const std::tr1::shared_ptr< SharedChannel > channel
void pvas::detail::SharedRPC::lastRequest ( )
virtual

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 112 of file sharedstate_rpc.cpp.

112 {}
void pvas::detail::SharedRPC::request ( epics::pvData::PVStructure::shared_pointer const &  pvArgument)
virtual

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 114 of file sharedstate_rpc.cpp.

115 {
116  std::tr1::shared_ptr<SharedPV::Handler> handler;
117  pvd::Status sts;
118  {
119  Guard G(channel->owner->mutex);
120  if(channel->dead) {
121  sts = pvd::Status::error("Dead Channel");
122 
123  } else {
124  handler = channel->owner->handler;
125  }
126  }
127 
128  if(!sts.isOK()) {
129  requester_type::shared_pointer req(requester.lock());
130  if(req)
131  req->requestDone(sts, shared_from_this(), pvd::PVStructurePtr());
132 
133  } else {
134  std::tr1::shared_ptr<RPCOP> impl(new RPCOP(shared_from_this(), pvRequest, pvArgument),
135  Operation::Impl::Cleanup());
136 
137  if(handler) {
138  Operation op(impl);
139  handler->onRPC(channel->owner, op);
140  }
141  }
142 }
static Status error(const std::string &m)
Definition: status.h:50
const pvd::PVStructure::const_shared_pointer pvRequest
const std::tr1::shared_ptr< SharedChannel > channel
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
bool isOK() const
Definition: status.h:95
ChannelPut::shared_pointer op
Definition: pvAccess.cpp:132
const requester_type::weak_pointer requester

Member Data Documentation

const std::tr1::shared_ptr<SharedChannel> pvas::detail::SharedRPC::channel

Definition at line 108 of file sharedstateimpl.h.

bool pvas::detail::SharedRPC::connected

Definition at line 114 of file sharedstateimpl.h.

size_t pvas::detail::SharedRPC::num_instances
static

Definition at line 112 of file sharedstateimpl.h.

const pvd::PVStructure::const_shared_pointer pvas::detail::SharedRPC::pvRequest

Definition at line 110 of file sharedstateimpl.h.

const requester_type::weak_pointer pvas::detail::SharedRPC::requester

Definition at line 109 of file sharedstateimpl.h.


The documentation for this struct was generated from the following files: