NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
nds::PVAction Class Reference

Detailed Description

An output PV that delegates the read and write operations to two external functions.

Calling PVAction::read() or PVDelegate::write() will result in a call to the delegated functions.

Examples:
rpcSquare/rpcSquare.cpp.

#include <pvAction.h>

Inheritance diagram for nds::PVAction:
nds::PVBaseOut nds::PVBase nds::Base

Public Types

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

Public Member Functions

 PVAction ()
 Initializes an empty PVAction PV. More...
 
 PVAction (const std::string &name, write_t writeFunction, initValue_t initValueFunction)
 Construct the PVAction object and specifies the external functions that must be called to write the data and to retrieve the initial value. More...
 
 PVAction (const std::string &name, write_t writeFunction)
 Construct the PVAction object and specifies the external function that must be called to write the data. More...
 
void setValueBack (const timespec &timestamp, const std::int32_t &value)
 Function to set the value back to the control system. More...
 
- Public Member Functions inherited from nds::PVBaseOut
 PVBaseOut ()
 Construct an empty PVBaseOut. More...
 
template<typename T >
void read (timespec *pTimestamp, T *pValue) const
 Call to read the value of the PV. More...
 
template<typename T >
void write (const timespec &timestamp, const T &value)
 Call to write the value into the PV. More...
 
void subscribeTo (const std::string &inputPVName)
 Subscribe the PV to an input PV which may be located on any other device running in the same NDS process. More...
 
- Public Member Functions inherited from nds::PVBase
void setDescription (const std::string &description)
 Set a human readable description of the PV. More...
 
void setUnits (const std::string &units)
 Set the engineering units of the PV. More...
 
void setInterfaceName (const std::string &interfaceName)
 Set the name of the PV as seen by the control system. More...
 
void setScanType (const scanType_t scanType, const double periodSeconds=1)
 Set how the PV value is retrieved by the control system. More...
 
void setMaxElements (const size_t maxElements)
 If the data type of the PV is a vector then set the maximum number of elements that the vector will contain. More...
 
void setEnumeration (const enumerationStrings_t &enumerations)
 If the data type is an integer then assigns a list of strings that enumerate the values (starting from zero). More...
 
void processAtInit (const bool bProcessAtInit)
 Specifies if the read() function of the PV should be called during the device initialization. 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...
 
Baseoperator= (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.
 

Constructor & Destructor Documentation

nds::PVAction::PVAction ( )

Initializes an empty PVAction PV.

You must assign a valid PVAction PV before calling Node::initialize() on the root node.

nds::PVAction::PVAction ( const std::string &  name,
write_t  writeFunction,
initValue_t  initValueFunction 
)

Construct the PVAction object and specifies the external functions that must be called to write the data and to retrieve the initial value.

The constructor also call processAtInit(true) in order to cause the call to the initValueFunction during the initialization.

Parameters
namename of the PV
writeFunctionfunction to be used to write the value
initValueFunctionfunction to be used for reading the initial value
nds::PVAction::PVAction ( const std::string &  name,
write_t  writeFunction 
)

Construct the PVAction object and specifies the external function that must be called to write the data.

Parameters
namename of the PV
writeFunctionfunction to be used to write the value

Member Function Documentation

void nds::PVAction::setValueBack ( const timespec &  timestamp,
const std::int32_t &  value 
)

Function to set the value back to the control system.

Parameters
timestamptimestamp related to the new value
valuevalue to set back

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