This is Unofficial EPICS BASE Doxygen Site
epics::pvDatabase::ChannelProviderLocal Class Reference

ChannelProvider for PVDatabase. More...

#include "channelProviderLocal.h"

+ Inheritance diagram for epics::pvDatabase::ChannelProviderLocal:
+ Collaboration diagram for epics::pvDatabase::ChannelProviderLocal:

Public Member Functions

 POINTER_DEFINITIONS (ChannelProviderLocal)
 
 ChannelProviderLocal ()
 Constructor. More...
 
virtual ~ChannelProviderLocal ()
 Destructor. More...
 
virtual void destroy ()
 DEPRECATED. More...
 
virtual std::string getProviderName ()
 Returns the channel provider name. More...
 
virtual epics::pvAccess::ChannelFind::shared_pointer channelFind (std::string const &channelName, epics::pvAccess::ChannelFindRequester::shared_pointer const &channelFindRequester)
 Returns either a null channelFind or a channelFind for records in the PVDatabase. More...
 
virtual epics::pvAccess::ChannelFind::shared_pointer channelList (epics::pvAccess::ChannelListRequester::shared_pointer const &channelListRequester)
 Calls method channelListRequester::channelListResult. More...
 
virtual epics::pvAccess::Channel::shared_pointer createChannel (std::string const &channelName, epics::pvAccess::ChannelRequester::shared_pointer const &channelRequester, short priority)
 Create a channel for a record. More...
 
virtual epics::pvAccess::Channel::shared_pointer createChannel (std::string const &channelName, epics::pvAccess::ChannelRequester::shared_pointer const &channelRequester, short priority, std::string const &address)
 Create a channel for a record. More...
 
int getTraceLevel ()
 get trace level (0,1,2) means (nothing,lifetime,process) More...
 
void setTraceLevel (int level)
 set trace level (0,1,2) means (nothing,lifetime,process) More...
 
virtual std::tr1::shared_ptr< ChannelProvidergetChannelProvider ()
 ChannelFind method. More...
 
virtual void cancel ()
 ChannelFind method. More...
 
- Public Member Functions inherited from epics::pvAccess::ChannelProvider
 POINTER_DEFINITIONS (ChannelProvider)
 
 ChannelProvider ()
 
virtual ~ChannelProvider ()
 
virtual ChannelFind::shared_pointer channelFind (std::string const &name, ChannelFindRequester::shared_pointer const &requester)=0
 
virtual ChannelFind::shared_pointer channelList (ChannelListRequester::shared_pointer const &requester)
 
virtual Channel::shared_pointer createChannel (std::string const &name, ChannelRequester::shared_pointer const &requester=DefaultChannelRequester::build(), short priority=PRIORITY_DEFAULT)
 
virtual Channel::shared_pointer createChannel (std::string const &name, ChannelRequester::shared_pointer const &requester, short priority, std::string const &address)=0
 
- 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 ()
 

Friends

class ChannelProviderLocalRun
 
epicsShareFunc ChannelProviderLocalPtr getChannelProviderLocal ()
 

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)
 
- 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
 
- Protected Member Functions inherited from epics::pvAccess::Destroyable
virtual ~Destroyable ()
 

Detailed Description

ChannelProvider for PVDatabase.

An implementation of channelProvider that provides access to records in PVDatabase.

Definition at line 54 of file channelProviderLocal.h.

Constructor & Destructor Documentation

epics::pvDatabase::ChannelProviderLocal::ChannelProviderLocal ( )

Constructor.

Definition at line 70 of file channelProviderLocal.cpp.

71 : pvDatabase(PVDatabase::getMaster()),
72  traceLevel(0)
73 {
74  if(traceLevel>0) {
75  cout << "ChannelProviderLocal::ChannelProviderLocal()\n";
76  }
77 }
static PVDatabasePtr getMaster()
Get the master database.
Definition: pvDatabase.cpp:38
epics::pvDatabase::ChannelProviderLocal::~ChannelProviderLocal ( )
virtual

Destructor.

Definition at line 79 of file channelProviderLocal.cpp.

80 {
81  if(traceLevel>0) {
82  cout << "ChannelProviderLocal::~ChannelProviderLocal()\n";
83  }
84 }

Member Function Documentation

virtual void epics::pvDatabase::ChannelProviderLocal::cancel ( )
inlinevirtual

ChannelFind method.

Implements epics::pvAccess::ChannelFind.

Definition at line 158 of file channelProviderLocal.h.

158 {}
ChannelFind::shared_pointer epics::pvDatabase::ChannelProviderLocal::channelFind ( std::string const &  channelName,
epics::pvAccess::ChannelFindRequester::shared_pointer const &  channelFindRequester 
)
virtual

Returns either a null channelFind or a channelFind for records in the PVDatabase.

Parameters
channelNameThe name of the channel desired.
channelFindRequesterThe client callback.
Returns
shared pointer to ChannelFind. This is null if the channelName is not the name of a record in the PVDatabase. It is an implementation of SyncChannelFind if the channelName is the name of a record in the PVDatabase. The interface for SyncChannelFind is defined by pvAccessCPP. The channelFindResult method of channelFindRequester is called before the method returns.

Definition at line 96 of file channelProviderLocal.cpp.

