pva2pva  1.4.1
 All Classes Functions Variables Pages
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
BaseMonitor Struct Reference

#include <pvahelper.h>

Inheritance diagram for BaseMonitor:
Inheritance graph
[legend]
Collaboration diagram for BaseMonitor:
Collaboration graph
[legend]

Classes

struct  no_overflow
 

Public Types

typedef
epics::pvAccess::MonitorRequester 
requester_t
 
typedef epicsGuard< epicsMutex > guard_t
 
typedef epicsGuardRelease
< epicsMutex > 
unguard_t
 

Public Member Functions

 POINTER_DEFINITIONS (BaseMonitor)
 
shared_pointer shared_from_this ()
 
 BaseMonitor (epicsMutex &lock, const requester_t::weak_pointer &requester, const epics::pvData::PVStructure::shared_pointer &pvReq)
 
const
epics::pvData::PVStructurePtr & 
getValue ()
 
void connect (guard_t &guard, const epics::pvData::PVStructurePtr &value)
 
bool post (guard_t &guard, const epics::pvData::BitSet &updated, no_overflow)
 post update if queue not full, if full return false w/o overflow
 
bool post (guard_t &guard)
 post update of pending changes. eg. call from requestUpdate()
 
bool post (guard_t &guard, const epics::pvData::BitSet &updated, const epics::pvData::BitSet &overflowed)
 post update with changed and overflowed masks (eg. when updates were lost in some upstream queue)
 
bool post (guard_t &guard, const epics::pvData::BitSet &updated)
 post update with changed
 
virtual void onStart ()
 
virtual void onStop ()
 
virtual void requestUpdate ()
 
virtual void destroy ()
 
virtual void getStats (Stats &s) const
 

Public Attributes

weak_pointer weakself
 
epicsMutex & lock
 

Detailed Description

Helper which implements a Monitor queue. connect()s to a complete copy of a PVStructure. When this struct has changed, post(BitSet) should be called.

Derived class may use onStart(), onStop(), and requestUpdate() to react to subscriber events.

Definition at line 69 of file pvahelper.h.

Member Function Documentation

void BaseMonitor::connect ( guard_t &  guard,
const epics::pvData::PVStructurePtr &  value 
)
inline

Must call before first post(). Sets .complete and calls monitorConnect()

Note
that value will never by accessed except by post() and requestUpdate()

Definition at line 110 of file pvahelper.h.

111  {
112  guard.assertIdenticalMutex(lock);
113  epics::pvData::StructureConstPtr dtype(value->getStructure());
114  epics::pvData::PVDataCreatePtr create(epics::pvData::getPVDataCreate());
115  BaseMonitor::shared_pointer self(shared_from_this());
116  requester_t::shared_pointer req(requester.lock());
117 
118  assert(!complete); // can't call twice
119 
120  complete = value;
121  empty.resize(nbuffers);
122  for(size_t i=0; i<empty.size(); i++) {
123  empty[i].reset(new epics::pvAccess::MonitorElement(create->createPVStructure(dtype)));
124  }
125 
126  if(req) {
127  unguard_t U(guard);
128  epics::pvData::Status sts;
129  req->monitorConnect(sts, self, dtype);
130  }
131  }
virtual void BaseMonitor::requestUpdate ( )
inlinevirtual

called when within release() when the opportunity exists to end the overflow condition May do nothing, or lock and call post()

Reimplemented in PDBGroupMonitor, and PDBSingleMonitor.

Definition at line 271 of file pvahelper.h.

271 {guard_t G(lock); post(G);}
bool post(guard_t &guard, const epics::pvData::BitSet &updated, no_overflow)
post update if queue not full, if full return false w/o overflow
Definition: pvahelper.h:136

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