Transient Recorder Framework
Public Member Functions | Friends | List of all members
TRConfigParam< ValueType, EffectiveValueType > Class Template Reference

Transient Recorder configuration parameter. More...

#include <TRConfigParam.h>

Inheritance diagram for TRConfigParam< ValueType, EffectiveValueType >:

Public Member Functions

 TRConfigParam ()
 Default constructor for configuration parameters. More...
 
ValueType getSnapshot ()
 Return the current snapshot value of the parameter. More...
 
ValueType getSnapshotFast ()
 Like getSnapshot but does not have any asserts. More...
 
void setIrrelevant ()
 Mark this parameter as irrelevant for the current configuration. More...
 
void setSnapshot (ValueType value)
 Adjust the snapshot value for the current configuration. More...
 
ValueType getDesired ()
 Return the current desired value of the parameter. More...
 
void setDesired (ValueType value)
 Set the desired value of an internal parameter. More...
 
int desiredParamIndex ()
 Return the asyn parameter index of the desired-value parameter. More...
 

Friends

class TRBaseDriver
 

Detailed Description

template<typename ValueType, typename EffectiveValueType = ValueType>
class TRConfigParam< ValueType, EffectiveValueType >

Transient Recorder configuration parameter.

A configuration parameter includes two asyn parameters, one for the desired value and one for the effective value. At the start of arming, a snapshot of the desired value is taken and the driver layer will only be able to access this snapshot, which is guaranteed to not change until the next arming.

The ValueType template parameter is the data type of the desired parameter and the snapshot value. The EffectiveValueType template parameter is the data type of the effective-value parameter. The only supported combinations of pairs are:

Constructor & Destructor Documentation

template<typename ValueType, typename EffectiveValueType = ValueType>
TRConfigParam< ValueType, EffectiveValueType >::TRConfigParam ( )
inline

Default constructor for configuration parameters.

The parameter should be initialized using TRBaseDriver::initConfigParam or TRBaseDriver::initInternalParam after it is constructed. Public functions of TRConfigParam MUST NOT be called before the parameter has been initialized.

Member Function Documentation

template<typename ValueType, typename EffectiveValueType = ValueType>
ValueType TRConfigParam< ValueType, EffectiveValueType >::getSnapshot ( )
inline

Return the current snapshot value of the parameter.

This function MUST NOT be called before TRBaseDriver::checkSettings is called or after TRBaseDriver::stopAcquisition returns (until the next checkSettings call). Refer to TRBaseDriver documentation for details.

Returns
The current snapshot value.
template<typename ValueType, typename EffectiveValueType = ValueType>
ValueType TRConfigParam< ValueType, EffectiveValueType >::getSnapshotFast ( )
inline

Like getSnapshot but does not have any asserts.

This is recommended when performance is important and especially in interrupt context.

Returns
The current snapshot value.
template<typename ValueType, typename EffectiveValueType = ValueType>
void TRConfigParam< ValueType, EffectiveValueType >::setIrrelevant ( )
inline

Mark this parameter as irrelevant for the current configuration.

The intended use of this is in TRBaseDriver::checkSettings to inform the framework that this configuration parameter is irrelevant, so that the effective value asyn parameter will be set to the invalid value instead of the snapshot value.

This function MUST NOT be called outside of TRBaseDriver::checkSettings.

template<typename ValueType, typename EffectiveValueType = ValueType>
void TRConfigParam< ValueType, EffectiveValueType >::setSnapshot ( ValueType  value)
inline

Adjust the snapshot value for the current configuration.

There are two reasons why this would be used:

  • To report a different effective value of the parameter than the desired value, if for whatever reason the desired value is not what is actually being used.
  • To communicate the desired settings to derived classes. For example, TRBaseDriver uses this internally so that TRBaseDriver::getNumPostSamplesSnapshot returns 0 when pre-samples are not enabled. Driver classes may use the same approach to communicate settings to further derived classes.

This function MUST NOT be called outside of TRBaseDriver::checkSettings.

Parameters
valueThe new snapshot value.
template<typename ValueType, typename EffectiveValueType = ValueType>
ValueType TRConfigParam< ValueType, EffectiveValueType >::getDesired ( )

Return the current desired value of the parameter.

The desired value is controlled by the external interface (EPICS) or alteratively by the driver itself for internal parameters using setDesired.

This function MUST be called with the TRBaseDriver port locked.

Using this function should not be needed for most parameters because TRBaseDriver will make a snapshot of the desired value at the start of arming and the snapshot value is what is meant to be used by the driver. It should be used only when the driver calculates the values of internal configuration parameters based on this parameter.

Returns
The current desired value.
template<typename ValueType, typename EffectiveValueType = ValueType>
void TRConfigParam< ValueType, EffectiveValueType >::setDesired ( ValueType  value)

Set the desired value of an internal parameter.

This function MUST be called with the TRBaseDriver port locked.

This function MUST NOT be called for configuration parameters that were not initialized using TRBaseDriver::initInternalParam.

Parameters
valueThe new desired value.
template<typename ValueType, typename EffectiveValueType = ValueType>
int TRConfigParam< ValueType, EffectiveValueType >::desiredParamIndex ( )
inline

Return the asyn parameter index of the desired-value parameter.

This can be used in overridden parameter write functions to determine when the desired value is being changed. There is currently only one foreseen use case, when the driver wishes to apply configuration changes immediately while not armed. See TRBaseDriver::onDisarmed for instructions to do this correctly.

Returns
The asyn parameter index of the desired-value parameter.

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