This is Unofficial EPICS BASE Doxygen Site
epics::pvAccess::Channel Class Referenceabstract

#include "pvAccess.h"

+ Inheritance diagram for epics::pvAccess::Channel:
+ Collaboration diagram for epics::pvAccess::Channel:

Public Types

enum  ConnectionState { NEVER_CONNECTED, CONNECTED, DISCONNECTED, DESTROYED }
 
typedef ChannelRequester requester_type
 

Public Member Functions

 POINTER_DEFINITIONS (Channel)
 
 Channel ()
 
virtual ~Channel ()
 
virtual std::string getRequesterName ()
 
virtual void message (std::string const &message, epics::pvData::MessageType messageType)
 
virtual std::tr1::shared_ptr< ChannelProvidergetProvider ()=0
 
virtual std::string getRemoteAddress ()=0
 
virtual ConnectionState getConnectionState ()
 
virtual std::string getChannelName ()=0
 
virtual std::tr1::shared_ptr< ChannelRequestergetChannelRequester ()=0
 
virtual bool isConnected ()
 
virtual void getField (GetFieldRequester::shared_pointer const &requester, std::string const &subField)
 
virtual AccessRights getAccessRights (epics::pvData::PVField::shared_pointer const &pvField)
 
virtual ChannelProcess::shared_pointer createChannelProcess (ChannelProcessRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual ChannelGet::shared_pointer createChannelGet (ChannelGetRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual ChannelPut::shared_pointer createChannelPut (ChannelPutRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual ChannelPutGet::shared_pointer createChannelPutGet (ChannelPutGetRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual ChannelRPC::shared_pointer createChannelRPC (ChannelRPCRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual Monitor::shared_pointer createMonitor (MonitorRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual ChannelArray::shared_pointer createChannelArray (ChannelArrayRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual void printInfo ()
 
virtual void printInfo (std::ostream &out)
 
- Public Member Functions inherited from epics::pvAccess::Requester
 POINTER_DEFINITIONS (Requester)
 
virtual ~Requester ()
 
virtual void message (std::string const &message, MessageType messageType=errorMessage)
 
- Public Member Functions inherited from epics::pvAccess::Destroyable
 POINTER_DEFINITIONS (Destroyable)
 
virtual void destroy ()=0
 

Static Public Attributes

static size_t num_instances
 
static const char * ConnectionStateNames [] = { "NEVER_CONNECTED", "CONNECTED", "DISCONNECTED", "DESTROYED" }
 

Additional Inherited Members

- Protected Member Functions inherited from epics::pvAccess::Destroyable
virtual ~Destroyable ()
 

Detailed Description

The interface through which Operations (get, put, monitor, ...) are initiated.

Handle for a Channel returned by ChannelProvider::createChannel()

At any given moment a Channel may be CONNECTED or DISCONNECTED. (NEVER_CONNECTED and DESTORYED are special cases of DISCONNECTED)

A Channel is required to honor calls to Channel::create*() methods while in the disconnected state.

A Channel is required to maintain a strong reference (shared_ptr<>) to the ChannelProvider through which it was created.

Definition at line 886 of file pvAccess.h.

Member Typedef Documentation

Member Enumeration Documentation

Constructor & Destructor Documentation

epics::pvAccess::Channel::Channel ( )

Definition at line 26 of file pvAccess.cpp.

26 {REFTRACE_INCREMENT(num_instances);}
static size_t num_instances
Definition: pvAccess.h:895
epics::pvAccess::Channel::~Channel ( )
virtual

Definition at line 27 of file pvAccess.cpp.

27 {REFTRACE_DECREMENT(num_instances);}
static size_t num_instances
Definition: pvAccess.h:895

Member Function Documentation

ChannelArray::shared_pointer epics::pvAccess::Channel::createChannelArray ( ChannelArrayRequester::shared_pointer const &  requester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Initiate a request for a Array (get) action.

ChannelArrayRequester::channelArrayConnect() may be called before createChannelArray() returns, or at some time afterwards.

Failure is indicated by a call to channelArrayConnect with !Error::isOk()

Precondition
The Channel need not be CONNECTED
Postcondition
The returned ChannelArray will hold a strong reference to the provided MonitorRequester.
Returned shared_ptr<ChannelArray> will have unique()==true.
Returns
A non-NULL ChannelArray unless channelArrayConnect() called with an Error

Create a ChannelArray.

Parameters
channelArrayRequesterThe ChannelArrayRequester
pvRequestAdditional options (e.g. triggering).
Returns
ChannelArray instance.
Note
The default implementation yields a not implemented error

Definition at line 365 of file pvAccess.cpp.

368 {
369  ChannelArray::shared_pointer ret;
370  requester->channelArrayConnect(pvd::Status(pvd::Status::STATUSTYPE_FATAL, "Not Implemented"),
371  ret, pvd::Array::const_shared_pointer());
372  return ret;
373 }
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
ChannelGet::shared_pointer epics::pvAccess::Channel::createChannelGet ( ChannelGetRequester::shared_pointer const &  requester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Initiate a request for a Get action.

ChannelGetRequester::channelGetConnect() may be called before createChannelGet() returns, or at some time afterwards.

Failure is indicated by a call to channelProcessConnect with !Error::isOk()

Precondition
The Channel need not be CONNECTED
Postcondition
The returned ChannelGet will hold a strong reference to the provided ChannelGetRequester.
Returned shared_ptr<ChannelGet> will have unique()==true.
Returns
A non-NULL ChannelGet unless channelGetConnect() called with an Error
Note
The default implementation proxies to createChannelPut()

Definition at line 308 of file pvAccess.cpp.

311 {
312  std::tr1::shared_ptr<Get2PutProxy> ret(new Get2PutProxy);
313  ret->op_request.reset(new Get2PutProxy::Req(requester, ret));
314 
315  ChannelPut::shared_pointer op(createChannelPut(ret->op_request, pvRequest));
316  if(!op) {
317  ret.reset();
318  } else {
319  epicsGuard<epicsMutex> G(ret->op_request->mutex);
320  ret->op = op;
321  }
322 
323  return ret;
324 }
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
virtual ChannelPut::shared_pointer createChannelPut(ChannelPutRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
Definition: pvAccess.cpp:326
ChannelPut::shared_pointer op
Definition: pvAccess.cpp:132
ChannelProcess::shared_pointer epics::pvAccess::Channel::createChannelProcess ( ChannelProcessRequester::shared_pointer const &  requester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Initiate a request for a Process action.

ChannelProcessRequester::channelProcessConnect() may be called before createChannelProcess() returns, or at some time afterwards.

Failure is indicated by a call to channelProcessConnect with !Error::isOk()

Precondition
The Channel need not be CONNECTED
Postcondition
The returned ChannelProcess will hold a strong reference to the provided ChannelProcessRequester.
Returned shared_ptr<ChannelProcess> will have unique()==true.
Returns
A non-NULL ChannelProcess unless channelProcessConnect() called with an Error
Note
The default implementation proxies using createChannelPut() and ChannelPut::put() with no data (empty bit set)

Definition at line 167 of file pvAccess.cpp.

170 {
171  pvd::PVStructure::shared_pointer pvRequest(pvRequestx);
172  std::tr1::shared_ptr<Process2PutProxy> ret(new Process2PutProxy);
173  ret->op_request.reset(new Process2PutProxy::Req(requester, ret));
174 
175  // inject record._options.process=true if client hasn't provided
176  if(!pvRequest->getSubField("record._options.process"))
177  {
178  pvRequest = pvd::ValueBuilder(*pvRequest)
179  .addNested("record")
180  .addNested("_options")
181  .add<pvd::pvString>("process", "true")
182  .endNested()
183  .endNested()
184  .buildPVStructure();
185  }
186 
187  ChannelPut::shared_pointer op(createChannelPut(ret->op_request, pvRequest));
188  if(!op) {
189  ret.reset();
190  } else {
191  epicsGuard<epicsMutex> G(ret->op_request->mutex);
192  ret->op = op;
193  }
194 
195  return ret;
196 }
ValueBuilder & addNested(const std::string &name, Type type=structure, const std::string &id=std::string())
Start a sub-structure.
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
virtual ChannelPut::shared_pointer createChannelPut(ChannelPutRequester::shared_pointer const &requester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
Definition: pvAccess.cpp:326
FORCE_INLINE ValueBuilder & add(const std::string &name, typename meta::arg_type< typename ScalarTypeTraits< ENUM >::type >::type V)
Add a scalar field with a given name and initial value.
Definition: valueBuilder.h:42
ChannelPut::shared_pointer op
Definition: pvAccess.cpp:132
ChannelPut::shared_pointer epics::pvAccess::Channel::createChannelPut ( ChannelPutRequester::shared_pointer const &  requester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Initiate a request for a Put action.

ChannelPutRequester::channelPutConnect() may be called before createChannelPut() returns, or at some time afterwards.

Failure is indicated by a call to channelProcessConnect with !Error::isOk()

Precondition
The Channel need not be CONNECTED
Postcondition
The returned ChannelPut will hold a strong reference to the provided ChannelPutRequester.
Returned shared_ptr<ChannelPut> will have unique()==true.
Returns
A non-NULL ChannelPut unless channelPutConnect() called with an Error
Note
The default implementation yields a not implemented error

Definition at line 326 of file pvAccess.cpp.

329 {
330  ChannelPut::shared_pointer ret;
331  requester->channelPutConnect(pvd::Status(pvd::Status::STATUSTYPE_FATAL, "Not Implemented"),
332  ret, pvd::StructureConstPtr());
333  return ret;
334 }
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
ChannelPutGet::shared_pointer epics::pvAccess::Channel::createChannelPutGet ( ChannelPutGetRequester::shared_pointer const &  requester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Initiate a request for a PutGet action.

ChannelPutGetRequester::channelPutGetConnect() may be called before createChannelPutGet() returns, or at some time afterwards.

Failure is indicated by a call to channelProcessConnect with !Error::isOk()

Precondition
The Channel need not be CONNECTED
Postcondition
The returned ChannelPutGet will hold a strong reference to the provided ChannelPutGetRequester.
Returned shared_ptr<ChannelPutGet> will have unique()==true.
Returns
A non-NULL ChannelPutGet unless channelPutGetConnect() called with an Error
Note
The default implementation yields a not implemented error

Definition at line 336 of file pvAccess.cpp.

339 {
340  ChannelPutGet::shared_pointer ret;
341  requester->channelPutGetConnect(pvd::Status(pvd::Status::STATUSTYPE_FATAL, "Not Implemented"),
343  return ret;
344 }
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
ChannelRPC::shared_pointer epics::pvAccess::Channel::createChannelRPC ( ChannelRPCRequester::shared_pointer const &  requester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Initiate a request for a RPC action.

ChannelRPCRequester::channelRPCConnect() may be called before createChannelRPC() returns, or at some time afterwards.

Failure is indicated by a call to channelProcessConnect with !Error::isOk()

Precondition
The Channel need not be CONNECTED
Postcondition
The returned ChannelRPC will hold a strong reference to the provided ChannelRPCRequester.
Returned shared_ptr<ChannelRPC> will have unique()==true.
Returns
A non-NULL ChannelRPC unless channelRPCConnect() called with an Error
Note
The default implementation yields a not implemented error

Reimplemented in epics::pvAccess::RPCChannel.

Definition at line 346 of file pvAccess.cpp.

349 {
350  ChannelRPC::shared_pointer ret;
351  requester->channelRPCConnect(pvd::Status(pvd::Status::STATUSTYPE_FATAL, "Not Implemented"), ret);
352  return ret;
353 }
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
pvd::Monitor::shared_pointer epics::pvAccess::Channel::createMonitor ( MonitorRequester::shared_pointer const &  requester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Initiate a request for a Monitor action.

MonitorRequester::channelMonitorConnect() may be called before createMonitor() returns, or at some time afterwards.

Failure is indicated by a call to monitorConnect with !Error::isOk()

Precondition
The Channel need not be CONNECTED
Postcondition
The returned Monitor will hold a strong reference to the provided MonitorRequester.
Returned shared_ptr<Monitor> will have unique()==true.
Returns
A non-NULL Monitor unless monitorConnect() called with an Error
Note
The default implementation yields a not implemented error

Definition at line 355 of file pvAccess.cpp.

358 {
359  pvd::Monitor::shared_pointer ret;
360  requester->monitorConnect(pvd::Status(pvd::Status::STATUSTYPE_FATAL, "Not Implemented"),
361  ret, pvd::StructureConstPtr());
362  return ret;
363 }
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
AccessRights epics::pvAccess::Channel::getAccessRights ( epics::pvData::PVField::shared_pointer const &  pvField)
virtual

Not useful...

Parameters
pvFieldThe field for which access rights is desired.
Returns
The access rights.

Reimplemented in epics::pvDatabase::ChannelLocal, epics::pvAccess::RPCChannel, epics::pvAccess::ca::CAChannel, and GWChannel.

Definition at line 57 of file pvAccess.cpp.

58 {
59  return readWrite;
60 }
virtual std::string epics::pvAccess::Channel::getChannelName ( )
pure virtual
virtual std::tr1::shared_ptr<ChannelRequester> epics::pvAccess::Channel::getChannelRequester ( )
pure virtual
Channel::ConnectionState epics::pvAccess::Channel::getConnectionState ( )
virtual

Poll the connection state in more detail

Reimplemented in epics::pvDatabase::ChannelLocal, TestPVChannel, epics::pvAccess::RPCChannel, epics::pvAccess::ca::CAChannel, and GWChannel.

Definition at line 47 of file pvAccess.cpp.

void epics::pvAccess::Channel::getField ( GetFieldRequester::shared_pointer const &  requester,
std::string const &  subField 
)
virtual

Initiate a request to retrieve a description of the structure of this Channel.

While the type described by calls to getField() should match what is provided for all operations except RPC.

GetFieldRequester::getDone() will be called before getField() returns, or at some time afterwards.

Parameters
RequesterThe Requester.
subFieldEmpty string, or the field name of a sub-structure.

Reimplemented in epics::pvAccess::ca::CAChannel.

Definition at line 51 of file pvAccess.cpp.

52 {
53  requester->getDone(pvd::Status(pvd::Status::STATUSTYPE_FATAL, "Not Implemented")
55 }
const ChannelProcessRequester::weak_pointer requester
Definition: pvAccess.cpp:68
std::tr1::shared_ptr< const Field > FieldConstPtr
Definition: pvIntrospect.h:137
virtual std::tr1::shared_ptr<ChannelProvider> epics::pvAccess::Channel::getProvider ( )
pure virtual
virtual std::string epics::pvAccess::Channel::getRemoteAddress ( )
pure virtual

Returns the channel's remote address, signal name, etc... For example:

  • client side channel would return server's address, e.g. "/192.168.1.101:5064"
  • server side channel would return underlying bus address, e.g. "#C0 S1".

The value returned here will changed depending on the connection status. A disconnected channel should return an empty() string.

Implemented in epics::pvDatabase::ChannelLocal, TestPVChannel, epics::pvAccess::RPCChannel, epics::pvAccess::ca::CAChannel, pvas::detail::SharedChannel, BaseChannel, and GWChannel.

std::string epics::pvAccess::Channel::getRequesterName ( )
virtual

The requester must have a name.

Returns
The requester's name.

Implements epics::pvAccess::Requester.

Reimplemented in epics::pvAccess::RPCChannel, epics::pvDatabase::ChannelLocal, BaseChannel, and GWChannel.

Definition at line 29 of file pvAccess.cpp.

30 {
31  std::tr1::shared_ptr<ChannelRequester> req(getChannelRequester());
32  return req ? req->getRequesterName() : std::string("<Destroy'd Channel>");
33 }
virtual std::tr1::shared_ptr< ChannelRequester > getChannelRequester()=0
bool epics::pvAccess::Channel::isConnected ( )
virtual

Poll connection state

Reimplemented in epics::pvDatabase::ChannelLocal.

Definition at line 49 of file pvAccess.cpp.

49 { return getConnectionState()==CONNECTED; }
virtual ConnectionState getConnectionState()
Definition: pvAccess.cpp:47
void epics::pvAccess::Channel::message ( std::string const &  message,
epics::pvData::MessageType  messageType 
)
virtual

Reimplemented in epics::pvDatabase::ChannelLocal.

Definition at line 35 of file pvAccess.cpp.

36 {
37  std::tr1::shared_ptr<ChannelRequester> req(getChannelRequester());
38  if(req) {
39  req->message(message, messageType);
40  } else {
41  std::cerr<<epics::pvData::getMessageTypeName(messageType)
42  <<": on Destroy'd Channel \""<<getChannelName()
43  <<"\" : "<<message;
44  }
45 }
epicsShareExtern std::string getMessageTypeName(MessageType messageType)
Definition: requester.cpp:25
virtual std::tr1::shared_ptr< ChannelRequester > getChannelRequester()=0
virtual std::string getChannelName()=0
virtual void message(std::string const &message, epics::pvData::MessageType messageType)
Definition: pvAccess.cpp:35
epics::pvAccess::Channel::POINTER_DEFINITIONS ( Channel  )
virtual void epics::pvAccess::Channel::printInfo ( )
inlinevirtual

Prints detailed information about the context to the standard output stream.

Reimplemented in epics::pvDatabase::ChannelLocal.

Definition at line 1126 of file pvAccess.h.

1126 { printInfo(std::cout); }
virtual void printInfo()
Definition: pvAccess.h:1126
virtual void epics::pvAccess::Channel::printInfo ( std::ostream &  out)
inlinevirtual

Prints detailed information about the context to the specified output stream.

Parameters
outthe output stream.

Reimplemented in epics::pvDatabase::ChannelLocal, epics::pvAccess::RPCChannel, PDBGroupChannel, epics::pvAccess::ca::CAChannel, PDBSingleChannel, GWChannel, and BaseChannel.

Definition at line 1132 of file pvAccess.h.

1132 {}

Member Data Documentation

const char * epics::pvAccess::Channel::ConnectionStateNames = { "NEVER_CONNECTED", "CONNECTED", "DISCONNECTED", "DESTROYED" }
static

Definition at line 910 of file pvAccess.h.

size_t epics::pvAccess::Channel::num_instances
static

Definition at line 895 of file pvAccess.h.


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