This is Unofficial EPICS BASE Doxygen Site
GWChannel Struct Reference

#include "channel.h"

+ Inheritance diagram for GWChannel:
+ Collaboration diagram for GWChannel:

Public Member Functions

 POINTER_DEFINITIONS (GWChannel)
 
 GWChannel (const ChannelCacheEntry::shared_pointer &e, const epics::pvAccess::ChannelProvider::weak_pointer &srvprov, const requester_type::weak_pointer &, const std::string &addr)
 
virtual ~GWChannel ()
 
virtual std::string getRequesterName ()
 
virtual void destroy ()
 
virtual std::tr1::shared_ptr< epics::pvAccess::ChannelProvidergetProvider ()
 
virtual std::string getRemoteAddress ()
 
virtual ConnectionState getConnectionState ()
 
virtual std::string getChannelName ()
 
virtual std::tr1::shared_ptr< epics::pvAccess::ChannelRequestergetChannelRequester ()
 
virtual void getField (epics::pvAccess::GetFieldRequester::shared_pointer const &requester, std::string const &subField)
 
virtual epics::pvAccess::AccessRights getAccessRights (epics::pvData::PVField::shared_pointer const &pvField)
 
virtual epics::pvAccess::ChannelProcess::shared_pointer createChannelProcess (epics::pvAccess::ChannelProcessRequester::shared_pointer const &channelProcessRequester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual epics::pvAccess::ChannelGet::shared_pointer createChannelGet (epics::pvAccess::ChannelGetRequester::shared_pointer const &channelGetRequester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual epics::pvAccess::ChannelPut::shared_pointer createChannelPut (epics::pvAccess::ChannelPutRequester::shared_pointer const &channelPutRequester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual epics::pvAccess::ChannelPutGet::shared_pointer createChannelPutGet (epics::pvAccess::ChannelPutGetRequester::shared_pointer const &channelPutGetRequester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual epics::pvAccess::ChannelRPC::shared_pointer createChannelRPC (epics::pvAccess::ChannelRPCRequester::shared_pointer const &channelRPCRequester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual epics::pvData::Monitor::shared_pointer createMonitor (epics::pvData::MonitorRequester::shared_pointer const &monitorRequester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual epics::pvAccess::ChannelArray::shared_pointer createChannelArray (epics::pvAccess::ChannelArrayRequester::shared_pointer const &channelArrayRequester, epics::pvData::PVStructure::shared_pointer const &pvRequest)
 
virtual void printInfo (std::ostream &out)
 
- Public Member Functions inherited from epics::pvAccess::Channel
 POINTER_DEFINITIONS (Channel)
 
 Channel ()
 
virtual ~Channel ()
 
virtual void message (std::string const &message, epics::pvData::MessageType messageType)
 
virtual bool isConnected ()
 
virtual void getField (GetFieldRequester::shared_pointer const &requester, std::string const &subField)
 
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 ()
 
- 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)
 

Public Attributes

weak_pointer weakref
 
const ChannelCacheEntry::shared_pointer entry
 
const requester_type::weak_pointer requester
 
const std::string address
 
const epics::pvAccess::ChannelProvider::weak_pointer server_provder
 

Static Public Attributes

static size_t num_instances
 
- Static Public Attributes inherited from epics::pvAccess::Channel
static size_t num_instances
 
static const char * ConnectionStateNames [] = { "NEVER_CONNECTED", "CONNECTED", "DISCONNECTED", "DESTROYED" }
 

Additional Inherited Members

- Public Types inherited from epics::pvAccess::Channel
enum  ConnectionState { NEVER_CONNECTED, CONNECTED, DISCONNECTED, DESTROYED }
 
typedef ChannelRequester requester_type
 
- Protected Member Functions inherited from epics::pvAccess::Destroyable
virtual ~Destroyable ()
 

Detailed Description

Definition at line 10 of file channel.h.

Constructor & Destructor Documentation

GWChannel::GWChannel ( const ChannelCacheEntry::shared_pointer &  e,
const epics::pvAccess::ChannelProvider::weak_pointer &  srvprov,
const requester_type::weak_pointer &  ,
const std::string &  addr 
)

Definition at line 25 of file channel.cpp.

29  :entry(e)
30  ,requester(r)
31  ,address(addr)
32  ,server_provder(srvprov)
33 {
35 }
const std::string address
Definition: channel.h:18
const epics::pvAccess::ChannelProvider::weak_pointer server_provder
Definition: channel.h:19
const ChannelCacheEntry::shared_pointer entry
Definition: channel.h:16
const requester_type::weak_pointer requester
Definition: channel.h:17
EPICS_ATOMIC_INLINE size_t epicsAtomicIncrSizeT(size_t *pTarget)
static size_t num_instances
Definition: channel.h:13
GWChannel::~GWChannel ( )
virtual

Definition at line 37 of file channel.cpp.

38 {
40 }
EPICS_ATOMIC_INLINE size_t epicsAtomicDecrSizeT(size_t *pTarget)
static size_t num_instances
Definition: channel.h:13

Member Function Documentation

pva::ChannelArray::shared_pointer GWChannel::createChannelArray ( epics::pvAccess::ChannelArrayRequester::shared_pointer const &  channelArrayRequester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Definition at line 227 of file channel.cpp.

230 {
231  return entry->channel->createChannelArray(channelArrayRequester, pvRequest);
232 }
pva::ChannelGet::shared_pointer GWChannel::createChannelGet ( epics::pvAccess::ChannelGetRequester::shared_pointer const &  channelGetRequester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Definition at line 110 of file channel.cpp.

113 {
114  return entry->channel->createChannelGet(channelGetRequester, pvRequest);
115 }
pva::ChannelProcess::shared_pointer GWChannel::createChannelProcess ( epics::pvAccess::ChannelProcessRequester::shared_pointer const &  channelProcessRequester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Definition at line 99 of file channel.cpp.

102 {
103  if(!p2pReadOnly)
104  return entry->channel->createChannelProcess(channelProcessRequester, pvRequest);
105  else
106  return Channel::createChannelProcess(channelProcessRequester, pvRequest);
107 }
int p2pReadOnly
Definition: channel.cpp:21
pva::ChannelPut::shared_pointer GWChannel::createChannelPut ( epics::pvAccess::ChannelPutRequester::shared_pointer const &  channelPutRequester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Definition at line 118 of file channel.cpp.

121 {
122  //TODO: allow ChannelPut::get()
123  if(!p2pReadOnly)
124  return entry->channel->createChannelPut(channelPutRequester, pvRequest);
125  else
126  return Channel::createChannelPut(channelPutRequester, pvRequest);
127 }
int p2pReadOnly
Definition: channel.cpp:21
pva::ChannelPutGet::shared_pointer GWChannel::createChannelPutGet ( epics::pvAccess::ChannelPutGetRequester::shared_pointer const &  channelPutGetRequester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Definition at line 130 of file channel.cpp.

133 {
134  if(!p2pReadOnly)
135  return entry->channel->createChannelPutGet(channelPutGetRequester, pvRequest);
136  else
137  return Channel::createChannelPutGet(channelPutGetRequester, pvRequest);
138 }
int p2pReadOnly
Definition: channel.cpp:21
pva::ChannelRPC::shared_pointer GWChannel::createChannelRPC ( epics::pvAccess::ChannelRPCRequester::shared_pointer const &  channelRPCRequester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Definition at line 141 of file channel.cpp.

144 {
145  if(!p2pReadOnly)
146  return entry->channel->createChannelRPC(channelRPCRequester, pvRequest);
147  else
148  return Channel::createChannelRPC(channelRPCRequester, pvRequest);
149 }
int p2pReadOnly
Definition: channel.cpp:21
pvd::Monitor::shared_pointer GWChannel::createMonitor ( epics::pvData::MonitorRequester::shared_pointer const &  monitorRequester,
epics::pvData::PVStructure::shared_pointer const &  pvRequest 
)
virtual

Definition at line 158 of file channel.cpp.

161 {
163  // serialize request struct to string using host byte order (only used for local comparison)
164  pvd::serializeToVector(pvRequest.get(), EPICS_BYTE_ORDER, ser);
165 
166  MonitorCacheEntry::shared_pointer ment;
167  MonitorUser::shared_pointer mon;
168 
169  pvd::Status startresult;
170  pvd::StructureConstPtr typedesc;
171 
172  try {
173  {
174  Guard G(entry->mutex());
175 
176  // TODO: no-cache/no-share flag in pvRequest
177 
178  ment = entry->mon_entries.find(ser);
179  if(!ment) {
180  ment.reset(new MonitorCacheEntry(entry.get(), pvRequest));
181  entry->mon_entries[ser] = ment; // ref. wrapped
182  ment->weakref = ment;
183 
184  // We've added an incomplete entry (no Monitor)
185  // so MonitorUser must check validity before de-ref.
186  // in this case we use !!typedesc as this also indicates
187  // that the upstream monitor is connected
188  pvd::MonitorPtr M;
189  {
190  UnGuard U(G);
191 
192  M = entry->channel->createMonitor(ment, pvRequest);
193  }
194  ment->mon = M;
195  }
196  }
197 
198  Guard G(ment->mutex());
199 
200  mon.reset(new MonitorUser(ment));
201  ment->interested.insert(mon);
202  mon->weakref = mon;
203  mon->srvchan = shared_pointer(weakref);
204  mon->req = monitorRequester;
205 
206  typedesc = ment->typedesc;
207  startresult = ment->startresult;
208 
209  } catch(std::exception& e) {
210  mon.reset();
211  std::cerr<<"Exception in GWChannel::createMonitor()\n"
212  "is "<<e.what()<<"\n";
213  startresult = pvd::Status(pvd::Status::STATUSTYPE_FATAL, "Error during GWChannel setup");
214  }
215 
216  // unlock for callback
217 
218  if(typedesc || !startresult.isSuccess()) {
219  // upstream monitor already connected, or never will be.
220  monitorRequester->monitorConnect(startresult, mon, typedesc);
221  }
222 
223  return mon;
224 }
weak_pointer weakref
Definition: channel.h:14
std::tr1::shared_ptr< const Structure > StructureConstPtr
Definition: pvIntrospect.h:162
bool isSuccess() const
Definition: status.h:103
#define EPICS_BYTE_ORDER
Definition: osdWireConfig.h:16
void epicsShareFunc serializeToVector(const Serializable *S, int byteOrder, std::vector< epicsUInt8 > &out)
Push serialize and append to the provided byte vector. No caching is done. Only complete serializatio...
MonitorCacheEntry::pvrequest_t pvrequest_t
Definition: chancache.h:125
std::tr1::shared_ptr< Monitor > MonitorPtr
Definition: monitor.h:44
void GWChannel::destroy ( )
virtual

Destroy this instance.

Implements epics::pvAccess::Destroyable.

Definition at line 49 of file channel.cpp.

50 {}
pva::AccessRights GWChannel::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 from epics::pvAccess::Channel.

Definition at line 93 of file channel.cpp.

94 {
95  return entry->channel->getAccessRights(pvField);
96 }
std::string GWChannel::getChannelName ( )
virtual

The name passed to ChannelProvider::createChannel()

Implements epics::pvAccess::Channel.

Definition at line 72 of file channel.cpp.

73 {
74  return entry->channelName;
75 }
std::tr1::shared_ptr< pva::ChannelRequester > GWChannel::getChannelRequester ( )
virtual

The ChannelRequester passed to ChannelProvider::createChannel()

Exceptions
std::tr1::bad_weak_ptr

Implements epics::pvAccess::Channel.

Definition at line 78 of file channel.cpp.

79 {
80  return pva::ChannelRequester::shared_pointer(requester);
81 }
const requester_type::weak_pointer requester
Definition: channel.h:17
pva::Channel::ConnectionState GWChannel::getConnectionState ( )
virtual

Poll the connection state in more detail

Reimplemented from epics::pvAccess::Channel.

Definition at line 66 of file channel.cpp.

67 {
68  return entry->channel->getConnectionState();
69 }
void GWChannel::getField ( epics::pvAccess::GetFieldRequester::shared_pointer const &  requester,
std::string const &  subField 
)
virtual

Definition at line 85 of file channel.cpp.

87 {
88  //TODO: cache for top level field?
89  entry->channel->getField(requester, subField);
90 }
const requester_type::weak_pointer requester
Definition: channel.h:17
std::tr1::shared_ptr< pva::ChannelProvider > GWChannel::getProvider ( )
virtual

The ChannelProvider from which this Channel was requested. May never be NULL.

Implements epics::pvAccess::Channel.

Definition at line 53 of file channel.cpp.

54 {
55  return pva::ChannelProvider::shared_pointer(server_provder);
56 }
const epics::pvAccess::ChannelProvider::weak_pointer server_provder
Definition: channel.h:19
std::string GWChannel::getRemoteAddress ( )
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.

Implements epics::pvAccess::Channel.

Definition at line 59 of file channel.cpp.

60 {
61  // pass through address of origin server (information leak?)
62  return entry->channel->getRemoteAddress();
63 }
std::string GWChannel::getRequesterName ( )
virtual

The requester must have a name.

Returns
The requester's name.

Reimplemented from epics::pvAccess::Channel.

Definition at line 43 of file channel.cpp.

44 {
45  return "GWChannel";
46 }
GWChannel::POINTER_DEFINITIONS ( GWChannel  )
void GWChannel::printInfo ( std::ostream &  out)
virtual

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

Parameters
outthe output stream.

Reimplemented from epics::pvAccess::Channel.

Definition at line 236 of file channel.cpp.

237 {
238  out<<"GWChannel for "<<entry->channelName<<"\n";
239 }

Member Data Documentation

const std::string GWChannel::address

Definition at line 18 of file channel.h.

const ChannelCacheEntry::shared_pointer GWChannel::entry

Definition at line 16 of file channel.h.

size_t GWChannel::num_instances
static

Definition at line 13 of file channel.h.

const requester_type::weak_pointer GWChannel::requester

Definition at line 17 of file channel.h.

const epics::pvAccess::ChannelProvider::weak_pointer GWChannel::server_provder

Definition at line 19 of file channel.h.

weak_pointer GWChannel::weakref

Definition at line 14 of file channel.h.


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