NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pvVariableOutImpl.h
1 /*
2  * Nominal Device Support v3 (NDS3)
3  *
4  * Copyright (c) 2015 Cosylab d.d.
5  *
6  * For more information about the license please refer to the license.txt
7  * file included in the distribution.
8  */
9 
10 #ifndef NDSPVVARIABLEOUTIMPL_H
11 #define NDSPVVARIABLEOUTIMPL_H
12 
13 #include <mutex>
14 #include "nds3/impl/pvBaseOutImpl.h"
15 
16 namespace nds
17 {
18 
33 template <typename T>
34 class PVVariableOutImpl: public PVBaseOutImpl
35 {
36 public:
42  PVVariableOutImpl(const std::string& name, const outputPvType_t pvType = outputPvType_t::generic);
43 
51  virtual void read(timespec* pTimestamp, T* pValue) const;
52 
59  virtual void write(const timespec& timestamp, const T& value);
60 
65  virtual dataType_t getDataType() const;
66 
72  T getValue() const;
73 
80  void getValue(timespec* pTime, T* pValue) const;
81 
82 private:
83  T m_value;
84  timespec m_timestamp;
85 
86  mutable std::mutex m_pvMutex;
87 
88 };
89 
90 }
91 #endif // NDSPVVARIABLEOUTIMPL_H
92 
virtual dataType_t getDataType() const
Return the data type of the PV.
virtual void write(const timespec &timestamp, const T &value)
Called when the control system wants to write a value into the PV.
virtual void read(timespec *pTimestamp, T *pValue) const
Called when the control system wants to read a value from the PV.
The node's role is not specified.
outputPvType_t
Defines an output PV's role: this information is used to build the PV's external name when using the ...
Definition: definitions.h:130
PVVariableOutImpl(const std::string &name, const outputPvType_t pvType=outputPvType_t::generic)
Constructor.
T getValue() const
Call to retrieve the value stored in the PV.
dataType_t
PV data types.
Definition: definitions.h:53