NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
dataAcquisitionImpl.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 NDSDATAACQUISITIONIMPL_H
11 #define NDSDATAACQUISITIONIMPL_H
12 
13 #include <memory>
14 #include "nds3/definitions.h"
15 #include "nds3/impl/nodeImpl.h"
16 
17 namespace nds
18 {
19 
20 template <typename T> class PVVariableInImpl;
21 template <typename T> class PVVariableOutImpl;
22 
23 
24 template<typename T>
25 class DataAcquisitionImpl: public NodeImpl
26 {
27 public:
28  DataAcquisitionImpl(const std::string& name,
29  size_t maxElements,
30  stateChange_t switchOnFunction,
31  stateChange_t switchOffFunction,
32  stateChange_t startFunction,
33  stateChange_t stopFunction,
34  stateChange_t recoverFunction,
35  allowChange_t allowStateChangeFunction);
36 
47  void setStartTimestampDelegate(getTimestampPlugin_t timestampDelegate);
48 
49  void push(const timespec& timestamp, const T& data);
50 
51  double getFrequencyHz();
52  double getDurationSeconds();
53  double getAmplitude();
54  double getOffset();
55  size_t getMaxElements();
56  size_t getDecimation();
57  size_t getSamplingMode();
58  size_t getGround();
59 
68  timespec getStartTimestamp() const;
69 
74  void onStart();
75 
76 
77 protected:
82  stateChange_t m_onStartDelegate;
83 
92  getTimestampPlugin_t m_startTimestampFunction;
93 
98  timespec m_startTime;
99 
100  // PVs
101  std::shared_ptr<PVVariableInImpl<T> > m_dataPV;
102  std::shared_ptr<PVVariableOutImpl<double> > m_frequencyPV;
103  std::shared_ptr<PVVariableOutImpl<double> > m_durationPV;
104  std::shared_ptr<PVVariableOutImpl<double> > m_amplitudePV;
105  std::shared_ptr<PVVariableOutImpl<double> > m_offsetPV;
106  std::shared_ptr<PVVariableOutImpl<std::int32_t> > m_decimationPV;
107  std::shared_ptr<PVVariableOutImpl<std::int32_t> > m_samplingmodePV;
108  std::shared_ptr<PVVariableOutImpl<std::int32_t> > m_groundPV;
109  std::shared_ptr<StateMachineImpl> m_stateMachine;
110 
111 
112 
113 };
114 
115 }
116 #endif // NDSDATAACQUISITIONIMPL_H
117 
Implementation of an output PV object that also stores the value so it does not need to delegate the ...
Definition: dataAcquisitionImpl.h:21
std::function< timespec()> getTimestampPlugin_t
Definition for a function called to retrieve a time.
Definition: definitions.h:279
Implementation of an input PV object that also stores the value so it does not need to delegate the r...
Definition: dataAcquisitionImpl.h:20
Represents a node (channel or channelGroup in the old NDS) which can contain other nodes...
Definition: nodeImpl.h:29
std::function< bool(const state_t, const state_t, const state_t)> allowChange_t
Definition for a function called to allow or deny a state transition.
Definition: definitions.h:271
std::function< void()> stateChange_t
Definition for the function executed during the state transition.
Definition: definitions.h:254
Defines all the enumeration and common types used across the NDS library.