NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pvActionImpl.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 NDSPVACTIONIMPL_H
11 #define NDSPVACTIONIMPL_H
12 
13 #include "nds3/impl/pvBaseOutImpl.h"
14 #include "nds3/impl/pvBaseInImpl.h"
15 #include "nds3/definitions.h"
16 
17 namespace nds
18 {
19 
24 class NDS3_API PVActionImpl: public PVBaseOutImpl
25 {
26 public:
30  typedef std::function<void (timespec*, std::int32_t*)> initValue_t;
31 
35  typedef std::function<void (const timespec&, const std::int32_t&)> write_t;
36 
44  PVActionImpl(const std::string& name, write_t writeFunction, initValue_t initValueFunction, const outputPvType_t pvType = outputPvType_t::generic);
45 
54  PVActionImpl(const std::string& name, write_t writeFunction, const outputPvType_t pvType = outputPvType_t::generic);
55 
64  virtual void read(timespec* pTimestamp, std::int32_t* pValue) const;
65 
74  virtual void write(const timespec& timestamp, const std::int32_t& value);
75 
81  virtual dataType_t getDataType() const;
82 
89  void setValueBack(const timespec& timestamp, const std::int32_t& value);
90 
96  void setAcknowledgePV(PVBaseInImpl* pv);
97 
98 
99 private:
100  write_t m_writer;
101  initValue_t m_initializer;
102 
107  void dontInitialize(timespec*, std::int32_t*);
108 
109  PVBaseInImpl* m_pAcknowledgePV;
110 
111 };
112 
113 }
114 #endif // NDSPVACTIONIMPL_H
Action PV. Delegates the read/write user defined functions and set the value back to the control syst...
Definition: pvActionImpl.h:24
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
Defines all the enumeration and common types used across the NDS library.
Base class for all the output PVs.
Definition: pvBaseOutImpl.h:26
std::function< void(const timespec &, const std::int32_t &)> write_t
Definition of the method used to write.
Definition: pvActionImpl.h:35
Base class for all the PVs.
Definition: pvBaseInImpl.h:29
dataType_t
PV data types.
Definition: definitions.h:53
std::function< void(timespec *, std::int32_t *)> initValue_t
Definition of the method used to read the initial value.
Definition: pvActionImpl.h:30