pva2pva  1.4.1
 All Classes Functions Variables Pages
pdb.h
1 #ifndef PDB_H
2 #define PDB_H
3 
4 #include <dbEvent.h>
5 #include <asLib.h>
6 
7 #include <pv/configuration.h>
8 #include <pv/pvAccess.h>
9 
10 #include "weakmap.h"
11 
12 #include <pv/qsrv.h>
13 
14 struct PDBProvider;
15 
16 struct PDBPV
17 {
18  POINTER_DEFINITIONS(PDBPV);
19 
20  epics::pvData::StructureConstPtr fielddesc;
21 
22  PDBPV() {}
23  virtual ~PDBPV() {}
24 
25  virtual
26  epics::pvAccess::Channel::shared_pointer
27  connect(const std::tr1::shared_ptr<PDBProvider>& prov,
28  const epics::pvAccess::ChannelRequester::shared_pointer& req) =0;
29 
30  // print info to stdout (with iocsh redirection)
31  virtual void show(int lvl) {}
32 };
33 
34 struct QSRV_API PDBProvider : public epics::pvAccess::ChannelProvider,
35  public epics::pvAccess::ChannelFind,
36  public std::tr1::enable_shared_from_this<PDBProvider>
37 {
38  POINTER_DEFINITIONS(PDBProvider);
39 
40  explicit PDBProvider(const epics::pvAccess::Configuration::const_shared_pointer& =epics::pvAccess::Configuration::const_shared_pointer());
41  virtual ~PDBProvider();
42 
43  // ChannelProvider
44  virtual void destroy() OVERRIDE FINAL;
45  virtual std::string getProviderName() OVERRIDE FINAL;
46  virtual epics::pvAccess::ChannelFind::shared_pointer channelFind(std::string const & channelName,
47  epics::pvAccess::ChannelFindRequester::shared_pointer const & channelFindRequester) OVERRIDE FINAL;
48  virtual epics::pvAccess::ChannelFind::shared_pointer channelList(epics::pvAccess::ChannelListRequester::shared_pointer const & channelListRequester) OVERRIDE FINAL;
49  virtual epics::pvAccess::Channel::shared_pointer createChannel(std::string const & channelName,
50  epics::pvAccess::ChannelRequester::shared_pointer const & channelRequester,
51  short priority = PRIORITY_DEFAULT) OVERRIDE FINAL;
52  virtual epics::pvAccess::Channel::shared_pointer createChannel(std::string const & channelName,
53  epics::pvAccess::ChannelRequester::shared_pointer const & channelRequester,
54  short priority, std::string const & address) OVERRIDE FINAL;
55 
56  // ChannelFind
57  virtual std::tr1::shared_ptr<ChannelProvider> getChannelProvider() OVERRIDE FINAL { return shared_from_this(); }
58  virtual void cancel() OVERRIDE FINAL {/* our channelFind() is synchronous, so nothing to cancel */}
59 
60  typedef std::map<std::string, PDBPV::shared_pointer> persist_pv_map_t;
61  persist_pv_map_t persist_pv_map;
62 
64  transient_pv_map_t transient_pv_map;
65 
66  dbEventCtx event_context;
67 
68  typedef std::list<std::string> group_files_t;
69  static group_files_t group_files;
70 
71  static size_t num_instances;
72 };
73 
74 QSRV_API
75 void QSRVRegistrar_counters();
76 
77 class AsWritePvt {
78  void * pvt;
79 public:
80  AsWritePvt() :pvt(NULL) {}
81  explicit AsWritePvt(void * pvt): pvt(pvt) {}
82  ~AsWritePvt() {
83  asTrapWriteAfterWrite(pvt);
84  }
85  void swap(AsWritePvt& o) {
86  std::swap(pvt, o.pvt);
87  }
88 private:
89  AsWritePvt(const AsWritePvt&);
90  AsWritePvt& operator=(const AsWritePvt&);
91 };
92 
93 #endif // PDB_H
Definition: pdb.h:77
Definition: pdb.h:16