NDS3
1.0.0
API reference manual
|
Delegating Input PV. Delegates the read operation to an user defined function.
T | the PV data type. The following data types are supported:
|
#include <pvDelegateInImpl.h>
Public Types | |
typedef std::function< void(timespec *, T *)> | read_t |
Definition of the method used to read the value. More... | |
Public Member Functions | |
PVDelegateInImpl (const std::string &name, read_t readFunction, const inputPvType_t pvType=inputPvType_t::generic) | |
Constructor for read-only PVs. Specifies the method used for reading the value. More... | |
virtual void | read (timespec *pTimestamp, T *pValue) const |
Called when the control system wants to read a value. More... | |
virtual dataType_t | getDataType () const |
Return the PV's data type. More... | |
Public Member Functions inherited from nds::PVBaseInImpl | |
PVBaseInImpl (const std::string &name, const inputPvType_t pvType) | |
Constructor. More... | |
virtual void | initialize (FactoryBaseImpl &controlSystem) |
Register the PV with the control system. More... | |
virtual void | deinitialize () |
Deregister the PV from the control system. | |
virtual void | read (timespec *pTimestamp, std::int32_t *pValue) const |
Called when the control system wants to read the value. More... | |
template<typename T > | |
void | push (const timespec ×tamp, const T &value) |
Pushes data to the control system and to the subscribed PVs. More... | |
void | subscribeReceiver (PVBaseOutImpl *pReceiver) |
Subscribe an output PV to this PV. More... | |
void | unsubscribeReceiver (PVBaseOutImpl *pReceiver) |
Unsubscribe an output PV from this PV. More... | |
void | replicateTo (PVBaseInImpl *pDestination) |
Replicate the data written to this PV to another input PV. More... | |
void | stopReplicationTo (PVBaseInImpl *pDestination) |
Stop the replication of data to the specified destination PV. More... | |
void | setDecimation (const std::uint32_t decimation) |
Set the decimation factor. More... | |
void | replicateFrom (const std::string &sourceInputPVName) |
Specifies an input PV from which the data must be copied. More... | |
virtual dataDirection_t | getDataDirection () const |
Retrieve the data direction. More... | |
Public Member Functions inherited from nds::PVBaseImpl | |
virtual void | write (const timespec ×tamp, const std::int32_t &value) |
Called when the control system wants to write a value. More... | |
void | setDescription (const std::string &description) |
Set the PV description. More... | |
void | setUnits (const std::string &units) |
Set the engineering units associated with the PV. More... | |
void | setScanType (const scanType_t scanType, const double periodSeconds) |
Set the scan type. More... | |
void | setMaxElements (const size_t maxElements) |
Set the maximum number of elements if the data type is an array. More... | |
void | setEnumeration (const enumerationStrings_t &enumerations) |
Assign enumeration strings to the PV. More... | |
void | processAtInit (const bool bProcessAtInit) |
Specifies if the PV has to be processed during the initialization. More... | |
const std::string & | getDescription () const |
Return the PV's description. More... | |
const std::string & | getUnits () const |
Return the PV's engineering units. More... | |
scanType_t | getScanType () const |
Return the scan type. More... | |
double | getScanPeriodSeconds () const |
Return the scan period in seconds. More... | |
size_t | getMaxElements () const |
Return the maximum number of elements that can be stored in the array (if the PV data type is an array). More... | |
const enumerationStrings_t & | getEnumerations () const |
Return the list of string used to enumerate the integer values. More... | |
bool | getProcessAtInit () const |
Return true if the PV has to bve processed during the initialization of the device. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from nds::PVBaseImpl | |
template<typename T > | |
static dataType_t | getDataTypeForCPPType () |
Return the data type enumerator for the type in the template. More... | |
Protected Types inherited from nds::PVBaseInImpl | |
typedef std::set< PVBaseOutImpl * > | subscribersList_t |
List of subscribed PVs. | |
typedef std::set< PVBaseInImpl * > | destinationList_t |
List of destination input PVs. | |
Protected Attributes inherited from nds::PVBaseInImpl | |
subscribersList_t | m_subscriberOutputPVs |
List of subscribed PVs. | |
destinationList_t | m_replicationDestinationPVs |
List of PVs to which the data must be pushed or written. | |
std::mutex | m_lockSubscribersList |
Lock the access to m_subscriberOutputPVs. | |
std::uint32_t | m_decimationFactor |
Decimation factor. | |
std::uint32_t | m_decimationCount |
Keeps track of the received data/vs data pushed to the control system. | |
Protected Attributes inherited from nds::PVBaseImpl | |
std::string | m_description |
The PV's description. | |
std::string | m_units |
Engineering units. | |
scanType_t | m_scanType |
The PV's scan type. | |
double | m_periodicScanSeconds |
The interval between data polling (in seconds). | |
size_t | m_maxElements |
Maximum number of elements that can be stored in the PV. | |
enumerationStrings_t | m_enumeration |
List of strings used for enumeration. | |
bool | m_bProcessAtInit |
True if the PV has to be processed during the device initialization. | |
typedef std::function<void (timespec*, T*)> nds::PVDelegateInImpl< T >::read_t |
Definition of the method used to read the value.
The read function will receive a pointer to a timespec and a pointer to a value: the function will have to fill both the timespec and value with proper data.
nds::PVDelegateInImpl< T >::PVDelegateInImpl | ( | const std::string & | name, |
read_t | readFunction, | ||
const inputPvType_t | pvType = inputPvType_t::generic |
||
) |
Constructor for read-only PVs. Specifies the method used for reading the value.
name | PV's name |
readFunction | read method |
|
virtual |
|
virtual |
Called when the control system wants to read a value.
Internally it calls the read method specified in the constructor.
pTimestamp | a pointer to a variable that will be filled with the timestamp |
pValue | a pointer to a value that will be filled with the value |