From 3215a280dabb78877f21b001e89dc820ab2ef1cb Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 16 Mar 2016 19:29:22 -0400 Subject: [PATCH] more single monitor --- common/pvahelper.h | 12 ++++++++++-- pdbApp/pdbsingle.cpp | 6 ++++++ pdbApp/pdbsingle.h | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/common/pvahelper.h b/common/pvahelper.h index 42d3ccc..0c6c160 100644 --- a/common/pvahelper.h +++ b/common/pvahelper.h @@ -126,6 +126,14 @@ struct BaseChannel : public epics::pvAccess::Channel } }; +/** + * 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. + */ struct BaseMonitor : public epics::pvAccess::Monitor, public std::tr1::enable_shared_from_this { @@ -307,8 +315,8 @@ public: // for special handling when MonitorRequester start()s or stop()s virtual void onStart() {} virtual void onStop() {} - //! called when a MonitorRequester callback would result in a subscription update - //! sub-class may apply necessary locking, update .complete, .changed, and .overflow, then call post() + //! called when within release() when the opportunity exists to end the overflow condition + //! May do nothing, or lock and call post() virtual void requestUpdate() {guard_t G(lock); post();} virtual void destroy() diff --git a/pdbApp/pdbsingle.cpp b/pdbApp/pdbsingle.cpp index f9c2ed7..b436895 100644 --- a/pdbApp/pdbsingle.cpp +++ b/pdbApp/pdbsingle.cpp @@ -269,3 +269,9 @@ void PDBSingleMonitor::onStop() db_event_disable(pv->evt_PROPERTY.subscript); } } + +void PDBSingleMonitor::requestUpdate() +{ + Guard G(pv->lock); + post(); +} diff --git a/pdbApp/pdbsingle.h b/pdbApp/pdbsingle.h index ab1baaa..28aeee8 100644 --- a/pdbApp/pdbsingle.h +++ b/pdbApp/pdbsingle.h @@ -151,6 +151,7 @@ struct PDBSingleMonitor : public BaseMonitor virtual void onStart(); virtual void onStop(); + virtual void requestUpdate(); virtual void destroy(); };