|
| | 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) |
| |
| const std::tr1::shared_ptr< MonitorRequester > | getRequester () const |
| | Access to MonitorRequester passed to ctor, or NULL if it has already been destroyed.
|
| |
|
void | show (std::ostream &strm) const |
| |
| virtual void | destroy () |
| | Destroy this instance.
|
| |
| void | setFreeHighMark (double level) |
| | Level, as a percentage of empty buffer slots, at which to call Source::freeHighMark().
|
| |
|
void | open (const epics::pvData::StructureConstPtr &type) |
| | Mark subscription as "open" with the associated structure type.
|
| |
|
void | close () |
| | Abnormal closure (eg. due to upstream dis-connection)
|
| |
|
void | finish () |
| | Successful closure (eg. RDB query done)
|
| |
| bool | 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.
|
| |
|
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.
|
| |
| void | notify () |
| | Call after calling any other upstream interface methods (open()/close()/finish()/post()/...) when no upstream mutexes are locked.
|
| |
| virtual epics::pvData::Status | start () |
| | Start monitoring.
|
| |
| virtual epics::pvData::Status | stop () |
| | Stop Monitoring.
|
| |
| virtual MonitorElementPtr | poll () |
| | If monitor has occurred return data.
|
| |
| virtual void | release (MonitorElementPtr const &monitorElement) |
| | Release a MonitorElement that was returned by poll.
|
| |
| virtual void | getStats (Stats &s) const |
| |
| virtual void | reportRemoteQueueStatus (epics::pvData::int32 freeElements) |
| | Report remote queue status.
|
| |
|
size_t | freeCount () const |
| | Number of unused FIFO slots at this moment, which may changed in the next.
|
| |
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
post(value, changed) - combines the new update with the last (most recent) in the FIFO.
tryPost(value, changed, ..., false) - Makes no change to the FIFO and returns false.
tryPost(value, changed, ..., true) - Over-fills the FIFO with the new element, then returns false.
- Note
- Calls to post() or tryPost() must be followed with a call to notify(). Callers of notify() must not hold any locks, or a deadlock is possible.
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.
pva::Monitor::shared_pointer
MyChannel::createMonitor(const pva::MonitorRequester::shared_pointer &requester,
const pvd::PVStructure::shared_pointer &pvRequest)
{
std::tr1::shared_ptr<pva::MonitorFIFO> ret(new pva::MonitorFIFO(requester, pvRequest));
ret->open(spamtype);
ret->notify();
}
Definition at line 258 of file monitor.h.