NDS3
1.0.0
API reference manual
|
This is a node that supplies a data acquisition PV and few control PV that specifies how the acquisition should be performed.
It also provides a state machine that allows to start/stop the acquisition.
The user of a DataAcquisition class must declare few delegate functions that specify the actions to perform when the acquisition node's state changes.
In particular, the transition from the state off to running should launch the data acquisition thread which pushes the acquired data via pushData(), while the transition from running to on should stop the data acquisition thread.
T | the PV data type. The following data types are supported:
|
#include <dataAcquisition.h>
Public Member Functions | |
DataAcquisition () | |
Initializes an empty data acquisition node. More... | |
DataAcquisition (const DataAcquisition< T > &right) | |
Copies a data acquisition reference from another object. More... | |
DataAcquisition (const std::string &name, size_t maxElements, stateChange_t switchOnFunction, stateChange_t switchOffFunction, stateChange_t startFunction, stateChange_t stopFunction, stateChange_t recoverFunction, allowChange_t allowStateChangeFunction) | |
Constructs the data acquisition node. More... | |
void | setStartTimestampDelegate (getTimestampPlugin_t timestampDelegate) |
Set the function that retrieves the exaxt start time when the data acquisition starts. More... | |
void | push (const timespec ×tamp, const T &data) |
Push acquired data to the control system. More... | |
double | getFrequencyHz () |
Retrieve the desidered acquisition frequency, in Hertz. More... | |
double | getDurationSeconds () |
Retrieve the desidered duration of the acquisition, in seconds. More... | |
double | getAmplitude () |
Retrieve the amplitude for the acquisition. More... | |
double | getOffset () |
Retrieve the offset for the acquisition. More... | |
size_t | getMaxElements () |
Retrieve the maximum number of elements that can be stored in the pushed array. This number is set in the DataAcquisition constructor. More... | |
size_t | getDecimation () |
Retrieve the desidered decimation value. More... | |
size_t | getSamplingMode () |
Retrieve the desidered sampling mode value. More... | |
size_t | getGround () |
Retrieve the desidered ground state value. More... | |
timespec | getStartTimestamp () const |
Returns the timestamp at the moment of the start of the acquisition. More... | |
Public Member Functions inherited from nds::Node | |
Node (const std::string &name, const nodeType_t nodeType=nodeType_t::generic) | |
Construct the node. More... | |
template<class T > | |
T | addChild (T child) |
Add a child node or record to this node. This node will take ownership of the added one and will take care of deleting it. More... | |
void | initialize (void *pDeviceObject, Factory &factory) |
Registers all the records with the control system. Call this from the root node which will take care of traversing its children and initialize them. More... | |
Public Member Functions inherited from nds::Base | |
Base (const Base &right) | |
Copy constructor. The copy will refer to the same implementation object referenced in the copied object. More... | |
Base & | operator= (const Base &right) |
Copy operator. The copy will refer to the same implementation object referenced in the copied object. More... | |
void | setExternalName (const std::string &externalName) |
Set the string to pass to the naming rules in order to build the full node name as seen by the control system. More... | |
virtual Port | getPort () |
Get the Node that communicate with the device (ASYN port on EPICS, Device on Tango). Query the parent nodes if necessary. More... | |
const std::string & | getComponentName () const |
Return the node's name. More... | |
const std::string & | getFullName () const |
Return the full node's name, prepending the parents' names if necessary (e.g. "ROOT-CHANNEL1-THISNODE") More... | |
const std::string & | getFullExternalName () const |
Return the full node's name as seen by the control system clients. More... | |
const std::string & | getFullNameFromPort () const |
Return the node's name as seen by the parent Port node (the node that communicates with the device). More... | |
timespec | getTimestamp () const |
Get the current time. More... | |
void | setTimestampDelegate (getTimestampPlugin_t timestampDelegate) |
Specify the delegate function to call to get the timestamp. More... | |
std::ostream & | getLogger (const logLevel_t logLevel) |
Retrieve a logging stream for the specified log level. More... | |
bool | isLogLevelEnabled (const logLevel_t logLevel) const |
Returns true if the logging for a particular severity level has been enabled. More... | |
void | setLogLevel (const logLevel_t logLevel) |
Enable the logging for a particular severity level. More... | |
void | defineCommand (const std::string &command, const std::string &usage, const size_t numParameters, const command_t function) |
Define a command specific for the node. More... | |
Thread | runInThread (const std::string &name, threadFunction_t function) |
Create and run a thread using the control system facilities. More... | |
Thread | runInThread (threadFunction_t function) |
Create and run a thread using the control system facilities. The created thread will have the node's name. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from nds::Base | |
Base () | |
Initializes an empty base class. | |
nds::DataAcquisition< T >::DataAcquisition | ( | ) |
Initializes an empty data acquisition node.
You must assign a valid DataAcquisition node before calling initialize().
nds::DataAcquisition< T >::DataAcquisition | ( | const DataAcquisition< T > & | right | ) |
Copies a data acquisition reference from another object.
right | a data acquisition holder from which the reference to the acquisition object implementation is copied |
nds::DataAcquisition< T >::DataAcquisition | ( | const std::string & | name, |
size_t | maxElements, | ||
stateChange_t | switchOnFunction, | ||
stateChange_t | switchOffFunction, | ||
stateChange_t | startFunction, | ||
stateChange_t | stopFunction, | ||
stateChange_t | recoverFunction, | ||
allowChange_t | allowStateChangeFunction | ||
) |
Constructs the data acquisition node.
name | The node's name |
maxElements | Maximum size of the acquired array. Set to 1 for scalar values |
switchOnFunction | Delegate function that performs the actions to switch the node on |
switchOffFunction | Delegate function that performs the actions to switch the node off |
startFunction | Delegate function that performs the actions to start the acquisition (usually launches the acquisition thread) |
stopFunction | Delegate function that performs the actions to stop the acquisition (usually stops the acquisition thread) |
recoverFunction | Delegate function to execute to recover from an error state |
allowStateChangeFunction | Delegate function that can deny a state change. Usually just returns true |
double nds::DataAcquisition< T >::getAmplitude | ( | ) |
Retrieve the amplitude for the acquisition.
size_t nds::DataAcquisition< T >::getDecimation | ( | ) |
Retrieve the desidered decimation value.
double nds::DataAcquisition< T >::getDurationSeconds | ( | ) |
Retrieve the desidered duration of the acquisition, in seconds.
double nds::DataAcquisition< T >::getFrequencyHz | ( | ) |
Retrieve the desidered acquisition frequency, in Hertz.
size_t nds::DataAcquisition< T >::getGround | ( | ) |
Retrieve the desidered ground state value.
size_t nds::DataAcquisition< T >::getMaxElements | ( | ) |
Retrieve the maximum number of elements that can be stored in the pushed array. This number is set in the DataAcquisition constructor.
double nds::DataAcquisition< T >::getOffset | ( | ) |
Retrieve the offset for the acquisition.
size_t nds::DataAcquisition< T >::getSamplingMode | ( | ) |
Retrieve the desidered sampling mode value.
timespec nds::DataAcquisition< T >::getStartTimestamp | ( | ) | const |
Returns the timestamp at the moment of the start of the acquisition.
This value is set by the state machine when the state switches to running. If a timing plugin is active then the timestamp is taken from the plugin.
void nds::DataAcquisition< T >::setStartTimestampDelegate | ( | getTimestampPlugin_t | timestampDelegate | ) |
Set the function that retrieves the exaxt start time when the data acquisition starts.
timestampDelegate | the function that returns the exact starting time of the data acquisition |