pva2pva
1.4.2
Toggle main menu visibility
Loading...
Searching...
No Matches
pdbApp
pdbsingle.h
1
#ifndef PDBSINGLE_H
2
#define PDBSINGLE_H
3
4
#include <deque>
5
6
#include <dbAccess.h>
7
#include <dbNotify.h>
8
#include <asLib.h>
9
10
#include <dbEvent.h>
11
12
#include <pv/pvAccess.h>
13
14
#include "helper.h"
15
#include "pvahelper.h"
16
#include "pvif.h"
17
#include "pdb.h"
18
19
struct
PDBSingleMonitor
;
20
21
struct
QSRV_API PDBSinglePV :
public
PDBPV
22
{
23
POINTER_DEFINITIONS(PDBSinglePV);
24
weak_pointer weakself;
25
inline
shared_pointer shared_from_this() {
return
shared_pointer(weakself); }
26
27
/* this dbChannel is shared by all operations,
28
* which is safe as it's modify-able field(s) (addr.pfield)
29
* are only access while the underlying record
30
* is locked.
31
*/
32
DBCH
chan;
33
// used for DBE_PROPERTY subscription when chan has filters
34
DBCH
chan2;
35
PDBProvider::shared_pointer provider;
36
37
// only for use in pdb_single_event()
38
// which is not concurrent for VALUE/PROPERTY.
39
epics::pvData::BitSet scratch;
40
41
epicsMutex lock;
42
43
p2p::auto_ptr<ScalarBuilder> builder;
44
p2p::auto_ptr<PVIF> pvif;
45
46
epics::pvData::PVStructurePtr complete;
// complete copy from subscription
47
48
typedef
std::set<PDBSingleMonitor*> interested_t;
49
bool
interested_iterating;
50
interested_t interested, interested_add;
51
52
typedef
std::set<BaseMonitor::shared_pointer> interested_remove_t;
53
interested_remove_t interested_remove;
54
55
DBEvent
evt_VALUE, evt_PROPERTY;
56
bool
hadevent_VALUE, hadevent_PROPERTY;
57
58
static
size_t
num_instances;
59
60
PDBSinglePV(
DBCH
& chan,
61
const
PDBProvider::shared_pointer& prov);
62
virtual
~PDBSinglePV();
63
64
void
activate();
65
66
virtual
67
epics::pvAccess::Channel::shared_pointer
68
connect(
const
std::tr1::shared_ptr<PDBProvider>& prov,
69
const
epics::pvAccess::ChannelRequester::shared_pointer& req) OVERRIDE FINAL;
70
71
void
addMonitor(
PDBSingleMonitor
*);
72
void
removeMonitor(
PDBSingleMonitor
*);
73
void
finalizeMonitor();
74
};
75
76
struct
PDBSingleChannel :
public
BaseChannel,
77
public
std::tr1::enable_shared_from_this<PDBSingleChannel>
78
{
79
POINTER_DEFINITIONS(PDBSingleChannel);
80
81
PDBSinglePV::shared_pointer pv;
82
// storage referenced from aspvt
83
ASCred
cred;
84
ASCLIENT
aspvt;
85
86
static
size_t
num_instances;
87
88
PDBSingleChannel(
const
PDBSinglePV::shared_pointer& pv,
89
const
epics::pvAccess::ChannelRequester::shared_pointer& req);
90
virtual
~PDBSingleChannel();
91
92
virtual
epics::pvAccess::ChannelPut::shared_pointer createChannelPut(
93
epics::pvAccess::ChannelPutRequester::shared_pointer
const
& requester,
94
epics::pvData::PVStructure::shared_pointer
const
& pvRequest) OVERRIDE FINAL;
95
virtual
epics::pvData::Monitor::shared_pointer createMonitor(
96
epics::pvData::MonitorRequester::shared_pointer
const
& requester,
97
epics::pvData::PVStructure::shared_pointer
const
& pvRequest) OVERRIDE FINAL;
98
99
virtual
void
printInfo(std::ostream& out) OVERRIDE FINAL;
100
};
101
102
struct
PDBSinglePut :
public
epics::pvAccess::ChannelPut,
103
public
std::tr1::enable_shared_from_this<PDBSinglePut>
104
{
105
POINTER_DEFINITIONS(PDBSinglePut);
106
107
typedef
epics::pvAccess::ChannelPutRequester requester_t;
108
PDBSingleChannel::shared_pointer channel;
109
requester_t::weak_pointer requester;
110
111
epics::pvData::BitSetPtr changed, wait_changed;
112
epics::pvData::PVStructurePtr pvf;
113
p2p::auto_ptr<PVIF> pvif, wait_pvif;
114
processNotify notify;
115
int
notifyBusy;
// atomic: 0 - idle, 1 - active, 2 - being cancelled
116
117
// effectively const after ctor
118
PVIF::proc_t doProc;
119
bool
doWait;
120
121
static
size_t
num_instances;
122
123
PDBSinglePut(
const
PDBSingleChannel::shared_pointer& channel,
124
const
epics::pvAccess::ChannelPutRequester::shared_pointer& requester,
125
const
epics::pvData::PVStructure::shared_pointer& pvReq);
126
virtual
~PDBSinglePut();
127
128
virtual
void
destroy() OVERRIDE FINAL { pvif.reset(); channel.reset(); requester.reset(); }
129
virtual
std::tr1::shared_ptr<epics::pvAccess::Channel> getChannel() OVERRIDE FINAL {
return
channel; }
130
virtual
void
cancel() OVERRIDE FINAL;
131
virtual
void
lastRequest() OVERRIDE FINAL {}
132
virtual
void
put(
133
epics::pvData::PVStructure::shared_pointer
const
& pvPutStructure,
134
epics::pvData::BitSet::shared_pointer
const
& putBitSet) OVERRIDE FINAL;
135
virtual
void
get() OVERRIDE FINAL;
136
};
137
138
struct
PDBSingleMonitor :
public
BaseMonitor
139
{
140
POINTER_DEFINITIONS(PDBSingleMonitor);
141
142
const
PDBSinglePV::shared_pointer pv;
143
144
static
size_t
num_instances;
145
146
PDBSingleMonitor(
const
PDBSinglePV::shared_pointer& pv,
147
const
requester_t::shared_pointer& requester,
148
const
epics::pvData::PVStructure::shared_pointer& pvReq);
149
virtual
~PDBSingleMonitor();
150
151
virtual
void
onStart() OVERRIDE FINAL;
152
virtual
void
onStop() OVERRIDE FINAL;
153
virtual
void
requestUpdate
() OVERRIDE FINAL;
154
155
virtual
void
destroy() OVERRIDE FINAL;
156
};
157
158
#endif
// PDBSINGLE_H
ASCLIENT
Definition
pvif.h:107
ASCred
Definition
pvif.h:100
DBCH
Definition
pvif.h:81
DBEvent
Definition
pvif.h:224
PDBSingleMonitor
Definition
pdbsingle.h:139
PDBSingleMonitor::requestUpdate
virtual void requestUpdate() OVERRIDE FINAL
Definition
pdbsingle.cpp:485
Generated by
1.17.0