12#include <epicsMutex.h>
19namespace epics {
namespace pvAccess {
55 virtual std::string name()
const =0;
56 virtual void cancel() =0;
57 virtual void show(std::ostream&)
const =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(); }
83 friend epicsShareFunc ::std::ostream&
operator<<(::std::ostream& strm,
const Operation& op);
84 std::tr1::shared_ptr<Impl> impl;
102 epics::pvData::PVStructure::const_shared_pointer
value;
105 epics::pvData::BitSet::const_shared_pointer
valid;
108struct epicsShareClass InfoEvent :
public PutEvent
121 Monitor(
const std::tr1::shared_ptr<Impl>&);
160 epics::pvData::PVStructure::const_shared_pointer
root;
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;
179 friend epicsShareFunc ::std::ostream&
operator<<(::std::ostream& strm,
const Monitor& op);
180 friend struct MonitorSync;
233 std::tr1::shared_ptr<SImpl> simpl;
254void 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,
298 const std::string& name,
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(); }
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());
363 epics::pvData::PVStructure::const_shared_pointer root;
371 epics::pvData::PVStructure::const_shared_pointer previous;
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;
441 Operation info(InfoCallback *cb,
const std::string& subfld = std::string());
445 const std::string& subfld = std::string());
458 void show(std::ostream& strm)
const;
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)
495 scalars.
push_back(scalars_t::value_type(name, value, required));
499 PutBuilder& set(
const std::string& name, T value,
bool required=
true) {
503 arrays.
push_back(arrays_t::value_type(name, value, required));
508 return set(name, epics::pvData::static_shared_vector_cast<const void>(value), required);
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);
539 std::string name()
const;
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(); }
580epicsShareFunc ::std::ostream&
operator<<(::std::ostream& strm,
const Monitor& op);
basic_ostream< _CharT, _Traits > & operator<<(basic_ostream< _CharT, _Traits > &__os, const basic_string< _CharT, _Traits, _Alloc > &__str)
bool operator<(const _CharT *__lhs, const basic_string< _CharT, _Traits, _Alloc > &__rhs)
void push_back(const value_type &__x)
Represents a single channel.
void removeConnectListener(ConnectCallback *)
Remove from list of listeners.
Operation info(InfoCallback *cb, const std::string &subfld=std::string())
Request PV type info.
void addConnectListener(ConnectCallback *)
Append to list of listeners.
epics::pvData::PVStructure::const_shared_pointer get(double timeout=3.0, epics::pvData::PVStructure::const_shared_pointer pvRequest=epics::pvData::PVStructure::const_shared_pointer())
Block and retrieve current PV value.
epics::pvData::FieldConstPtr info(double timeout=3.0, const std::string &subfld=std::string())
Synchronious getField opreation.
std::string name() const
Channel name or an empty string.
Operation rpc(GetCallback *cb, const epics::pvData::PVStructure::const_shared_pointer &arguments, epics::pvData::PVStructure::const_shared_pointer pvRequest=epics::pvData::PVStructure::const_shared_pointer())
Start an RPC call.
Operation get(GetCallback *cb, epics::pvData::PVStructure::const_shared_pointer pvRequest=epics::pvData::PVStructure::const_shared_pointer())
Issue request to retrieve current PV value.
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.
ClientChannel(const std::tr1::shared_ptr< epics::pvAccess::ChannelProvider > &provider, const std::string &name, const Options &opt=Options())
Construct a ClientChannel using epics::pvAccess::ChannelProvider::createChannel()
Monitor monitor(MonitorCallback *cb, epics::pvData::PVStructure::const_shared_pointer pvRequest=epics::pvData::PVStructure::const_shared_pointer())
Begin subscription.
ClientChannel()
Construct a null channel. All methods throw. May later be assigned from a valid ClientChannel.
epics::pvData::PVStructure::const_shared_pointer rpc(double timeout, const epics::pvData::PVStructure::const_shared_pointer &arguments, epics::pvData::PVStructure::const_shared_pointer pvRequest=epics::pvData::PVStructure::const_shared_pointer())
Block and execute remote call.
MonitorSync monitor(const epics::pvData::PVStructure::const_shared_pointer &pvRequest=epics::pvData::PVStructure::const_shared_pointer(), epicsEvent *event=0)
Begin subscription w/o callbacks.
void disconnect()
Clear channel cache.
ClientProvider(const std::string &providerName, const std::tr1::shared_ptr< epics::pvAccess::Configuration > &conf=std::tr1::shared_ptr< epics::pvAccess::Configuration >())
Use named provider.
ClientChannel connect(const std::string &name, const ClientChannel::Options &conf=ClientChannel::Options())
Get a new Channel.
ClientProvider()
Construct a null provider. All methods throw. May later be assigned from a valid ClientProvider.
bool disconnect(const std::string &name, const ClientChannel::Options &conf=ClientChannel::Options())
Remove from channel cache.
Helper to accumulate values to for a Put operation.
std::tr1::shared_ptr< const Structure > StructureConstPtr
std::tr1::shared_ptr< const Field > FieldConstPtr
Copyright - See the COPYRIGHT that is included with this distribution.
Connection state change CB.
callback for get() and rpc()
virtual void getDone(const GetEvent &evt)=0
get or rpc operation is complete
Monitor event notification.
virtual void monitorEvent(const MonitorEvent &evt)=0
New monitor event.
Channel creation options.
virtual void putDone(const PutEvent &evt)=0
Put operation is complete.
virtual void putBuild(const epics::pvData::StructureConstPtr &build, Args &args)=0
Server provides expected structure.
information on connect/disconnect
std::string peerName
For connection events.
bool connected
Is this a connection, or disconnection, event.
Information on get/rpc completion.
epics::pvData::BitSet::const_shared_pointer valid
Mask of fields in value which have been initialized by the server.
epics::pvData::PVStructure::const_shared_pointer value
New data. NULL unless event==Success.
Information on monitor subscription/queue change.
@ Fail
subscription ends in an error
@ Cancel
subscription ends in cancellation
@ Data
Data queue not empty. Call Monitor::poll()
@ Disconnect
subscription interrupted due to loss of communication
std::string message
set for event=Fail
Handle for monitor subscription.
bool complete() const
true if all events received.
bool poll()
updates root, changed, overrun
std::string name() const
Channel name.
void cancel()
Immediate cancellation.
epics::pvData::PVStructure::const_shared_pointer root
Monitor update data.
Subscription usable w/o callbacks.
bool wait()
wait for new event
bool test()
check if new event is immediately available.
bool wait(double timeout)
wait for new event
void wake()
Abort one call to wait(), either concurrent or future.
MonitorEvent event
most recent event updated only during wait() or poll()
Handle for in-progress get/put/rpc operation.
std::string name() const
Channel name.
void cancel()
Immediate cancellation.
Information on put completion.
std::string message
Check when event==Fail.
@ Fail
request ends in failure. Check message
@ Cancel
request cancelled before completion
Thrown by blocking methods of ClientChannel on operation timeout.