5 #ifndef PVATESTCLIENT_H
6 #define PVATESTCLIENT_H
12 #include <epicsMutex.h>
14 #include <pv/pvData.h>
15 #include <pv/bitSet.h>
19 namespace epics {
namespace pvAccess {
20 class ChannelProvider;
56 virtual void cancel() =0;
61 Operation(
const std::tr1::shared_ptr<Impl>&);
69 bool valid()
const {
return !!impl; }
71 #if __cplusplus>=201103L
72 explicit operator bool()
const {
return valid(); }
75 typedef bool (
Operation::*bool_type)()
const;
77 operator bool_type()
const {
return valid() ? &Operation::valid : 0; }
80 void reset() { impl.reset(); }
84 std::tr1::shared_ptr<Impl> impl;
102 epics::pvData::PVStructure::const_shared_pointer
value;
105 epics::pvData::BitSet::const_shared_pointer
valid;
108 struct epicsShareClass InfoEvent :
public PutEvent
111 epics::pvData::FieldConstPtr type;
121 Monitor(
const std::tr1::shared_ptr<Impl>&);
144 bool complete()
const;
160 epics::pvData::PVStructure::const_shared_pointer
root;
161 epics::pvData::BitSet changed,
164 bool valid()
const {
return !!impl; }
166 #if __cplusplus>=201103L
167 explicit operator bool()
const {
return valid(); }
170 typedef bool (Monitor::*bool_type)()
const;
172 operator bool_type()
const {
return valid() ? &Monitor::valid : 0; }
175 void reset() { impl.reset(); }
178 std::tr1::shared_ptr<Impl> impl;
180 friend struct MonitorSync;
233 std::tr1::shared_ptr<SImpl> simpl;
254 void registerRefTrack();
268 #if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 305)
274 std::tr1::shared_ptr<Impl> impl;
276 friend void detail::registerRefTrack();
279 ClientChannel(
const std::tr1::shared_ptr<Impl>& i) :impl(i) {}
297 ClientChannel(
const std::tr1::shared_ptr<epics::pvAccess::ChannelProvider>& provider,
299 const Options& opt = Options());
305 bool valid()
const {
return !!impl; }
307 #if __cplusplus>=201103L
308 explicit operator bool()
const {
return valid(); }
311 typedef bool (ClientChannel::*bool_type)()
const;
313 operator bool_type()
const {
return valid() ? &ClientChannel::valid : 0; }
316 void reset() { impl.reset(); }
322 virtual void getDone(
const GetEvent& evt)=0;
329 epics::pvData::PVStructure::const_shared_pointer pvRequest = epics::pvData::PVStructure::const_shared_pointer());
335 epics::pvData::PVStructure::const_shared_pointer
337 epics::pvData::PVStructure::const_shared_pointer pvRequest = epics::pvData::PVStructure::const_shared_pointer());
345 const epics::pvData::PVStructure::const_shared_pointer& arguments,
346 epics::pvData::PVStructure::const_shared_pointer pvRequest = epics::pvData::PVStructure::const_shared_pointer());
352 epics::pvData::PVStructure::const_shared_pointer
354 const epics::pvData::PVStructure::const_shared_pointer& arguments,
355 epics::pvData::PVStructure::const_shared_pointer pvRequest = epics::pvData::PVStructure::const_shared_pointer());
361 Args(epics::pvData::BitSet& tosend, epics::pvData::BitSet& previousmask) :tosend(tosend), previousmask(previousmask) {}
363 epics::pvData::PVStructure::const_shared_pointer root;
365 epics::pvData::BitSet& tosend;
371 epics::pvData::PVStructure::const_shared_pointer previous;
374 const epics::pvData::BitSet& previousmask;
383 virtual void putBuild(
const epics::pvData::StructureConstPtr& build, Args& args) =0;
385 virtual void putDone(
const PutEvent& evt)=0;
395 epics::pvData::PVStructure::const_shared_pointer pvRequest = epics::pvData::PVStructure::const_shared_pointer(),
396 bool getprevious =
false);
400 detail::PutBuilder put(
const epics::pvData::PVStructure::const_shared_pointer &pvRequest = epics::pvData::PVStructure::const_shared_pointer());
418 epics::pvData::PVStructure::const_shared_pointer pvRequest = epics::pvData::PVStructure::const_shared_pointer());
430 MonitorSync monitor(
const epics::pvData::PVStructure::const_shared_pointer& pvRequest = epics::pvData::PVStructure::const_shared_pointer(),
431 epicsEvent *event =0);
433 struct InfoCallback {
434 virtual ~InfoCallback() {}
436 virtual void infoDone(
const InfoEvent& evt) =0;
444 epics::pvData::FieldConstPtr info(
double timeout = 3.0,
460 std::tr1::shared_ptr<epics::pvAccess::Channel> getChannel();
469 epics::pvData::PVStructure::const_shared_pointer request;
476 triple(
const std::string& name,
const V& value,
bool required =
true)
477 :name(name), required(required), value(value)
491 :channel(channel), request(request)
494 PutBuilder& set(
const std::string& name,
const epics::pvData::AnyScalar& value,
bool required=
true) {
495 scalars.push_back(scalars_t::value_type(name, value, required));
500 return set(name, epics::pvData::AnyScalar(value), required);
502 PutBuilder& set(
const std::string& name,
const epics::pvData::shared_vector<const void>& value,
bool required=
true) {
503 arrays.push_back(arrays_t::value_type(name, value, required));
507 PutBuilder& set(
const std::string& name,
const epics::pvData::shared_vector<const T>& value,
bool required=
true) {
508 return set(name, epics::pvData::static_shared_vector_cast<const void>(value), required);
510 void exec(
double timeout=3.0);
520 std::tr1::shared_ptr<Impl> impl;
521 friend void detail::registerRefTrack();
535 const std::tr1::shared_ptr<epics::pvAccess::Configuration>& conf = std::tr1::shared_ptr<epics::pvAccess::Configuration>());
536 explicit ClientProvider(
const std::tr1::shared_ptr<epics::pvAccess::ChannelProvider>& provider);
557 bool valid()
const {
return !!impl; }
559 #if __cplusplus>=201103L
560 explicit operator bool()
const {
return valid(); }
563 typedef bool (ClientProvider::*bool_type)()
const;
565 operator bool_type()
const {
return valid() ? &ClientProvider::valid : 0; }
568 void reset() { impl.reset(); }
588 #endif // PVATESTCLIENT_H
Represents a single channel.
MonitorEvent event
most recent event updated only during wait() or poll()
basic_ostream< _CharT, _Traits > & operator<<(basic_ostream< _CharT, _Traits > &__os, const basic_string< _CharT, _Traits, _Alloc > &__str)
std::basic_ostream< _CharT, _Traits > & operator<<(std::basic_ostream< _CharT, _Traits > &__os, const std::bernoulli_distribution &__x)
std::string message
set for event=Fail
Helper to accumulate values to for a Put operation.
ClientProvider()
Construct a null provider. All methods throw. May later be assigned from a valid ClientProvider.
epics::pvData::PVStructure::const_shared_pointer value
New data. NULL unless event==Success.
Information on get/rpc completion.
Data queue not empty. Call Monitor::poll()
Information on put completion.
Information on monitor subscription/queue change.
request cancelled before completion
std::string peerName
For connection events.
epics::pvData::PVStructure::const_shared_pointer root
Monitor update data.
subscription ends in cancellation
callback for get() and rpc()
request ends in failure. Check message
Monitor event notification.
bool operator<(const sub_match< _BiIter > &__lhs, const sub_match< _BiIter > &__rhs)
Subscription usable w/o callbacks.
subscription interrupted due to loss of communication
subscription ends in an error
information on connect/disconnect
std::string message
Check when event==Fail.
Channel creation options.
epics::pvData::BitSet::const_shared_pointer valid
Mask of fields in value which have been initialized by the server.
ClientChannel()
Construct a null channel. All methods throw. May later be assigned from a valid ClientChannel.
Handle for monitor subscription.
basic_ostream< char > ostream
Operation put(PutCallback *cb, epics::pvData::PVStructure::const_shared_pointer pvRequest=epics::pvData::PVStructure::const_shared_pointer(), bool getprevious=false)
Initiate request to change PV.
Thrown by blocking methods of ClientChannel on operation timeout.
bool connected
Is this a connection, or disconnection, event.
Connection state change CB.
Handle for in-progress get/put/rpc operation.