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

Public Member Functions

 POINTER_DEFINITIONS (RPCChannelProvider)
 
 RPCChannelProvider ()
 
virtual string getProviderName ()
 
virtual std::tr1::shared_ptr< ChannelProvidergetChannelProvider ()
 
virtual void cancel ()
 
virtual void destroy ()
 
virtual ChannelFind::shared_pointer channelFind (std::string const &channelName, ChannelFindRequester::shared_pointer const &channelFindRequester)
 
virtual ChannelFind::shared_pointer channelList (ChannelListRequester::shared_pointer const &channelListRequester)
 
virtual Channel::shared_pointer createChannel (std::string const &channelName, ChannelRequester::shared_pointer const &channelRequester, short)
 
virtual Channel::shared_pointer createChannel (std::string const &, ChannelRequester::shared_pointer const &, short, std::string const &)
 
void registerService (std::string const &serviceName, RPCServiceAsync::shared_pointer const &service)
 
void unregisterService (std::string const &serviceName)
 
- Public Member Functions inherited from epics::pvAccess::ChannelProvider
 POINTER_DEFINITIONS (ChannelProvider)
 
 ChannelProvider ()
 
virtual ~ChannelProvider ()
 
- Public Member Functions inherited from epics::pvAccess::Destroyable
 POINTER_DEFINITIONS (Destroyable)
 
- Public Member Functions inherited from epics::pvAccess::ChannelFind
 POINTER_DEFINITIONS (ChannelFind)
 
 ChannelFind ()
 
virtual ~ChannelFind ()
 

Static Public Attributes

static const string PROVIDER_NAME
 
static const Status noSuchChannelStatus
 
- Static Public Attributes inherited from epics::pvAccess::ChannelProvider
static const short PRIORITY_MIN = 0
 
static const short PRIORITY_MAX = 99
 
static const short PRIORITY_DEFAULT = PRIORITY_MIN
 
static const short PRIORITY_LINKS_DB = PRIORITY_MAX
 
static const short PRIORITY_ARCHIVE = (PRIORITY_MAX + PRIORITY_MIN) / 2
 
static const short PRIORITY_OPI = PRIORITY_MIN
 
static size_t num_instances
 

Additional Inherited Members

- Public Types inherited from epics::pvAccess::ChannelFind
typedef ChannelFindRequester requester_type
 
- Static Public Member Functions inherited from epics::pvAccess::ChannelFind
static ChannelFind::shared_pointer buildDummy (const std::tr1::shared_ptr< ChannelProvider > &provider)
 
- Protected Member Functions inherited from epics::pvAccess::Destroyable
virtual ~Destroyable ()
 

Detailed Description

Definition at line 243 of file rpcServer.cpp.

Constructor & Destructor Documentation

epics::pvAccess::RPCChannelProvider::RPCChannelProvider ( )
inline

Definition at line 257 of file rpcServer.cpp.

257  {
258  }

Member Function Documentation

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

Implements epics::pvAccess::ChannelFind.

Definition at line 269 of file rpcServer.cpp.

269 {}
virtual ChannelFind::shared_pointer epics::pvAccess::RPCChannelProvider::channelFind ( std::string const &  name,
ChannelFindRequester::shared_pointer const &  requester 
)
inlinevirtual

Test to see if this provider has the named channel.

May call ChannelFindRequester::channelFindResult() before returning, or at some time later. If an exception is thrown, then channelFindResult() will never be called.

Parameters
nameThe channel name.
requesterThe Requester.
Returns
An unique()==true handle for the pending response. May only return NULL if channelFindResult() called with an Error

Implements epics::pvAccess::ChannelProvider.

Definition at line 273 of file rpcServer.cpp.

275  {
276  bool found;
277  {
278  Lock guard(m_mutex);
279  found = (m_services.find(channelName) != m_services.end()) ||
280  findWildService(channelName);
281  }
282  ChannelFind::shared_pointer thisPtr(shared_from_this());
283  channelFindRequester->channelFindResult(Status::Ok, thisPtr, found);
284  return thisPtr;
285  }
static Status Ok
Definition: status.h:47
A lock for multithreading.
Definition: lock.h:36
virtual ChannelFind::shared_pointer epics::pvAccess::RPCChannelProvider::channelList ( ChannelListRequester::shared_pointer const &  requester)
inlinevirtual

Request a list of all valid channel names for this provider.

May call ChannelListRequester::channelListResult() before returning, or at some time later. If an exception is thrown, then channelListResult() will never be called.

Parameters
requesterThe Requester.
Returns
An unique()==true handle for the pending response. May only return NULL if channelFindResult() called with an Error

Reimplemented from epics::pvAccess::ChannelProvider.

Definition at line 288 of file rpcServer.cpp.

290  {
291  if (!channelListRequester.get())
292  throw std::runtime_error("null requester");
293 
294  PVStringArray::svector channelNames;
295  {
296  Lock guard(m_mutex);
297  channelNames.reserve(m_services.size());
298  for (RPCServiceMap::const_iterator iter = m_services.begin();
299  iter != m_services.end();
300  iter++)
301  channelNames.push_back(iter->first);
302  }
303 
304  ChannelFind::shared_pointer thisPtr(shared_from_this());
305  channelListRequester->channelListResult(Status::Ok, thisPtr, freeze(channelNames), false);
306  return thisPtr;
307  }
A holder for a contiguous piece of memory.
Definition: sharedVector.h:27
static Status Ok
Definition: status.h:47
A lock for multithreading.
Definition: lock.h:36
void push_back(param_type v)
Definition: sharedVector.h:602
void reserve(size_t i)
Set array capacity.
Definition: sharedVector.h:428
virtual Channel::shared_pointer epics::pvAccess::RPCChannelProvider::createChannel ( std::string const &  name,
ChannelRequester::shared_pointer const &  requester,
short  priority 
)
inlinevirtual

