NDS3  1.0.0
API reference manual
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
stateMachine.h
Go to the documentation of this file.
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 NDSSTATEMACHINE_H
11 #define NDSSTATEMACHINE_H
12 
22 #include <cstdint>
23 
24 #include "nds3/node.h"
25 #include "nds3/definitions.h"
26 
27 namespace nds
28 {
29 
57 class NDS3_API StateMachine: public Node
58 {
59 
60 public:
66  StateMachine();
67 
105  StateMachine(bool bAsync,
106  stateChange_t switchOnFunction,
107  stateChange_t switchOffFunction,
108  stateChange_t startFunction,
109  stateChange_t stopFunction,
110  stateChange_t recoverFunction,
111  allowChange_t allowStateChangeFunction);
112 
142  void setState(const state_t newState);
143 
152 
163 
171  bool canChange(const state_t newState);
172 
173 };
174 
175 }
176 #endif // NDSSTATEMACHINE_H
The PV is used to retrieve the local state of a state machine.
Defines the nds::Node class, a class that can contain other device's nodes, ports or PVs...
A node object that can contain other nodes or PVs as children.
Definition: node.h:38
Represents a state machine to be attached to a node.
Definition: stateMachine.h:57
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.
The PV is used to retrieve the global state.
state_t
Available states, ordered by priority (lowest to higher).
Definition: definitions.h:36