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

Public Member Functions

 POINTER_DEFINITIONS (ChannelRPCLocal)
 
virtual void destroy ()
 
 ChannelRPCLocal (ChannelLocalPtr const &channelLocal, ChannelRPCRequester::shared_pointer const &channelRPCRequester, RPCServiceAsync::shared_pointer const &service, PVRecordPtr const &pvRecord)
 
virtual ~ChannelRPCLocal ()
 
void processRequest (RPCService::shared_pointer const &service, PVStructurePtr const &pvArgument)
 
virtual void requestDone (Status const &status, PVStructurePtr const &result)
 
void processRequest (RPCServiceAsync::shared_pointer const &service, PVStructurePtr const &pvArgument)
 
virtual void request (PVStructurePtr const &pvArgument)
 
virtual Channel::shared_pointer getChannel ()
 
virtual void cancel ()
 
virtual void lock ()
 
virtual void unlock ()
 
virtual void lastRequest ()
 
- Public Member Functions inherited from epics::pvAccess::ChannelRPC
 POINTER_DEFINITIONS (ChannelRPC)
 
virtual ~ChannelRPC ()
 
virtual void request (epics::pvData::PVStructure::shared_pointer const &pvArgument)=0
 
- 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 ()
 
- Public Member Functions inherited from epics::pvAccess::RPCResponseCallback
 POINTER_DEFINITIONS (RPCResponseCallback)
 
virtual ~RPCResponseCallback ()
 
virtual void requestDone (epics::pvData::Status const &status, epics::pvData::PVStructure::shared_pointer const &result)=0
 

Static Public Member Functions

static ChannelRPCLocalPtr create (ChannelLocalPtr const &channelLocal, ChannelRPCRequester::shared_pointer const &channelRPCRequester, PVStructurePtr const &pvRequest, PVRecordPtr const &pvRecord)
 

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 762 of file channelLocal.cpp.

Constructor & Destructor Documentation

epics::pvDatabase::ChannelRPCLocal::ChannelRPCLocal ( ChannelLocalPtr const &  channelLocal,
ChannelRPCRequester::shared_pointer const &  channelRPCRequester,
RPCServiceAsync::shared_pointer const &  service,
PVRecordPtr const &  pvRecord 
)
inline

Definition at line 776 of file channelLocal.cpp.

780  :
781  channelLocal(channelLocal),
782  channelRPCRequester(channelRPCRequester),
783  service(service),
784  pvRecord(pvRecord)
785  {
786  }
epics::pvDatabase::ChannelRPCLocal::~ChannelRPCLocal ( )
virtual

Definition at line 851 of file channelLocal.cpp.

852 {
853 //cout << "~ChannelRPCLocal()\n";
854 }

Member Function Documentation

virtual void epics::pvDatabase::ChannelRPCLocal::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 805 of file channelLocal.cpp.

805 {}
ChannelRPCLocalPtr epics::pvDatabase::ChannelRPCLocal::create ( ChannelLocalPtr const &  channelLocal,
ChannelRPCRequester::shared_pointer const &  channelRPCRequester,
PVStructurePtr const &  pvRequest,
PVRecordPtr const &  pvRecord 
)
static

Definition at line 820 of file channelLocal.cpp.

825 {
826  RPCServiceAsync::shared_pointer service = pvRecord->getService(pvRequest);
827  if (!service)
828  {
829  Status status(Status::STATUSTYPE_ERROR,
830  "ChannelRPC not supported");
831  channelRPCRequester->channelRPCConnect(status,ChannelRPCLocalPtr());
832  return ChannelRPCLocalPtr();
833  }
834 
835  if (!channelRPCRequester)
836  throw std::invalid_argument("channelRPCRequester == null");
837 
838  // TODO use std::make_shared
839  ChannelRPCLocalPtr rpc(
840  new ChannelRPCLocal(channelLocal, channelRPCRequester, service, pvRecord)
841  );
842  channelRPCRequester->channelRPCConnect(Status::Ok, rpc);
843  if(pvRecord->getTraceLevel()>0)
844  {
845  cout << "ChannelRPCLocal::create";
846  cout << " recordName " << pvRecord->getRecordName() << endl;
847  }
848  return rpc;
849 }
pvd::Status status
std::tr1::shared_ptr< ChannelRPCLocal > ChannelRPCLocalPtr
ChannelRPCLocal(ChannelLocalPtr const &channelLocal, ChannelRPCRequester::shared_pointer const &channelRPCRequester, RPCServiceAsync::shared_pointer const &service, PVRecordPtr const &pvRecord)
virtual void epics::pvDatabase::ChannelRPCLocal::destroy ( )
inlinevirtual

Destroy this instance.

Implements epics::pvAccess::Destroyable.

Definition at line 769 of file channelLocal.cpp.

769 {} // DEPRECATED
std::tr1::shared_ptr< Channel > epics::pvDatabase::ChannelRPCLocal::getChannel ( )
virtual

Get a channel instance this request belongs to.

Returns
the channel instance.

