EPICS ARCHIVER V4
|
Sample Mechanism base, has a ProcessVariable and filters its values. More...
#include <SampleMechanism.h>
Public Member Functions | |
SampleMechanism (const EngineConfig &config, ProcessVariableContext &ctx, const char *name, double period, ProcessVariableListener *disable_filt_listener) | |
Construct mechanism for given period. More... | |
virtual unsigned long | write (Guard &guard, Index &index)=0 |
Write current buffer to index. More... | |
virtual std::string | getInfo (Guard &guard) |
virtual void | start (Guard &guard) |
Start the sample mechanism. More... | |
virtual void | stop (Guard &guard) |
Stop sampling. More... | |
virtual void | addToFUX (Guard &guard, FUX::Element *doc) |
Append this sample mechanism to a FUX document. More... | |
virtual void | pvConnected (ProcessVariable &pv, const epicsTime &when)=0 |
ProcessVariableStateListener. More... | |
void | pvDisconnected (ProcessVariable &pv, const epicsTime &when) |
ProcessVariableStateListener. More... | |
virtual void | pvValue (ProcessVariable &pv, const RawValue::Data *data)=0 |
ProcessVariableValueListener. More... | |
virtual OrderedMutex & | getMutex () |
virtual const std::string & | getName () const |
Gets the ProcessVariable name. More... | |
bool | isRunning (Guard &guard) |
ProcessVariable::State | getPVState () |
void | disable (const epicsTime &when) |
Temporarily disable sampling. More... | |
void | enable (const epicsTime &when) |
Re-enable sampling. More... | |
void | addStateListener (ProcessVariableStateListener *listener) |
Add a listener to the underlying PV. More... | |
void | removeStateListener (ProcessVariableStateListener *listener) |
Remove a listener from the underlying PV. More... | |
void | addValueListener (ProcessVariableValueListener *listener) |
Add a listener to the underlying PV. More... | |
void | removeValueListener (ProcessVariableValueListener *listener) |
Remove a listener from the underlying PV. More... | |
![]() | |
virtual | ~ProcessVariableStateListener () |
Constructor. | |
Sample Mechanism base, has a ProcessVariable and filters its values.
This base class for all sample mechanisms maintains the ProcessVariable start/stop, and also has a DisableFilter.
Data from the PV goes to the DisableFilter, via which the enable/disable is implemented. Derived sample mechanisms will probably add more filters, until finally invoking the ProcessVariableListener interface of the base SampleMechanism.
The ProcessVariableListener implementation in the base SampleMechanism logs "Disconnected" on pvDisconnected(), and otherwise adds every pvValue to the CircularBuffer.
Uses 'virtual Named' so we can implement other 'Named' interfaces in derived SampleMechanisms and still only get one 'Named' base.
SampleMechanism::SampleMechanism | ( | const EngineConfig & | config, |
ProcessVariableContext & | ctx, | ||
const char * | name, | ||
double | period, | ||
ProcessVariableListener * | disable_filt_listener | ||
) |
Construct mechanism for given period.
config | The global configuration. |
ctx | The ProcessVariableContext to use for the pv. |
name | The pv name to connect to. |
period | The sample period. Use differs with derived class. |
disable_filt_listener | The next listener after the DisableFilter. |
The disable_filt_listener would typically be another ProcessVariableFilter, linking to yet another one, and the final filter then sends PV events to the SampleMechanism. The derived SampleMechanisms provide those intermediate PV filters and point the last one to the basic SampleMechanism, so the derived mechanisms don't need a PV listener in the constructor.
|
inline |
Add a listener to the underlying PV.
|
virtual |
Append this sample mechanism to a FUX document.
Reimplemented in SampleMechanismMonitoredGetEA3, SampleMechanismGetEA3, and SampleMechanismMonitoredEA3.
|
inline |
Add a listener to the underlying PV.
void SampleMechanism::disable | ( | const epicsTime & | when | ) |
Temporarily disable sampling.
void SampleMechanism::enable | ( | const epicsTime & | when | ) |
Re-enable sampling.
|
virtual |
Reimplemented in SampleMechanismMonitoredGetEA3, SampleMechanismGetEA3, and SampleMechanismMonitoredEA3.
|
virtual |
|
virtual |
ProcessVariable::State SampleMechanism::getPVState | ( | ) |
bool SampleMechanism::isRunning | ( | Guard & | guard | ) |
|
pure virtual |
Base implementation allocates circular buffer
Implements ProcessVariableStateListener.
Implemented in SampleMechanismMonitoredGetEA3, SampleMechanismMonitoredEA3, and SampleMechanismEA3.
|
virtual |
Base implementation adds a "DISCONNECTED" marker.
Implements ProcessVariableStateListener.
|
pure virtual |
Base implementation adds data to buffer. In addition, the initial value after a new connection is also logged with the host time stamp. For PVs that never change, this helps because the original time stamp might be before the last 'disconnect', so this gives us an idea of when the PV connected.
Implements ProcessVariableValueListener.
Implemented in SampleMechanismEA3.
|
inline |
Remove a listener from the underlying PV.
|
inline |
Remove a listener from the underlying PV.
|
virtual |
Start the sample mechanism.
Base implementation starts the PV.
Reimplemented in SampleMechanismMonitoredGetEA3, and SampleMechanismGetEA3.
|
virtual |
Stop sampling.
Base implementation stops the PV and adds a 'STOPPED (OFF)' event.
Reimplemented in SampleMechanismMonitoredGetEA3, and SampleMechanismGetEA3.
Write current buffer to index.
Implemented in SampleMechanismEA3.