pvAccessCPP  7.1.7
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
pvAccess.h
1 
7 #ifndef PVACCESS_H
8 #define PVACCESS_H
9 
10 #include <vector>
11 #include <set>
12 
13 #ifdef epicsExportSharedSymbols
14 # define pvAccessEpicsExportSharedSymbols
15 # undef epicsExportSharedSymbols
16 #endif
17 
18 #include <pv/pvData.h>
19 #include <pv/createRequest.h>
20 #include <pv/status.h>
21 #include <pv/bitSet.h>
22 
23 #ifdef pvAccessEpicsExportSharedSymbols
24 # define epicsExportSharedSymbols
25 # undef pvAccessEpicsExportSharedSymbols
26 #endif
27 
28 #include <pv/pvaVersion.h>
29 #include <pv/destroyable.h>
30 #include <pv/monitor.h>
31 
32 #include <shareLib.h>
33 
34 /* C++11 keywords
35  @code
36  struct Base {
37  virtual void foo();
38  };
39  struct Class : public Base {
40  virtual void foo() OVERRIDE FINAL;
41  };
42  @endcode
43  */
44 #ifndef FINAL
45 # if __cplusplus>=201103L
46 # define FINAL final
47 # else
48 # define FINAL
49 # endif
50 #endif
51 #ifndef OVERRIDE
52 # if __cplusplus>=201103L
53 # define OVERRIDE override
54 # else
55 # define OVERRIDE
56 # endif
57 #endif
58 
59 namespace epics {
61 namespace pvAccess {
62 class Configuration;
63 
64 using epics::pvData::Requester;
65 using epics::pvData::RequesterPtr;
66 using epics::pvData::MessageType;
67 using epics::pvData::getMessageTypeName;
68 
69 // TODO add write-only?
70 // change names
84 };
85 
86 
90 class epicsShareClass Lockable
91 {
92 public:
93  POINTER_DEFINITIONS(Lockable);
94 
95  virtual ~Lockable() {}
96 
97  virtual void lock() {}
98  virtual void unlock() {}
99 };
100 
104 class epicsShareClass ScopedLock {
105  EPICS_NOT_COPYABLE(ScopedLock)
106 public:
107 
108  explicit ScopedLock(Lockable::shared_pointer const & li)
109  : lockable(li), locked(true) {
110  lockable->lock();
111  }
112 
113  ~ScopedLock() {
114  unlock();
115  }
116 
117  void lock() {
118  if(!locked) {
119  lockable->lock();
120  locked = true;
121  }
122  }
123 
124  void unlock() {
125  if(locked) {
126  lockable->unlock();
127  locked=false;
128  }
129  }
130 
131  bool ownsLock() const {
132  return locked;
133  }
134 
135 private:
136 
137  Lockable::shared_pointer const lockable;
138  bool locked;
139 };
140 
141 class Channel;
142 class ChannelProvider;
144 class ChannelFindRequester;
145 class ChannelGetRequester;
147 class ChannelPutRequester;
149 class ChannelRPCRequester;
150 
156 struct epicsShareClass NetStats {
157  struct Counter {
158  size_t tx, rx;
159 
160  inline Counter() :tx(0u), rx(0u) {}
161  };
162  struct Stats {
163  std::string transportPeer;
164  Counter transportBytes;
165  Counter operationBytes;
166  bool populated;
167 
168  inline Stats() :populated(false) {}
169  };
170 
171  virtual ~NetStats();
173  virtual void stats(Stats& s) const =0;
174 };
175 
177 struct epicsShareClass ChannelBaseRequester : virtual public epics::pvData::Requester
178 {
179  POINTER_DEFINITIONS(ChannelBaseRequester);
180 
181  static size_t num_instances;
182 
184  virtual ~ChannelBaseRequester();
185 
198  virtual void channelDisconnect(bool destroy) {}
199 
200 private:
203 };
204 
208 class epicsShareClass ChannelRequest : public virtual Destroyable, public Lockable {
209 public:
210  POINTER_DEFINITIONS(ChannelRequest);
211 
212  static size_t num_instances;
213 
214  ChannelRequest();
215  virtual ~ChannelRequest();
216 
221  virtual std::tr1::shared_ptr<Channel> getChannel() = 0;
222 
231  virtual void cancel() = 0;
232 
237  virtual void lastRequest() = 0;
238 
239 private:
240  EPICS_NOT_COPYABLE(ChannelRequest)
241 };
242 
249 class epicsShareClass MonitorRequester : public ChannelBaseRequester {
250  public:
251  POINTER_DEFINITIONS(MonitorRequester);
252  typedef Monitor operation_type;
253 
254  virtual ~MonitorRequester(){}
263  virtual void monitorConnect(epics::pvData::Status const & status,
264  MonitorPtr const & monitor, epics::pvData::StructureConstPtr const & structure) = 0;
271  virtual void monitorEvent(MonitorPtr const & monitor) = 0;
276  virtual void unlisten(MonitorPtr const & monitor) = 0;
277 };
278 
283 class epicsShareClass ChannelArray : public ChannelRequest {
284 public:
285  POINTER_DEFINITIONS(ChannelArray);
287 
288  virtual ~ChannelArray() {}
289 
301  virtual void putArray(
302  epics::pvData::PVArray::shared_pointer const & putArray,
303  size_t offset = 0, size_t count = 0, size_t stride = 1) = 0;
304 
315  virtual void getArray(size_t offset = 0, size_t count = 0, size_t stride = 1) = 0;
316 
320  virtual void getLength() = 0;
321 
326  virtual void setLength(size_t length) = 0;
327 };
328 
332 class epicsShareClass ChannelArrayRequester : public ChannelBaseRequester {
333 public:
334  POINTER_DEFINITIONS(ChannelArrayRequester);
336 
337  virtual ~ChannelArrayRequester() {}
338 
347  virtual void channelArrayConnect(
348  const epics::pvData::Status& status,
349  ChannelArray::shared_pointer const & channelArray,
350  epics::pvData::Array::const_shared_pointer const & array) = 0;
351 
360  virtual void putArrayDone(
361  const epics::pvData::Status& status,
362  ChannelArray::shared_pointer const & channelArray) = 0;
363 
374  virtual void getArrayDone(
375  const epics::pvData::Status& status,
376  ChannelArray::shared_pointer const & channelArray,
377  epics::pvData::PVArray::shared_pointer const & pvArray) = 0;
378 
385  virtual void getLengthDone(
386  const epics::pvData::Status& status,
387  ChannelArray::shared_pointer const & channelArray,
388  size_t length) = 0;
389 
395  virtual void setLengthDone(
396  const epics::pvData::Status& status,
397  ChannelArray::shared_pointer const & channelArray) = 0;
398 };
399 
400 
404 class epicsShareClass ChannelFind : public Destroyable {
405  EPICS_NOT_COPYABLE(ChannelFind)
406 public:
407  POINTER_DEFINITIONS(ChannelFind);
408  typedef ChannelFindRequester requester_type;
409 
410  ChannelFind() {}
411  virtual ~ChannelFind() {}
412 
413  virtual std::tr1::shared_ptr<ChannelProvider> getChannelProvider() = 0;
414  virtual void cancel() = 0;
415 
418  static ChannelFind::shared_pointer buildDummy(const std::tr1::shared_ptr<ChannelProvider>& provider);
419 };
420 
421 struct PeerInfo; // see pv/security.h
422 
426 class epicsShareClass ChannelFindRequester {
427 public:
428  POINTER_DEFINITIONS(ChannelFindRequester);
429  typedef ChannelFind operation_type;
430 
431  virtual ~ChannelFindRequester() {}
432 
436  virtual void channelFindResult(
437  const epics::pvData::Status& status,
438  ChannelFind::shared_pointer const & channelFind,
439  bool wasFound) = 0;
440 
462  virtual std::tr1::shared_ptr<const PeerInfo> getPeerInfo()
463  { return std::tr1::shared_ptr<const PeerInfo>(); }
464 };
465 
469 class epicsShareClass ChannelListRequester {
470 public:
471  POINTER_DEFINITIONS(ChannelListRequester);
472  typedef ChannelFind operation_type;
473 
474  virtual ~ChannelListRequester() {}
475 
479  virtual void channelListResult(
480  const epics::pvData::Status& status,
481  ChannelFind::shared_pointer const & channelFind,
482  epics::pvData::PVStringArray::const_svector const & channelNames,
483  bool hasDynamic) = 0;
484 };
485 
489 class epicsShareClass ChannelGet : public ChannelRequest {
490 public:
491  POINTER_DEFINITIONS(ChannelGet);
493 
494  virtual ~ChannelGet() {}
495 
504  virtual void get() = 0;
505 };
506 
507 
511 class epicsShareClass ChannelGetRequester : public ChannelBaseRequester {
512 public:
513  POINTER_DEFINITIONS(ChannelGetRequester);
514  typedef ChannelGet operation_type;
515 
516  virtual ~ChannelGetRequester() {}
517 
524  virtual void channelGetConnect(
525  const epics::pvData::Status& status,
526  ChannelGet::shared_pointer const & channelGet,
527  epics::pvData::Structure::const_shared_pointer const & structure) = 0;
528 
540  virtual void getDone(
541  const epics::pvData::Status& status,
542  ChannelGet::shared_pointer const & channelGet,
543  epics::pvData::PVStructure::shared_pointer const & pvStructure,
544  epics::pvData::BitSet::shared_pointer const & bitSet) = 0;
545 };
546 
547 
551 class epicsShareClass ChannelProcess : public ChannelRequest {
552 public:
553  POINTER_DEFINITIONS(ChannelProcess);
555 
556  virtual ~ChannelProcess() {}
557 
562  virtual void process() = 0;
563 };
564 
565 
569 class epicsShareClass ChannelProcessRequester : public ChannelBaseRequester {
570 public:
571  POINTER_DEFINITIONS(ChannelProcessRequester);
573 
574  virtual ~ChannelProcessRequester() {}
575 
582  virtual void channelProcessConnect(
583  const epics::pvData::Status& status,
584  ChannelProcess::shared_pointer const & channelProcess) = 0;
585 
591  virtual void processDone(
592  const epics::pvData::Status& status,
593  ChannelProcess::shared_pointer const & channelProcess) = 0;
594 };
595 
596 
600 class epicsShareClass ChannelPut : public ChannelRequest {
601 public:
602  POINTER_DEFINITIONS(ChannelPut);
604 
605  virtual ~ChannelPut() {}
606 
619  virtual void put(
620  epics::pvData::PVStructure::shared_pointer const & pvPutStructure,
621  epics::pvData::BitSet::shared_pointer const & putBitSet) = 0;
622 
628  virtual void get() = 0;
629 
630 };
631 
635 class epicsShareClass ChannelPutRequester : public ChannelBaseRequester {
636 public:
637  POINTER_DEFINITIONS(ChannelPutRequester);
638  typedef ChannelPut operation_type;
639 
640  virtual ~ChannelPutRequester() {}
641 
648  virtual void channelPutConnect(
649  const epics::pvData::Status& status,
650  ChannelPut::shared_pointer const & channelPut,
651  epics::pvData::Structure::const_shared_pointer const & structure) = 0;
652 
658  virtual void putDone(
659  const epics::pvData::Status& status,
660  ChannelPut::shared_pointer const & channelPut) = 0;
661 
672  virtual void getDone(
673  const epics::pvData::Status& status,
674  ChannelPut::shared_pointer const & channelPut,
675  epics::pvData::PVStructure::shared_pointer const & pvStructure,
676  epics::pvData::BitSet::shared_pointer const & bitSet) = 0;
677 };
678 
679 
684 class epicsShareClass ChannelPutGet : public ChannelRequest {
685 public:
686  POINTER_DEFINITIONS(ChannelPutGet);
688 
689  virtual ~ChannelPutGet() {}
690 
697  virtual void putGet(
698  epics::pvData::PVStructure::shared_pointer const & pvPutStructure,
699  epics::pvData::BitSet::shared_pointer const & putBitSet) = 0;
700 
705  virtual void getPut() = 0;
706 
711  virtual void getGet() = 0;
712 };
713 
714 
718 class epicsShareClass ChannelPutGetRequester : public ChannelBaseRequester
719 {
720 public:
721  POINTER_DEFINITIONS(ChannelPutGetRequester);
723 
724  virtual ~ChannelPutGetRequester() {}
725 
733  virtual void channelPutGetConnect(
734  const epics::pvData::Status& status,
735  ChannelPutGet::shared_pointer const & channelPutGet,
736  epics::pvData::Structure::const_shared_pointer const & putStructure,
737  epics::pvData::Structure::const_shared_pointer const & getStructure) = 0;
738 
746  virtual void putGetDone(
747  const epics::pvData::Status& status,
748  ChannelPutGet::shared_pointer const & channelPutGet,
749  epics::pvData::PVStructure::shared_pointer const & pvGetStructure,
750  epics::pvData::BitSet::shared_pointer const & getBitSet) = 0;
751 
759  virtual void getPutDone(
760  const epics::pvData::Status& status,
761  ChannelPutGet::shared_pointer const & channelPutGet,
762  epics::pvData::PVStructure::shared_pointer const & pvPutStructure,
763  epics::pvData::BitSet::shared_pointer const & putBitSet) = 0;
764 
772  virtual void getGetDone(
773  const epics::pvData::Status& status,
774  ChannelPutGet::shared_pointer const & channelPutGet,
775  epics::pvData::PVStructure::shared_pointer const & pvGetStructure,
776  epics::pvData::BitSet::shared_pointer const & getBitSet) = 0;
777 };
778 
779 
783 class epicsShareClass ChannelRPC : public ChannelRequest {
784 public:
785  POINTER_DEFINITIONS(ChannelRPC);
787 
788  virtual ~ChannelRPC() {}
789 
804  virtual void request(epics::pvData::PVStructure::shared_pointer const & pvArgument) = 0;
805 };
806 
807 
813 class epicsShareClass ChannelRPCRequester : public ChannelBaseRequester {
814 public:
815  POINTER_DEFINITIONS(ChannelRPCRequester);
816  typedef ChannelRPC operation_type;
817 
818  virtual ~ChannelRPCRequester() {}
819 
830  virtual void channelRPCConnect(
831  const epics::pvData::Status& status,
832  ChannelRPC::shared_pointer const & operation) = 0;
833 
843  virtual void requestDone(
844  const epics::pvData::Status& status,
845  ChannelRPC::shared_pointer const & operation,
846  epics::pvData::PVStructure::shared_pointer const & pvResponse) = 0;
847 };
848 
849 
853 class epicsShareClass GetFieldRequester : public ChannelBaseRequester {
854 public:
855  POINTER_DEFINITIONS(GetFieldRequester);
856 
857  virtual ~GetFieldRequester() {}
858 
867  virtual void getDone(
868  const epics::pvData::Status& status,
869  epics::pvData::FieldConstPtr const & field) = 0; // TODO naming convention
870 
871 };
872 
873 class ChannelRequester;
874 
886 class epicsShareClass Channel :
887  public Requester,
888  public Destroyable
889 {
890  EPICS_NOT_COPYABLE(Channel)
891 public:
892  POINTER_DEFINITIONS(Channel);
894 
895  static size_t num_instances;
896 
897  Channel();
898  virtual ~Channel();
899 
900  virtual std::string getRequesterName();
901  virtual void message(std::string const & message, epics::pvData::MessageType messageType);
902 
907  NEVER_CONNECTED, CONNECTED, DISCONNECTED, DESTROYED
908  };
909 
910  static const char* ConnectionStateNames[];
911 
916  virtual std::tr1::shared_ptr<ChannelProvider> getProvider() = 0;
917 
927  virtual std::string getRemoteAddress() = 0;
928 
932  virtual ConnectionState getConnectionState();
933 
937  virtual std::string getChannelName() = 0;
938 
944  virtual std::tr1::shared_ptr<ChannelRequester> getChannelRequester() = 0;
945 
949  virtual bool isConnected();
950 
961  virtual void getField(GetFieldRequester::shared_pointer const & requester,std::string const & subField);
962 
969  virtual AccessRights getAccessRights(epics::pvData::PVField::shared_pointer const & pvField);
970 
988  virtual ChannelProcess::shared_pointer createChannelProcess(
989  ChannelProcessRequester::shared_pointer const & requester,
990  epics::pvData::PVStructure::shared_pointer const & pvRequest);
991 
1009  virtual ChannelGet::shared_pointer createChannelGet(
1010  ChannelGetRequester::shared_pointer const & requester,
1011  epics::pvData::PVStructure::shared_pointer const & pvRequest);
1012 
1030  virtual ChannelPut::shared_pointer createChannelPut(
1031  ChannelPutRequester::shared_pointer const & requester,
1032  epics::pvData::PVStructure::shared_pointer const & pvRequest);
1033 
1051  virtual ChannelPutGet::shared_pointer createChannelPutGet(
1052  ChannelPutGetRequester::shared_pointer const & requester,
1053  epics::pvData::PVStructure::shared_pointer const & pvRequest);
1054 
1072  virtual ChannelRPC::shared_pointer createChannelRPC(
1073  ChannelRPCRequester::shared_pointer const & requester,
1074  epics::pvData::PVStructure::shared_pointer const & pvRequest);
1075 
1093  virtual Monitor::shared_pointer createMonitor(
1094  MonitorRequester::shared_pointer const & requester,
1095  epics::pvData::PVStructure::shared_pointer const & pvRequest);
1096 
1119  virtual ChannelArray::shared_pointer createChannelArray(
1120  ChannelArrayRequester::shared_pointer const & requester,
1121  epics::pvData::PVStructure::shared_pointer const & pvRequest);
1122 
1126  virtual void printInfo() { printInfo(std::cout); }
1127 
1132  virtual void printInfo(std::ostream& out) {}
1133 };
1134 
1135 
1141 class epicsShareClass ChannelRequester : public virtual Requester
1142 {
1144  ChannelRequester& operator=(const ChannelRequester&);
1145 public:
1146  POINTER_DEFINITIONS(ChannelRequester);
1147  typedef Channel operation_type;
1148 
1149  static size_t num_instances;
1150 
1151  ChannelRequester();
1152  virtual ~ChannelRequester();
1153 
1174  virtual void channelCreated(const epics::pvData::Status& status, Channel::shared_pointer const & channel) = 0;
1175 
1185  virtual void channelStateChange(Channel::shared_pointer const & channel, Channel::ConnectionState connectionState) = 0;
1186 
1205  virtual std::tr1::shared_ptr<const PeerInfo> getPeerInfo();
1206 };
1207 
1209 struct epicsShareClass DefaultChannelRequester : public ChannelRequester
1210 {
1211  virtual ~DefaultChannelRequester() {}
1212  virtual std::string getRequesterName() OVERRIDE FINAL;
1213  virtual void channelCreated(const epics::pvData::Status& status, Channel::shared_pointer const & channel) OVERRIDE FINAL;
1214  virtual void channelStateChange(Channel::shared_pointer const & channel, Channel::ConnectionState connectionState) OVERRIDE FINAL;
1215  static ChannelRequester::shared_pointer build();
1216 };
1217 
1222  IMMEDIATE, DELAYED, USER_CONTROLED
1223 };
1224 
1230 class epicsShareClass ChannelProvider : public Destroyable
1231 {
1232  EPICS_NOT_COPYABLE(ChannelProvider)
1233 public:
1234  POINTER_DEFINITIONS(ChannelProvider);
1235 
1237  static const short PRIORITY_MIN = 0;
1239  static const short PRIORITY_MAX = 99;
1241  static const short PRIORITY_DEFAULT = PRIORITY_MIN;
1243  static const short PRIORITY_LINKS_DB = PRIORITY_MAX;
1245  static const short PRIORITY_ARCHIVE = (PRIORITY_MAX + PRIORITY_MIN) / 2;
1247  static const short PRIORITY_OPI = PRIORITY_MIN;
1248 
1249  static size_t num_instances;
1250 
1251  ChannelProvider();
1252  virtual ~ChannelProvider();
1253 
1258  virtual std::string getProviderName() = 0;
1259 
1270  virtual ChannelFind::shared_pointer channelFind(std::string const & name,
1271  ChannelFindRequester::shared_pointer const & requester) = 0;
1272 
1282  virtual ChannelFind::shared_pointer channelList(ChannelListRequester::shared_pointer const & requester);
1283 
1287  virtual Channel::shared_pointer createChannel(std::string const & name,
1288  ChannelRequester::shared_pointer const & requester = DefaultChannelRequester::build(),
1289  short priority = PRIORITY_DEFAULT);
1290 
1314  virtual Channel::shared_pointer createChannel(std::string const & name,ChannelRequester::shared_pointer const & requester,
1315  short priority, std::string const & address) = 0;
1316 };
1317 
1321 class epicsShareClass ChannelProviderFactory {
1322  EPICS_NOT_COPYABLE(ChannelProviderFactory)
1323 public:
1324  POINTER_DEFINITIONS(ChannelProviderFactory);
1325 
1327  virtual ~ChannelProviderFactory() {}
1328 
1333  virtual std::string getFactoryName() = 0;
1334 
1339  virtual ChannelProvider::shared_pointer sharedInstance() = 0;
1340 
1345  virtual ChannelProvider::shared_pointer newInstance() {
1346  return newInstance(std::tr1::shared_ptr<Configuration>());
1347  }
1348 
1353  virtual ChannelProvider::shared_pointer newInstance(const std::tr1::shared_ptr<Configuration>&) {
1354  throw std::logic_error("This ChannelProviderFactory does not support non-default configurations");
1355  }
1356 };
1357 
1361 template<class Provider>
1363 {
1364  SimpleChannelProviderFactory(const std::string& name) :pname(name) {}
1365  virtual ~SimpleChannelProviderFactory() {}
1366 
1367  virtual std::string getFactoryName() OVERRIDE FINAL { return pname; }
1368 
1369  virtual ChannelProvider::shared_pointer sharedInstance() OVERRIDE FINAL
1370  {
1371  epics::pvData::Lock L(sharedM);
1372  ChannelProvider::shared_pointer ret(shared.lock());
1373  if(!ret) {
1374  std::tr1::shared_ptr<Provider> inst(new Provider(std::tr1::shared_ptr<Configuration>()));
1375  shared = ret = inst;
1376  }
1377  return ret;
1378  }
1379 
1380  virtual ChannelProvider::shared_pointer newInstance(const std::tr1::shared_ptr<Configuration>& conf) OVERRIDE FINAL
1381  {
1382  std::tr1::shared_ptr<Provider> ret(new Provider(conf));
1383  return ret;
1384  }
1385 
1386 private:
1387  const std::string pname;
1388  epics::pvData::Mutex sharedM;
1389  ChannelProvider::weak_pointer shared;
1390 };
1391 
1396 template<class Provider>
1398 {
1400  const std::tr1::shared_ptr<const Configuration>& conf = std::tr1::shared_ptr<const Configuration>())
1401  :pname(name), config(conf)
1402  {}
1403  virtual ~SingletonChannelProviderFactory() {}
1404 
1405  virtual std::string getFactoryName() OVERRIDE FINAL { return pname; }
1406 
1407  virtual ChannelProvider::shared_pointer sharedInstance() OVERRIDE FINAL
1408  {
1409  epics::pvData::Lock L(sharedM);
1410  ChannelProvider::shared_pointer ret(shared.lock());
1411  if(!ret) {
1412  std::tr1::shared_ptr<Provider> inst(new Provider(config));
1413  shared = ret = inst;
1414  }
1415  return ret;
1416  }
1417 
1418  virtual ChannelProvider::shared_pointer newInstance(const std::tr1::shared_ptr<Configuration>& conf) OVERRIDE FINAL
1419  {
1420  (void)conf; // ignore and use our Configuration
1421  return sharedInstance();
1422  }
1423 private:
1424  const std::string pname;
1425  epics::pvData::Mutex sharedM;
1426  ChannelProvider::weak_pointer shared;
1427  const std::tr1::shared_ptr<const Configuration> config;
1428 };
1429 
1433 class epicsShareClass ChannelProviderRegistry {
1434 public:
1435  POINTER_DEFINITIONS(ChannelProviderRegistry);
1436 
1438 
1439  virtual ~ChannelProviderRegistry() {}
1440 
1441 
1443  static ChannelProviderRegistry::shared_pointer build();
1448  static ChannelProviderRegistry::shared_pointer clients();
1453  static ChannelProviderRegistry::shared_pointer servers();
1454 
1460  ChannelProvider::shared_pointer getProvider(std::string const & providerName);
1461 
1467  ChannelProvider::shared_pointer createProvider(std::string const & providerName,
1468  const std::tr1::shared_ptr<Configuration>& conf = std::tr1::shared_ptr<Configuration>());
1469 
1475  virtual ChannelProviderFactory::shared_pointer getFactory(std::string const & providerName);
1476 
1481  virtual void getProviderNames(provider_name_set& names);
1482 
1485  virtual bool add(const ChannelProviderFactory::shared_pointer& fact, bool replace=true);
1486 
1488  template<class Provider>
1489  ChannelProviderFactory::shared_pointer add(const std::string& name, bool replace=true)
1490  {
1492  typename Factory::shared_pointer fact(new Factory(name));
1493  return add(fact, replace) ? fact : typename Factory::shared_pointer();
1494  }
1495 
1496  typedef ChannelProvider::shared_pointer (*factoryfn_t)(const std::tr1::shared_ptr<Configuration>&);
1497 
1498  ChannelProviderFactory::shared_pointer add(const std::string& name, factoryfn_t, bool replace=true);
1499 
1501  template<class Provider>
1502  ChannelProviderFactory::shared_pointer addSingleton(const std::string& name,
1503  const std::tr1::shared_ptr<const Configuration>& conf = std::tr1::shared_ptr<const Configuration>(),
1504  bool replace=true)
1505  {
1507  typename Factory::shared_pointer fact(new Factory(name, conf));
1508  return add(fact, replace) ? fact : typename Factory::shared_pointer();
1509  }
1510 
1515  ChannelProviderFactory::shared_pointer addSingleton(const ChannelProvider::shared_pointer& provider,
1516  bool replace=true);
1517 
1519  ChannelProviderFactory::shared_pointer remove(const std::string& name);
1520 
1522  virtual bool remove(const ChannelProviderFactory::shared_pointer& factory);
1523 
1525  virtual void clear();
1526 
1527 private:
1528  // ctor is hidden to ensure explict compile errors from a hypothetical sub-class
1529  // we no longer support sub-classing by outside code
1531  friend struct CompatRegistry;
1532 
1533  epics::pvData::Mutex mutex;
1535  providers_t providers;
1536 };
1537 
1538 /* Deprecated in favor of either ChannelProviderRegistry::clients() or ChannelProviderRegistry::servers()
1539  *
1540  * These functions have been removed as a signal that the shared_ptr ownership symantics of ChannelProvider
1541  * and friends has changed.
1542  */
1543 #if __GNUC__>4 || (__GNUC__==4&&__GNUC_MINOR__>=3)
1544 
1545 #define gCPRMSG __attribute__((error("ChannelProvider shared_ptr ownership rules have changed.")))
1546 
1547 epicsShareFunc ChannelProviderRegistry::shared_pointer getChannelProviderRegistry() gCPRMSG;
1548 // Shorthand for getChannelProviderRegistry()->add(channelProviderFactory);
1549 epicsShareFunc void registerChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory) gCPRMSG;
1550 // Shorthand for getChannelProviderRegistry()->remove(channelProviderFactory);
1551 epicsShareFunc void unregisterChannelProviderFactory(ChannelProviderFactory::shared_pointer const & channelProviderFactory) gCPRMSG;
1552 // Shorthand for getChannelProviderRegistry()->clear();
1553 epicsShareFunc void unregisterAllChannelProviderFactory() gCPRMSG;
1554 
1555 #undef gCPRMSG
1556 
1557 #endif // __GNUC__
1558 
1564 
1565 
1566 }
1567 }
1568 
1569 // compatibility
1570 namespace epics { namespace pvData {
1572 }}
1573 
1574 
1575 #endif /* PVACCESS_H */
1576 
Both read and write access are allowed.
Definition: pvAccess.h:83
Expose statistics related to network transport.
Definition: pvAccess.h:156
Read access is allowed but write access is not allowed.
Definition: pvAccess.h:79
ChannelProviderFactory::shared_pointer addSingleton(const std::string &name, const std::tr1::shared_ptr< const Configuration > &conf=std::tr1::shared_ptr< const Configuration >(), bool replace=true)
Add a new Provider which will be built using SingletonChannelProviderFactory&lt;Provider&gt; ...
Definition: pvAccess.h:1502
Requester for ChannelPut.
Definition: pvAccess.h:635
virtual std::string getFactoryName()
Get factory name (i.e.
Definition: pvAccess.h:1367
FlushStrategy
The FlushStrategy enum.
Definition: pvAccess.h:1221
ConnectionState
Channel connection status.
Definition: pvAccess.h:906
Base interface for all channel requests (aka.
Definition: pvAccess.h:208
complex< _Tp > & operator=(const _Tp &)
iterator_traits< _InputIterator >::difference_type count(_InputIterator __first, _InputIterator __last, const _Tp &__value)
Requester for ChannelPutGet.
Definition: pvAccess.h:718
virtual ChannelProvider::shared_pointer sharedInstance()
Get a shared instance using the default Configuration.
Definition: pvAccess.h:1407
Neither read or write access is allowed.
Definition: pvAccess.h:75
Callback class for passing messages to a requester.
Definition: requester.h:43
virtual ChannelProvider::shared_pointer newInstance(const std::tr1::shared_ptr< Configuration > &conf)
Create a new instance using a specific Configuration.
Definition: pvAccess.h:1380
virtual std::string getFactoryName()
Get factory name (i.e.
Definition: pvAccess.h:1405
Base for all Requesters (callbacks to client)
Definition: pvAccess.h:177
Access to Monitor subscription and queue.
Definition: monitor.h:69
An instance of a Client or Server.
Definition: pvAccess.h:1230
Requester for channelProcess.
Definition: pvAccess.h:569
ChannelProcess - request that a channel be processed.
Definition: pvAccess.h:551
ChannelProviderFactory::shared_pointer add(const std::string &name, bool replace=true)
Add a new Provider which will be built using SimpleChannelProviderFactory&lt;Provider&gt; ...
Definition: pvAccess.h:1489
Monitor PipelineMonitor
Pipeline (streaming) support API (optional).
Definition: pvAccess.h:1563
virtual void printInfo(std::ostream &out)
Prints detailed information about the context to the specified output stream.
Definition: pvAccess.h:1132
Used when ChannelProvider::createChannel() is passed a NULL ChannelRequester.
Definition: pvAccess.h:1209
void lock(_L1 &__l1, _L2 &__l2, _L3 &...__l3)
ostream cout
Simple ChannelProviderFactory which requires the existance of a ctor Provider(const std::tr1::shared_...
Definition: pvAccess.h:1362
virtual ChannelProvider::shared_pointer sharedInstance()
Get a shared instance using the default Configuration.
Definition: pvAccess.h:1369
ChanneProvider factory interface.
Definition: pvAccess.h:1321
Callback implemented by monitor clients.
Definition: pvAccess.h:249
Handle for an RPC operation.
Definition: pvAccess.h:783
virtual ChannelProvider::shared_pointer newInstance(const std::tr1::shared_ptr< Configuration > &)
Create a new instance using a specific Configuration.
Definition: pvAccess.h:1353
virtual ChannelProvider::shared_pointer newInstance(const std::tr1::shared_ptr< Configuration > &conf)
Create a new instance using a specific Configuration.
Definition: pvAccess.h:1418
Completion notification for Channel::getField()
Definition: pvAccess.h:853
Request to put and get Array Data.
Definition: pvAccess.h:283
The interface through which Operations (get, put, monitor, ...) are initiated.
Definition: pvAccess.h:886
size_t stride() const
Instance declaring destroy method.
Definition: destroyable.h:24
Interface for locating channel providers.
Definition: pvAccess.h:1433
Event notifications associated with Channel life-cycle.
Definition: pvAccess.h:1141
Requester for channelGet.
Definition: pvAccess.h:511
Channel access put/get request.
Definition: pvAccess.h:684
Request to get data from a channel.
Definition: pvAccess.h:489
Interface for a channel access put request.
Definition: pvAccess.h:600
The Requester for a ChannelArray.
Definition: pvAccess.h:332
virtual void channelDisconnect(bool destroy)
Notification when underlying Channel becomes DISCONNECTED or DESTORYED.
Definition: pvAccess.h:198
Notifications associated with Channel::createChannelRPC()
Definition: pvAccess.h:813
virtual ChannelProvider::shared_pointer newInstance()
Create a new instance using the default Configuration.
Definition: pvAccess.h:1345
virtual void printInfo()
Prints detailed information about the context to the standard output stream.
Definition: pvAccess.h:1126
Helper for ChannelProviders which access a singleton resource (eg.
Definition: pvAccess.h:1397
void replace(_ForwardIterator __first, _ForwardIterator __last, const _Tp &__old_value, const _Tp &__new_value)