See longer form

Reimplemented from epics::pvAccess::ChannelProvider.

Definition at line 309 of file rpcServer.cpp.

313  {
314  RPCServiceAsync::shared_pointer service;
315 
316  RPCServiceMap::const_iterator iter;
317  {
318  Lock guard(m_mutex);
319  iter = m_services.find(channelName);
320  }
321  if (iter != m_services.end())
322  service = iter->second;
323 
324  // check for wild services
325  if (!service)
326  service = findWildService(channelName);
327 
328  if (!service)
329  {
330  Channel::shared_pointer nullChannel;
331  channelRequester->channelCreated(noSuchChannelStatus, nullChannel);
332  return nullChannel;
333  }
334 
335  // TODO use std::make_shared
336  std::tr1::shared_ptr<RPCChannel> tp(
337  new RPCChannel(
338  shared_from_this(),
339  channelName,
340  channelRequester,
341  service));
342  Channel::shared_pointer rpcChannel = tp;
343  channelRequester->channelCreated(Status::Ok, rpcChannel);
344  return rpcChannel;
345  }
static Status Ok
Definition: status.h:47
A lock for multithreading.
Definition: lock.h:36
if(yy_init)
Definition: scan.c:972
static const Status noSuchChannelStatus
Definition: rpcServer.cpp:253
virtual Channel::shared_pointer epics::pvAccess::RPCChannelProvider::createChannel ( std::string const &  name,
ChannelRequester::shared_pointer const &  requester,
short  priority,
std::string const &  address 
)
inlinevirtual

Request a Channel.

Channel creation is immediate. ChannelRequester::channelCreated() will be called before returning. The shared_ptr which is passed to channelCreated() will also be returned.

Failures during channel creation are delivered to ChannelRequester::channelCreated() with Status::isSuccess()==false.

Postcondition
The returned Channel will hold a strong reference to the provided ChannelRequester and to the ChannelProvider through which it is created.
The shared_ptr passed to ChannelRequester::channelCreated() is unique. See providers_ownership_unique
The new Channel will not hold a strong reference to this ChannelProvider. This provider must be kept alive in order to keep the Channel from being destoryed.
Parameters
nameThe name of the channel.
requesterWill receive notifications about channel state changes
prioritychannel priority, must be PRIORITY_MIN <= priority <= PRIORITY_MAX.
addressImplementation dependent condition. eg. A network address to bypass the search phase. Pass an empty() string for default behavour.
Returns
A non-NULL Channel unless channelCreated() called with an Error

Implements epics::pvAccess::ChannelProvider.

Definition at line 347 of file rpcServer.cpp.

352  {
353  // this will never get called by the pvAccess server
354  throw std::runtime_error("not supported");
355  }
virtual void epics::pvAccess::RPCChannelProvider::destroy ( )
inlinevirtual

Destroy this instance.

Implements epics::pvAccess::Destroyable.

Definition at line 271 of file rpcServer.cpp.

271 {}
virtual std::tr1::shared_ptr<ChannelProvider> epics::pvAccess::RPCChannelProvider::getChannelProvider ( )
inlinevirtual

Implements epics::pvAccess::ChannelFind.

Definition at line 264 of file rpcServer.cpp.

265  {
266  return shared_from_this();
267  }
virtual string epics::pvAccess::RPCChannelProvider::getProviderName ( )
inlinevirtual

Get the provider name.

Returns
The name.

Implements epics::pvAccess::ChannelProvider.

Definition at line 260 of file rpcServer.cpp.

260  {
261  return PROVIDER_NAME;
262  }
static const string PROVIDER_NAME
Definition: rpcServer.cpp:251
epics::pvAccess::RPCChannelProvider::POINTER_DEFINITIONS ( RPCChannelProvider  )
void epics::pvAccess::RPCChannelProvider::registerService ( std::string const &  serviceName,
RPCServiceAsync::shared_pointer const &  service 
)
inline

Definition at line 357 of file rpcServer.cpp.

358  {
359  Lock guard(m_mutex);
360  m_services[serviceName] = service;
361 
362  if (isWildcardPattern(serviceName))
363  m_wildServices.push_back(std::make_pair(serviceName, service));
364  }
A lock for multithreading.
Definition: lock.h:36
void epics::pvAccess::RPCChannelProvider::unregisterService ( std::string const &  serviceName)
inline

Definition at line 366 of file rpcServer.cpp.

367  {
368  Lock guard(m_mutex);
369  m_services.erase(serviceName);
370 
371  if (isWildcardPattern(serviceName))
372  {
373  for (RPCWildServiceList::iterator iter = m_wildServices.begin();
374  iter != m_wildServices.end();
375  iter++)
376  if (iter->first == serviceName)
377  {
378  m_wildServices.erase(iter);
379  break;
380  }
381  }
382  }
A lock for multithreading.
Definition: lock.h:36

Member Data Documentation

const Status epics::pvAccess::RPCChannelProvider::noSuchChannelStatus
static

Definition at line 253 of file rpcServer.cpp.

const string epics::pvAccess::RPCChannelProvider::PROVIDER_NAME
static

Definition at line 251 of file rpcServer.cpp.


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