This is Unofficial EPICS BASE Doxygen Site
pvac::Monitor Struct Reference

Handle for monitor subscription. More...

#include "client.h"

+ Inheritance diagram for pvac::Monitor:
+ Collaboration diagram for pvac::Monitor:

Public Member Functions

 Monitor ()
 
 Monitor (const std::tr1::shared_ptr< Impl > &)
 
 ~Monitor ()
 
std::string name () const
 Channel name. More...
 
void cancel ()
 Immediate cancellation. More...
 
bool poll ()
 
bool complete () const
 
bool valid () const
 
 operator bool_type () const
 
void reset ()
 

Public Attributes

epics::pvData::PVStructure::const_shared_pointer root
 
epics::pvData::BitSet changed
 
epics::pvData::BitSet overrun
 

Friends

struct MonitorSync
 
epicsShareFunc::std::ostream & operator<< (::std::ostream &strm, const Monitor &op)
 

Detailed Description

Handle for monitor subscription.

Definition at line 117 of file client.h.

Constructor & Destructor Documentation

pvac::Monitor::Monitor ( )
inline

Definition at line 120 of file client.h.

120 {}
pvac::Monitor::Monitor ( const std::tr1::shared_ptr< Impl > &  impl)

Definition at line 185 of file clientMonitor.cpp.

186  :impl(impl)
187 {}
pvac::Monitor::~Monitor ( )

Definition at line 189 of file clientMonitor.cpp.

189 {}

Member Function Documentation

void pvac::Monitor::cancel ( )

Immediate cancellation.

Does not wait for remote confirmation.

Since
Up to 7.0.0 also cleared root, changed, and overrun. After 7.0.0, these data members are left unchanged.

Definition at line 197 of file clientMonitor.cpp.

198 {
199  if(impl) impl->cancel();
200 }
bool pvac::Monitor::complete ( ) const

true if all events received. Check after poll()==false

Definition at line 233 of file clientMonitor.cpp.

234 {
235  if(!impl) return true;
236  Guard G(impl->mutex);
237  return impl->done && impl->seenEmpty;
238 }
std::string pvac::Monitor::name ( ) const

Channel name.

Definition at line 192 of file clientMonitor.cpp.

193 {
194  return impl ? impl->chan->getChannelName() : "<NULL>";
195 }
pvac::Monitor::operator bool_type ( ) const
inline

Definition at line 172 of file client.h.

172 { return valid() ? &Monitor::valid : 0; }
bool valid() const
Definition: client.h:164
bool pvac::Monitor::poll ( )

updates root, changed, overrun

Returns
true if a new update was extracted from the queue.
Note
This method does not block.
MonitorEvent::Data will not be repeated until poll()==false.
Postcondition
root!=NULL (after version 6.0.0)
root!=NULL iff poll()==true (In version 6.0.0)

Definition at line 202 of file clientMonitor.cpp.

203 {
204  if(!impl) return false;
205  Guard G(impl->mutex);
206 
207  if(!impl->done && impl->op && impl->started && impl->last.next()) {
208  const epics::pvData::PVStructurePtr& ptr = impl->last->pvStructurePtr;
209  changed = *impl->last->changedBitSet;
210  overrun = *impl->last->overrunBitSet;
211 
212  /* copy the exposed PVStructure for two reasons.
213  * 1. Prevent accidental use of shared container after release()
214  * 2. Allows caller to cache results of getSubField() until root.get() changes.
215  */
216  if(!root || (void*)root->getField().get()!=(void*)ptr->getField().get()) {
217  // initial connection, or new type
218  root = pvd::getPVDataCreate()->createPVStructure(ptr); // also calls copyUnchecked()
219  } else {
220  // same type
221  const_cast<pvd::PVStructure&>(*root).copyUnchecked(*ptr, changed);
222  }
223 
224  impl->seenEmpty = false;
225  } else {
226  changed.clear();
227  overrun.clear();
228  impl->seenEmpty = true;
229  }
230  return !impl->seenEmpty;
231 }
BitSet & clear(uint32 bitIndex)
Definition: bitSet.cpp:112
epics::pvData::BitSet overrun
Definition: client.h:161
void copyUnchecked(const PVStructure &from)
epics::pvData::PVStructure::const_shared_pointer root
Definition: client.h:160
Data interface for a structure,.
Definition: pvData.h:712
std::tr1::shared_ptr< PVStructure > PVStructurePtr
Definition: pvData.h:87
epics::pvData::BitSet changed
Definition: client.h:161
FORCE_INLINE const PVDataCreatePtr & getPVDataCreate()
Definition: pvData.h:1648
void pvac::Monitor::reset ( )
inline

Definition at line 175 of file client.h.

175 { impl.reset(); }
bool pvac::Monitor::valid ( void  ) const
inline

Definition at line 164 of file client.h.

164 { return !!impl; }

Friends And Related Function Documentation

friend struct MonitorSync
friend

Definition at line 180 of file client.h.

epicsShareFunc ::std::ostream& operator<< ( ::std::ostream &  strm,
const Monitor op 
)
friend

Definition at line 260 of file clientMonitor.cpp.

261 {
262  if(op.impl) {
263  strm << "Monitor("
264  "\"" << op.impl->chan->getChannelName() <<"\", "
265  "\"" << op.impl->chan->getProvider()->getProviderName() <<"\", "
266  "connected="<<(op.impl->chan->isConnected()?"true":"false")
267  <<"\")";
268  } else {
269  strm << "Monitor()";
270  }
271  return strm;
272 }
ChannelPut::shared_pointer op
Definition: pvAccess.cpp:132

Member Data Documentation

epics::pvData::BitSet pvac::Monitor::changed

Definition at line 161 of file client.h.

epics::pvData::BitSet pvac::Monitor::overrun

Definition at line 161 of file client.h.

epics::pvData::PVStructure::const_shared_pointer pvac::Monitor::root

Monitor update data.

After version 6.0.0

Initially NULL, becomes !NULL the first time poll()==true. The PVStructure pointed to be root will presist until Monitor reconnect w/ type change. This can be detected by comparing root.get(). references to root may be cached subject to this test.

In version 6.0.0

NULL except after poll()==true. poll()==false sets root=NULL. references to root should not be stored between calls to poll().

Definition at line 160 of file client.h.


The documentation for this struct was generated from the following files: