NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data input/output

Typedefs

typedef std::function< void(timespec
*, std::int32_t *)> 
nds::PVAction::initValue_t
 Definition of the method used to read the initial PV value. More...
 
typedef std::function< void(const
timespec &, const std::int32_t &)> 
nds::PVAction::write_t
 Definition of the method used to write.
 
typedef std::function< void(timespec
*, T *)> 
nds::PVDelegateIn< T >::read_t
 Definition of the method used to read the PV value. More...
 
typedef std::function< void(timespec
*, T *)> 
nds::PVDelegateOut< T >::initValue_t
 Definition of the method used to read the initial PV value. More...
 
typedef std::function< void(const
timespec &, const T &)> 
nds::PVDelegateOut< T >::write_t
 Definition of the method used to write.
 

Functions

void nds::DataAcquisition< T >::push (const timespec &timestamp, const T &data)
 Push acquired data to the control system. More...
 
template<typename T >
void nds::PVBaseIn::read (timespec *pTimestamp, T *pValue) const
 Call to read the value of the PV. More...
 
template<typename T >
void nds::PVBaseIn::push (const timespec &timestamp, const T &value)
 Pushes a value to the control system. More...
 
void nds::PVBaseIn::setDecimation (const std::uint32_t decimation)
 Specifies the decimation factor used when pushing data to the control system. More...
 
template<typename T >
void nds::PVBaseOut::read (timespec *pTimestamp, T *pValue) const
 Call to read the value of the PV. More...
 
template<typename T >
void nds::PVBaseOut::write (const timespec &timestamp, const T &value)
 Call to write the value into the PV. More...
 
void nds::PVVariableIn< T >::setValue (const T &value)
 Set the variable's value. More...
 
void nds::PVVariableIn< T >::setValue (const timespec &timestamp, const T &value)
 Set the variable's value. More...
 
nds::PVVariableOut< T >::getValue () const
 Retrieve the value stored in the PV. More...
 
void nds::PVVariableOut< T >::getValue (timespec *pTime, T *pValue) const
 Retrieve the value and the timestamp stored in the PV. More...
 

Detailed Description

The control system can access the data via PVs (process variables). The base PV class is PVBase, from which PVDelegate and PVVariable are derived.

Both PVDelegate and PVVariable provide the read and write methods (inherited from PVBase), but while PVDelegate calls two user-defined delegate functions to perform the read and write operation, PVVariable takes care of storing the value so it does not need to refer to delegate functions and can carry out the read and write operations by itself.

PVBase also provides a PVBase::push() method that allow to push data directly to the control system without waiting for it to poll it.

Typedef Documentation

typedef std::function<void (timespec*, std::int32_t*)> nds::PVAction::initValue_t

Definition of the method used to read the initial PV value.

The init function will receive two pointers to the timestamp and value that the function will have to fill with proper data.

template<typename T >
typedef std::function<void (timespec*, T*)> nds::PVDelegateOut< T >::initValue_t

Definition of the method used to read the initial PV value.

The init function will receive two pointers to the timestamp and value that the function will have to fill with proper data.

template<typename T >
typedef std::function<void (timespec*, T*)> nds::PVDelegateIn< T >::read_t

Definition of the method used to read the PV value.

The read function will receive two pointers to the timestamp and value that the function will have to fill with proper data.

Function Documentation

template<typename T >
T nds::PVVariableOut< T >::getValue ( ) const

Retrieve the value stored in the PV.

Returns
the value stored in the PV.
template<typename T >
void nds::PVVariableOut< T >::getValue ( timespec *  pTime,
T *  pValue 
) const

Retrieve the value and the timestamp stored in the PV.

Parameters
pTimepointer to a timespec structure taht will be filled with the PV's timestamp
pValuepointer to a variable that will be filled with the PV's value
template<typename T >
void nds::PVBaseIn::push ( const timespec &  timestamp,
const T &  value 
)

Pushes a value to the control system.

Depending on the decimation value set with setDecimation() the control system will receive the value immediately, regardless of when it calls the read() function.

If one or more output PVs have been suscribed to this PV via Factory::subscribe() then the value will be pushed immediately to all the subscribed PVs via PVBaseOut::write().

See also Factory::subscribe() and PVBaseOut::subscribeTo().

Warning
Only one thread can push data on one PV at any given time: two or more different threads can push data on different PVs but not on the same PV.
If several threads push data on the same PV then the decimation counter may become corrupted and stop the pushing operation.
Parameters
timestampthe new value's timestamp
valuethe value to push to the control system
template<typename T>
void nds::DataAcquisition< T >::push ( const timespec &  timestamp,
const T &  data 
)

Push acquired data to the control system.

Usually your device implementation will call this function from the data acquisition thread in order to push the acquired data.

Parameters
timestampthe timestamp for the data
datathe data to push to the control system
template<typename T >
void nds::PVBaseIn::read ( timespec *  pTimestamp,
T *  pValue 
) const

Call to read the value of the PV.

If this object manages a delegated PV then the delegated function will be called.

Template Parameters
Tthe data type to read
Parameters
pTimestampa pointer to a timestamp value that the called function will fill with the proper timestamp
pValuea pointer to a variable that the called function will fill with the proper value
template<typename T >
void nds::PVBaseOut::read ( timespec *  pTimestamp,
T *  pValue 
) const

Call to read the value of the PV.

If this object manages a delegated PV then the delegated function will be called.

Template Parameters
Tthe data type to read
Parameters
pTimestampa pointer to a timestamp value that the called function will fill with the proper timestamp
pValuea pointer to a variable that the called function will fill with the proper value
void nds::PVBaseIn::setDecimation ( const std::uint32_t  decimation)

Specifies the decimation factor used when pushing data to the control system.

When calling push() the data is transferred to the subscribed output PVs (see PVBaseOut::subscribeTo() ) and to the control system. However, the data pushed to the control system also takes into account the decimation factor.

If the decimation factor is 1 (the default value) then all the pushed data is also passed to the control system, if the decimation factor is 0 then none of the data is passed to the control system, if the decimation factor is higher than one then it specifies the ratio pushed_data/passed_to_CS which express the number of pushed data versus the number of data actually passed to the control system.

Warning
It is not safe to set the decimation factor while push() is being called. The decimation factor should be set before starting the data acquisition.
Parameters
decimationthe decimation factor (ratio pusehd_data/data_passd_to_cs)
template<typename T >
void nds::PVVariableIn< T >::setValue ( const T &  value)

Set the variable's value.

The control system will retrieve the value when it choses to do so.

If one or more output PVs have been suscribed to this PV via Factory::subscribe() then the value will be pushed immediately to all the subscribed PVs via PVBaseOut::write().

See also Factory::subscribe() and PVBaseOut::subscribeTo().

Parameters
valuethe value to write into the variable. The timestamp will be taken via the getTimestamp() method.
template<typename T >
void nds::PVVariableIn< T >::setValue ( const timespec &  timestamp,
const T &  value 
)

Set the variable's value.

The control system will retrieve the value when it choses to do so.

If one or more output PVs have been suscribed to this PV via Factory::subscribe() then the value will be pushed immediately to all the subscribed PVs via PVBaseOut::write().

See also Factory::subscribe() and PVBaseOut::subscribeTo().

Parameters
timestampthe timestamp to assign to the variable
valuethe value to write into the variable
template<typename T >
void nds::PVBaseOut::write ( const timespec &  timestamp,
const T &  value 
)

Call to write the value into the PV.

If this object manages a delegated PV then the delegated function will be called.

Template Parameters
Tthe data type to write
Parameters
timestampthe timestamp to assign to the new value
valuethe new value for the PV