99 {
100  if(traceLevel>1) {
101  cout << "ChannelProviderLocal::channelFind " << "channelName" << endl;
102  }
103  PVDatabasePtr pvdb(pvDatabase.lock());
104  if(!pvdb) {
105  Status notFoundStatus(Status::STATUSTYPE_ERROR,"pvDatabase was deleted");
106  channelFindRequester->channelFindResult(
107  notFoundStatus,
108  shared_from_this(),
109  false);
110  }
111  PVRecordPtr pvRecord = pvdb->findRecord(channelName);
112  if(pvRecord) {
113  channelFindRequester->channelFindResult(
114  Status::Ok,
115  shared_from_this(),
116  true);
117 
118  } else {
119  Status notFoundStatus(Status::STATUSTYPE_ERROR,"pv not found");
120  channelFindRequester->channelFindResult(
121  notFoundStatus,
122  shared_from_this(),
123  false);
124  }
125  return shared_from_this();
126 }
std::tr1::shared_ptr< PVDatabase > PVDatabasePtr
Definition: pvDatabase.h:43
std::tr1::shared_ptr< PVRecord > PVRecordPtr
Definition: pvDatabase.h:21
ChannelFind::shared_pointer epics::pvDatabase::ChannelProviderLocal::channelList ( epics::pvAccess::ChannelListRequester::shared_pointer const &  channelListRequester)
virtual

Calls method channelListRequester::channelListResult.

This provides the caller with a list of the record names on the PVDatabase. A record name is the same as a channel name.

Parameters
channelListRequesterThe client callback.
Returns
shared pointer to ChannelFind. The interface for SyncChannelFind is defined by pvAccessCPP.

Definition at line 128 of file channelProviderLocal.cpp.

130 {
131  if(traceLevel>1) {
132  cout << "ChannelProviderLocal::channelList\n";
133  }
134  PVDatabasePtr pvdb(pvDatabase.lock());
135  if(!pvdb)throw std::logic_error("pvDatabase was deleted");
136  PVStringArrayPtr records(pvdb->getRecordNames());
137  channelListRequester->channelListResult(
138  Status::Ok, shared_from_this(), records->view(), false);
139  return shared_from_this();
140 }
std::tr1::shared_ptr< PVStringArray > PVStringArrayPtr
Definition: pvData.h:1464
std::tr1::shared_ptr< PVDatabase > PVDatabasePtr
Definition: pvDatabase.h:43
virtual epics::pvAccess::Channel::shared_pointer epics::pvDatabase::ChannelProviderLocal::createChannel ( std::string const &  channelName,
epics::pvAccess::ChannelRequester::shared_pointer const &  channelRequester,
short  priority 
)
virtual

Create a channel for a record.

This method just calls the next method with a address of "".

Parameters
channelNameThe name of the channel desired.
channelRequesterThe client callback.
priorityThe priority.
Returns
shared pointer to Channel.
virtual epics::pvAccess::Channel::shared_pointer epics::pvDatabase::ChannelProviderLocal::createChannel ( std::string const &  channelName,
epics::pvAccess::ChannelRequester::shared_pointer const &  channelRequester,
short  priority,
std::string const &  address 
)
virtual

Create a channel for a record.

Parameters
channelNameThe name of the channel desired.
channelRequesterThe callback to call with the result.
priorityThe priority. This is ignored.
addressThe address. This is ignored.
Returns
shared pointer to Channel. This is null if the channelName is not the name of a record in the PVDatabase. Otherwise it is a newly created channel inteface. ChannelRequester::channelCreated is called to give the result.
virtual void epics::pvDatabase::ChannelProviderLocal::destroy ( )
inlinevirtual

DEPRECATED.

Implements epics::pvAccess::Destroyable.

Definition at line 73 of file channelProviderLocal.h.

73 {};
std::tr1::shared_ptr< ChannelProvider > epics::pvDatabase::ChannelProviderLocal::getChannelProvider ( )
virtual

ChannelFind method.

Returns
pointer to self.

Implements epics::pvAccess::ChannelFind.

Definition at line 86 of file channelProviderLocal.cpp.

87 {
88  return shared_from_this();
89 }
string epics::pvDatabase::ChannelProviderLocal::getProviderName ( )
virtual

Returns the channel provider name.

Returns
local

Implements epics::pvAccess::ChannelProvider.

Definition at line 91 of file channelProviderLocal.cpp.

92 {
93  return providerName;
94 }
int epics::pvDatabase::ChannelProviderLocal::getTraceLevel ( )
inline

get trace level (0,1,2) means (nothing,lifetime,process)

Returns
the level

Definition at line 142 of file channelProviderLocal.h.

142 {return traceLevel;}
epics::pvDatabase::ChannelProviderLocal::POINTER_DEFINITIONS ( ChannelProviderLocal  )
void epics::pvDatabase::ChannelProviderLocal::setTraceLevel ( int  level)
inline

set trace level (0,1,2) means (nothing,lifetime,process)

Parameters
levelThe level

Definition at line 147 of file channelProviderLocal.h.

147 {traceLevel = level;}

Friends And Related Function Documentation

friend class ChannelProviderLocalRun
friend

Definition at line 163 of file channelProviderLocal.h.

epicsShareFunc ChannelProviderLocalPtr getChannelProviderLocal ( )
friend

Definition at line 56 of file channelProviderLocal.cpp.

57 {
58  static int firstTime = 1;
59  if (firstTime) {
60  firstTime = 0;
61  ChannelProviderFactory::shared_pointer factory(
62  new LocalChannelProviderFactory());
63  ChannelProviderRegistry::servers()->add(factory);
64  }
65  ChannelProvider::shared_pointer channelProvider =
66  ChannelProviderRegistry::servers()->getProvider(providerName);
68 }
shared_ptr< T > dynamic_pointer_cast(shared_ptr< U > const &r) BOOST_NOEXCEPT
Definition: shared_ptr.hpp:808
GLBLTYPE ELLLIST servers
Definition: server.h:193

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