![]() |
This is Unofficial EPICS BASE Doxygen Site
|
#include "monitor.h"
Classes | |
struct | Config |
struct | Source |
Public Member Functions | |
POINTER_DEFINITIONS (MonitorFIFO) | |
MonitorFIFO (const std::tr1::shared_ptr< MonitorRequester > &requester, const pvData::PVStructure::const_shared_pointer &pvRequest, const Source::shared_pointer &source=Source::shared_pointer(), Config *conf=0) | |
virtual | ~MonitorFIFO () |
const std::tr1::shared_ptr< MonitorRequester > | getRequester () const |
void | show (std::ostream &strm) const |
virtual void | destroy () OVERRIDE FINAL |
void | setFreeHighMark (double level) |
void | open (const epics::pvData::StructureConstPtr &type) |
Mark subscription as "open" with the associated structure type. More... | |
void | close () |
Abnormal closure (eg. due to upstream dis-connection) More... | |
void | finish () |
Successful closure (eg. RDB query done) More... | |
bool | tryPost (const pvData::PVStructure &value, const epics::pvData::BitSet &changed, const epics::pvData::BitSet &overrun=epics::pvData::BitSet(), bool force=false) |
void | post (const pvData::PVStructure &value, const epics::pvData::BitSet &changed, const epics::pvData::BitSet &overrun=epics::pvData::BitSet()) |
Consume a free slot if available, otherwise squash with most recent. More... | |
void | notify () |
virtual epics::pvData::Status | start () OVERRIDE FINAL |
virtual epics::pvData::Status | stop () OVERRIDE FINAL |
virtual MonitorElementPtr | poll () OVERRIDE FINAL |
virtual void | release (MonitorElementPtr const &monitorElement) OVERRIDE FINAL |
virtual void | getStats (Stats &s) const OVERRIDE FINAL |
virtual void | reportRemoteQueueStatus (epics::pvData::int32 freeElements) OVERRIDE FINAL |
size_t | freeCount () const |
Number of unused FIFO slots at this moment, which may changed in the next. More... | |
![]() | |
POINTER_DEFINITIONS (Monitor) | |
virtual | ~Monitor () |
![]() | |
POINTER_DEFINITIONS (Destroyable) | |
Friends | |
void | providerRegInit (void *) |
Additional Inherited Members | |
![]() | |
typedef MonitorRequester | requester_type |
![]() | |
virtual | ~Destroyable () |
Utility implementation of Monitor.
The Monitor interface defines the downstream (consumer facing) side of a FIFO. This class is a concrete implementation of this FIFO, including the upstream (producer facing) side.
In addition to MonitorRequester, which provides callbacks to the downstream side, The MonitorFIFO::Source class provides callbacks to the upstream side.
The simplest usage is to create (as shown below), then put update into the FIFO using post() and tryPost(). These methods behave the same when the queue is not full, but differ when it is. Additionally, tryPost() has an argument 'force'. Together there are three actions
The intent of tryPost() with force=true is to aid code which is transferring values from some upstream buffer and this FIFO. Such code can be complicated if an item is removed from the upstream buffer, but can't be put into this downstream FIFO. Rather than being forced to effectivly maintain a third FIFO, code can use force=true.
In either case, tryPost()==false indicates the the FIFO is full.
eg. simple usage in a sub-class for Channel named MyChannel.
epics::pvAccess::MonitorFIFO::MonitorFIFO | ( | const std::tr1::shared_ptr< MonitorRequester > & | requester, |
const pvData::PVStructure::const_shared_pointer & | pvRequest, | ||
const Source::shared_pointer & | source = Source::shared_pointer() , |
||
Config * | conf = 0 |
||
) |
requester | Downstream/consumer callbacks |
pvRequest | Downstream provided options |
source | Upstream/producer callbacks |
conf | Upstream provided options. Updated with actual values used. May be NULL to use defaults. |
Definition at line 37 of file monitor.cpp.
|
virtual |
Definition at line 97 of file monitor.cpp.
void epics::pvAccess::MonitorFIFO::close | ( | ) |
|
virtual |
Destroy this instance.
Implements epics::pvAccess::Destroyable.
Definition at line 101 of file monitor.cpp.
void epics::pvAccess::MonitorFIFO::finish | ( | ) |
size_t epics::pvAccess::MonitorFIFO::freeCount | ( | ) | const |
Number of unused FIFO slots at this moment, which may changed in the next.
Definition at line 501 of file monitor.cpp.
|
inline |
Access to MonitorRequester passed to ctor, or NULL if it has already been destroyed.
Definition at line 297 of file monitor.h.
|
virtual |
Reimplemented from epics::pvAccess::Monitor.
Definition at line 461 of file monitor.cpp.
void epics::pvAccess::MonitorFIFO::notify | ( | ) |
Call after calling any other upstream interface methods (open()/close()/finish()/post()/...) when no upstream mutexes are locked. Do not call from Source::freeHighMark(). This is done automatically. Call any MonitorRequester methods.
Definition at line 318 of file monitor.cpp.
void epics::pvAccess::MonitorFIFO::open | ( | const epics::pvData::StructureConstPtr & | type | ) |
Mark subscription as "open" with the associated structure type.
Definition at line 137 of file monitor.cpp.
epics::pvAccess::MonitorFIFO::POINTER_DEFINITIONS | ( | MonitorFIFO | ) |
|
virtual |
If monitor has occurred return data.
May recursively call MonitorRequester::unlisten()
Implements epics::pvAccess::Monitor.
Definition at line 397 of file monitor.cpp.
void epics::pvAccess::MonitorFIFO::post | ( | const pvData::PVStructure & | value, |
const epics::pvData::BitSet & | changed, | ||
const epics::pvData::BitSet & | overrun = epics::pvData::BitSet() |
||
) |
Consume a free slot if available, otherwise squash with most recent.
Definition at line 259 of file monitor.cpp.
|
virtual |
Release a MonitorElement that was returned by poll. A poll() must be called after the release() to check the presence of any modified data.
monitorElement |
Implements epics::pvAccess::Monitor.
Definition at line 425 of file monitor.cpp.
|
virtual |
Report remote queue status.
freeElements | number of free elements. |
Reimplemented from epics::pvAccess::Monitor.
Definition at line 469 of file monitor.cpp.
void epics::pvAccess::MonitorFIFO::setFreeHighMark | ( | double | level | ) |
Level, as a percentage of empty buffer slots, at which to call Source::freeHighMark(). Trigger condition is when number of free buffer slots goes above this level. In range [0.0, 1.0)
Definition at line 127 of file monitor.cpp.
void epics::pvAccess::MonitorFIFO::show | ( | std::ostream & | strm | ) | const |
Definition at line 104 of file monitor.cpp.
|
virtual |
Start monitoring.
Implements epics::pvAccess::Monitor.
Definition at line 360 of file monitor.cpp.
|
virtual |
Stop Monitoring.
Implements epics::pvAccess::Monitor.
Definition at line 388 of file monitor.cpp.
bool epics::pvAccess::MonitorFIFO::tryPost | ( | const pvData::PVStructure & | value, |
const epics::pvData::BitSet & | changed, | ||
const epics::pvData::BitSet & | overrun = epics::pvData::BitSet() , |
||
bool | force = false |
||
) |
Consume a free slot if available. otherwise ... if !force take no action and return false. if force then attempt to allocate and fill a new slot, then return false. The extra slot will be free'd after it is consumed.
Definition at line 210 of file monitor.cpp.
|
friend |
Definition at line 208 of file ChannelAccessFactory.cpp.