Implements epics::pvAccess::ChannelRequest.

Definition at line 856 of file channelLocal.cpp.

857 {
858  ChannelLocalPtr channel(channelLocal.lock());
859  return channel;
860 }
std::tr1::shared_ptr< ChannelLocal > ChannelLocalPtr
virtual void epics::pvDatabase::ChannelRPCLocal::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 808 of file channelLocal.cpp.

808 {}
virtual void epics::pvDatabase::ChannelRPCLocal::lock ( )
inlinevirtual

Reimplemented from epics::pvAccess::Lockable.

Definition at line 806 of file channelLocal.cpp.

806 {}
epics::pvDatabase::ChannelRPCLocal::POINTER_DEFINITIONS ( ChannelRPCLocal  )
void epics::pvDatabase::ChannelRPCLocal::processRequest ( RPCService::shared_pointer const &  service,
PVStructurePtr const &  pvArgument 
)

Definition at line 863 of file channelLocal.cpp.

866 {
868  Status status = Status::Ok;
869  bool ok = true;
870  try
871  {
872  result = service->request(pvArgument);
873  }
874  catch (RPCRequestException& rre)
875  {
876  status = Status(rre.getStatus(), rre.what());
877  ok = false;
878  }
879  catch (std::exception& ex)
880  {
881  status = Status(Status::STATUSTYPE_FATAL, ex.what());
882  ok = false;
883  }
884  catch (...)
885  {
886  // handle user unexpected errors
887  status = Status(Status::STATUSTYPE_FATAL, "Unexpected exception caught while calling RPCService.request(PVStructure).");
888  ok = false;
889  }
890 
891  // check null result
892  if (ok && !result)
893  {
894  status = Status(Status::STATUSTYPE_FATAL, "RPCService.request(PVStructure) returned null.");
895  }
896  ChannelRPCRequester::shared_pointer requester = channelRPCRequester.lock();
897  if(requester) requester->requestDone(status, getPtrSelf(), result);
898 }
pvac::PutEvent result
Definition: clientSync.cpp:117
pvd::Status status
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
epics::pvData::Status::StatusType getStatus() const
Definition: rpcService.h:43
void epics::pvDatabase::ChannelRPCLocal::processRequest ( RPCServiceAsync::shared_pointer const &  service,
PVStructurePtr const &  pvArgument 
)

Definition at line 900 of file channelLocal.cpp.

903 {
904  try
905  {
906  service->request(pvArgument, getPtrSelf());
907  }
908  catch (std::exception& ex)
909  {
910  // handle user unexpected errors
911  Status errorStatus(Status::STATUSTYPE_FATAL, ex.what());
912  ChannelRPCRequester::shared_pointer requester = channelRPCRequester.lock();
913  if(requester) requester->requestDone(errorStatus, getPtrSelf(), PVStructurePtr());
914  }
915  catch (...)
916  {
917  // handle user unexpected errors
918  Status errorStatus(Status::STATUSTYPE_FATAL,
919  "Unexpected exception caught while calling RPCServiceAsync.request(PVStructure, RPCResponseCallback).");
920  ChannelRPCRequester::shared_pointer requester = channelRPCRequester.lock();
921  if(requester) requester->requestDone(errorStatus, shared_from_this(), PVStructurePtr());
922  }
923 
924  // we wait for callback to be called
925 }
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
void epics::pvDatabase::ChannelRPCLocal::request ( PVStructurePtr const &  pvArgument)
virtual

Definition at line 928 of file channelLocal.cpp.

929 {
930  PVRecordPtr pvr(pvRecord.lock());
931  if(pvr && pvr->getTraceLevel()>0) {
932  cout << "ChannelRPCLocal::request " << pvr->getRecordName() << endl;
933  }
934  RPCService::shared_pointer rpcService =
936  if (rpcService)
937  {
938  processRequest(rpcService, pvArgument);
939  return;
940  }
941 
942  RPCServiceAsync::shared_pointer rpcServiceAsync =
944  if (rpcServiceAsync)
945  {
946  processRequest(rpcServiceAsync, pvArgument);
947  return;
948  }
949 }
void processRequest(RPCService::shared_pointer const &service, PVStructurePtr const &pvArgument)
std::tr1::shared_ptr< PVRecord > PVRecordPtr
Definition: pvDatabase.h:21
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:808
virtual void epics::pvDatabase::ChannelRPCLocal::requestDone ( Status const &  status,
PVStructurePtr const &  result 
)
inlinevirtual

Definition at line 792 of file channelLocal.cpp.

794  {
795  ChannelRPCRequester::shared_pointer requester = channelRPCRequester.lock();
796  if(!requester) return;
797  requester->requestDone(status, getPtrSelf(), result);
798  }
pvac::PutEvent result
Definition: clientSync.cpp:117
pvd::Status status
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
virtual void epics::pvDatabase::ChannelRPCLocal::unlock ( )
inlinevirtual

Reimplemented from epics::pvAccess::Lockable.

Definition at line 807 of file channelLocal.cpp.

807 {}

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