7 #define EPICS_DBCA_PRIVATE_API
8 #include <epicsGuard.h>
14 #include <initHooks.h>
16 #include <epicsExit.h>
17 #include <epicsAtomic.h>
21 #include <epicsThread.h>
22 #include <epicsMutex.h>
23 #include <epicsEvent.h>
24 #include <dbChannel.h>
25 #include <dbStaticLib.h>
28 #include <epicsVersion.h>
30 #include <pv/status.h>
31 #include <pv/bitSet.h>
32 #include <pv/pvData.h>
34 #include <pva/client.h>
35 #include <pv/anyscalar.h>
36 #include <pv/thread.h>
38 #include <pv/iocshelper.h>
40 #include <pv/sharedPtr.h>
47 QSRV_API
extern int pvaLinkDebug;
48 QSRV_API
extern int pvaLinkIsolate;
49 QSRV_API
extern int pvaLinkNWorkers;
53 # define TRACE(X) std::cerr<<"PVAL "<<__func__<<" " X <<"\n"
55 # define TRACE(X) do {} while(0)
59 #define DEBUG(OBJ, X) do{ if((OBJ)->debug) std::cout X<<"\n"; }while(0)
63 namespace pvd = epics::pvData;
64 namespace pva = epics::pvAccess;
66 typedef epicsGuard<pvd::Mutex> Guard;
67 typedef epicsGuardRelease<pvd::Mutex> UnGuard;
70 struct pvaLinkChannel;
98 bool defer, pipeline, time, retry, local, always;
105 virtual ~pvaLinkConfig();
109 pvac::ClientProvider provider_local,
112 const pvd::PVDataCreatePtr create;
121 typedef std::pair<std::string, std::string> channels_key_t;
123 typedef std::map<channels_key_t, std::tr1::weak_ptr<pvaLinkChannel> > channels_t;
133 public pvac::ClientChannel::PutCallback,
134 public epicsThreadRunable,
135 public std::tr1::enable_shared_from_this<pvaLinkChannel>
137 const pvaGlobal_t::channels_key_t key;
138 const pvd::PVStructure::const_shared_pointer pvRequest;
140 static size_t num_instances;
145 pvac::ClientChannel chan;
146 pvac::Monitor op_mon;
147 pvac::Operation op_put;
149 std::string providerName;
150 size_t num_disconnect, num_type_change;
152 bool connected_latched;
156 std::tr1::shared_ptr<const void> previous_root;
157 typedef std::set<dbCommon*> after_put_t;
158 after_put_t after_put;
164 typedef std::set<pvaLink*, LinkSort> links_t;
173 pvaLinkChannel(
const pvaGlobal_t::channels_key_t& key,
const epics::pvData::PVStructure::const_shared_pointer &pvRequest);
177 void put(
bool force=
false);
180 virtual void monitorEvent(
const pvac::MonitorEvent& evt) OVERRIDE FINAL;
183 virtual void putBuild(
const epics::pvData::StructureConstPtr& build, pvac::ClientChannel::PutCallback::Args& args) OVERRIDE FINAL;
184 virtual void putDone(
const pvac::PutEvent& evt) OVERRIDE FINAL;
186 std::tr1::weak_ptr<pvaLinkChannel> lc;
188 virtual void run() OVERRIDE FINAL;
190 std::tr1::shared_ptr<AfterPut> AP;
192 virtual void run() OVERRIDE FINAL;
193 void run_dbProcess(
size_t idx);
197 std::vector<dbCommon*> scan_records;
198 std::vector<
bool> scan_check_passive;
199 std::vector<epics::pvData::BitSet> scan_changed;
201 DBManyLock atomic_lock;
206 static size_t num_instances;
213 std::tr1::shared_ptr<pvaLinkChannel> lchan;
215 bool used_scratch, used_queue;
216 pvd::shared_vector<const void> put_scratch, put_queue;
220 epics::pvData::PVField::const_shared_pointer fld_value;
221 epics::pvData::PVScalar::const_shared_pointer fld_severity,
224 epics::pvData::PVStructure::const_shared_pointer fld_display,
227 epics::pvData::BitSet proc_changed;
232 epicsTimeStamp snap_time;
239 pvd::PVStructurePtr makeRequest();
244 pvd::PVField::const_shared_pointer getSubField(
const char *name);
std::string channelName
Channel (aka PV) name string.
std::string fieldName
sub-field within addressed PVStructure