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

#include "client.h"

+ Inheritance diagram for pvac::MonitorSync:
+ Collaboration diagram for pvac::MonitorSync:

Classes

struct  SImpl
 

Public Member Functions

 MonitorSync ()
 
 MonitorSync (const Monitor &, const std::tr1::shared_ptr< SImpl > &)
 
 ~MonitorSync ()
 
bool wait ()
 
bool wait (double timeout)
 
bool test ()
 
void wake ()
 
- Public Member Functions inherited from pvac::Monitor
 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

MonitorEvent event
 
- Public Attributes inherited from pvac::Monitor
epics::pvData::PVStructure::const_shared_pointer root
 
epics::pvData::BitSet changed
 
epics::pvData::BitSet overrun
 

Detailed Description

Subscription usable w/o callbacks

Basic usage is to call wait() or test(). If true is returned, then the 'event', 'root', 'changed', and 'overrun' members have been updated with a new event. Test 'event.event' first to find out which kind of event has occured.

Note that wait()/test() methods are distinct from base class poll(). wait()/test() check for the arrival of MonitorEvent while poll() checks for the availability of data (eg. following a Data event).

Definition at line 206 of file client.h.

Constructor & Destructor Documentation

pvac::MonitorSync::MonitorSync ( )
inline

Definition at line 209 of file client.h.

209 {}
pvac::MonitorSync::MonitorSync ( const Monitor mon,
const std::tr1::shared_ptr< SImpl > &  simpl 
)

Definition at line 318 of file clientSync.cpp.

319  :Monitor(mon.impl)
320  ,simpl(simpl)
321 {
322  simpl->sub = mon;
323  event.event = MonitorEvent::Fail;
324 }
subscription ends in an error
Definition: client.h:187
pvac::MonitorSync::~MonitorSync ( )

Definition at line 326 of file clientSync.cpp.

326  {
327 }

Member Function Documentation

bool pvac::MonitorSync::test ( )

check if new event is immediately available. Does not block.

Definition at line 329 of file clientSync.cpp.

330 {
331  if(!simpl) throw std::logic_error("No subscription");
332  Guard G(simpl->mutex);
333  event = simpl->last;
334  simpl->last.event = MonitorEvent::Fail;
335  bool ret = simpl->hadevent;
336  simpl->hadevent = false;
337  return ret;
338 }
subscription ends in an error
Definition: client.h:187
bool pvac::MonitorSync::wait ( )

wait for new event

Returns
true when a new event was received. false if wake() was called.

Definition at line 340 of file clientSync.cpp.

341 {
342  if(!simpl) throw std::logic_error("No subscription");
343  simpl->event->wait();
344  Guard G(simpl->mutex);
345  event = simpl->last;
346  simpl->last.event = MonitorEvent::Fail;
347  bool ret = simpl->hadevent;
348  simpl->hadevent = false;
349  return ret;
350 }
subscription ends in an error
Definition: client.h:187
bool pvac::MonitorSync::wait ( double  timeout)

wait for new event

Returns
false on timeout

Definition at line 352 of file clientSync.cpp.

353 {
354  if(!simpl) throw std::logic_error("No subscription");
355  bool ret = simpl->event->wait(timeout);
356  if(ret) {
357  Guard G(simpl->mutex);
358  event = simpl->last;
359  simpl->last.event = MonitorEvent::Fail;
360  ret = simpl->hadevent;
361  simpl->hadevent = false;
362  }
363  return ret;
364 }
double timeout
Definition: pvutils.cpp:25
subscription ends in an error
Definition: client.h:187
void pvac::MonitorSync::wake ( )

Abort one call to wait(), either concurrent or future. Calls are queued. wait() will return with MonitorEvent::Fail.

Definition at line 366 of file clientSync.cpp.

366  {
367  if(simpl) simpl->event->signal();
368 }

Member Data Documentation

MonitorEvent pvac::MonitorSync::event

most recent event updated only during wait() or poll()

Definition at line 231 of file client.h.


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