5 #ifndef PV_SHAREDSTATE_H
6 #define PV_SHAREDSTATE_H
12 #include <pv/sharedPtr.h>
13 #include <pv/noDefaultMethods.h>
14 #include <pv/bitSet.h>
15 #include <pv/createRequest.h>
17 #include <pva/server.h>
19 namespace epics{
namespace pvData{
25 namespace epics{
namespace pvAccess{
26 class ChannelProvider;
28 class ChannelRequester;
29 struct ChannelBaseRequester;
30 class GetFieldRequester;
31 void providerRegInit(
void*);
38 struct SharedMonitorFIFO;
79 friend struct detail::SharedChannel;
80 friend struct detail::SharedMonitorFIFO;
81 friend struct detail::SharedPut;
82 friend struct detail::SharedRPC;
85 struct epicsShareClass Config {
98 virtual void onFirstConnect(
const SharedPV::shared_pointer& pv) {}
102 virtual void onPut(
const SharedPV::shared_pointer& pv,
Operation& op);
104 virtual void onRPC(
const SharedPV::shared_pointer& pv,
Operation& op);
112 static shared_pointer build(
const std::tr1::shared_ptr<Handler>& handler, Config* conf=0);
114 static shared_pointer buildReadOnly(Config* conf=0);
116 static shared_pointer buildMailbox(Config* conf=0);
118 explicit SharedPV(
const std::tr1::shared_ptr<Handler>& handler, Config* conf);
123 void setHandler(
const std::tr1::shared_ptr<Handler>& handler);
124 Handler::shared_pointer getHandler()
const;
130 void open(
const epics::pvData::PVStructure& value);
138 void open(
const epics::pvData::PVStructure& value,
const epics::pvData::BitSet& valid);
141 void open(
const epics::pvData::StructureConstPtr& type);
153 inline void close(
bool destroy=
false) { realClose(destroy,
true, 0); }
157 std::tr1::shared_ptr<epics::pvData::PVStructure> build();
165 void post(
const epics::pvData::PVStructure& value,
166 const epics::pvData::BitSet& changed);
169 void fetch(epics::pvData::PVStructure& value, epics::pvData::BitSet& valid);
173 virtual std::tr1::shared_ptr<epics::pvAccess::Channel> connect(
174 const std::tr1::shared_ptr<epics::pvAccess::ChannelProvider>& provider,
176 const std::tr1::shared_ptr<epics::pvAccess::ChannelRequester>& requester) OVERRIDE FINAL;
180 void setDebug(
int lvl);
186 friend void epics::pvAccess::providerRegInit(
void*);
187 static size_t num_instances;
189 weak_pointer internal_self;
193 mutable epicsMutex mutex;
195 std::tr1::shared_ptr<SharedPV::Handler> handler;
203 std::tr1::shared_ptr<const epics::pvData::Structure> type;
208 getfields_t getfields;
211 std::tr1::shared_ptr<epics::pvData::PVStructure> current;
214 epics::pvData::BitSet valid;
233 std::tr1::shared_ptr<Impl> impl;
235 friend struct detail::SharedPut;
236 friend struct detail::SharedRPC;
237 explicit Operation(
const std::tr1::shared_ptr<Impl> impl);
242 const epics::pvData::PVStructure& pvRequest()
const;
243 const epics::pvData::PVStructure& value()
const;
244 const epics::pvData::BitSet& changed()
const;
254 void complete(
const epics::pvData::Status& sts);
257 void complete(
const epics::pvData::PVStructure& value,
258 const epics::pvData::BitSet& changed);
268 std::tr1::shared_ptr<epics::pvAccess::Channel> getChannel();
270 std::tr1::shared_ptr<epics::pvAccess::ChannelBaseRequester> getRequester();
274 #if __cplusplus>=201103L
275 explicit operator bool()
const {
return valid(); }
278 typedef bool (Operation::*bool_type)()
const;
280 operator bool_type()
const {
return valid() ? &Operation::valid : 0; }
288 #endif // PV_SHAREDSTATE_H
Information provded by a client to a server-type ChannelProvider.
bool dropEmptyUpdates
default true. Drop updates which don't include an field values.
An instance of a Client or Server.
A Shared State Process Variable (PV)
Interface for something which can provide Channels. aka A "PV". Typically a SharedPV.
Operation()
create empty op for later assignment
Callbacks associated with a SharedPV.
void close(bool destroy=false)
Force any clients to disconnect, and prevent re-connection.
An in-progress network operation (Put or RPC).
epics::pvData::PVRequestMapper::mode_t mapperMode
default Mask.
virtual void onLastDisconnect(const SharedPV::shared_pointer &pv)
Called when the last client disconnects. May close()