Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
InformationServer.h
Go to the documentation of this file.
1#pragma once
3#include <gii/gen/Variable.h>
4#include <gii/global.h>
5
6namespace sf
7{
8
10{
11 public:
16
21
31 void setup(const std::string& name, const std::string& namePrefix, long vid, long deviceMask, long serverMask);
32
36 void flush();
37
41 enum EState
42 {
44 issOff = 0,
54 issMaxState
55 };
56
61
65 const char* getStateName(int state) const;
66
71
75 enum EClass
76 {
78 clA = 0,
84 clMaxClass
85 };
86
90 [[nodiscard]] bool isServerId(id_type id) const;
91
96
101
106
111
116
120 virtual void onStateChange(EState prevState, EState nextState) = 0;
121
127 virtual void clearValidations();
128
129 private:
133 void variableEventHandler(Variable::EEvent, const Variable&, Variable&, bool);
134
138 void setWriteFlagForClass(EClass, bool write_enable);
139
143 void setArchiveFlag(bool write_enable);
144
149 void setRecycleFlag(bool recycle_enable);
150
154 typedef void (InformationServer::*VoidFunction)();
155
159 void stateChangeUnknown();
160
164 void stateChangeIllegal();
165
169 void stateChangeStopToRun();
170
174 void stateChangeRunToStop();
175
179 void stateChangeOffToRun();
180
184 void stateChangeRunToRecord();
185
189 void stateChangeRecordToPause();
190
194 void stateChangePauseToStop();
195
199 void stateChangeAnyToOff();
200
204 Variable _vState;
208 EState _prevState;
212 EState _curState;
216 id_type _serverDeviceMask;
220 id_type _serverDeviceId;
224 VoidFunction _jumpTable[issMaxState][issMaxState]{};
228 Variable::PtrVector _variableList[clMaxClass];
232 ResultData::PtrVector _resultList;
237};
238
239}// namespace sf
Definition InformationServer.h:10
virtual ~InformationServer()
void attachResult(ResultData *res)
Adds a result to the result vector.
bool isGeneratingResults()
Reports if this server generates results depending on its current state.
void detachResult(ResultData *res)
Removes a result from the result vector.
virtual void onStateChange(EState prevState, EState nextState)=0
To be overloaded by a derived class to handle a state change if necessary.
void flush()
Clears the instance. Also called from setup.
EState getState() const
Gets the current state.
EClass
Variable/parameter class enumerator.
Definition InformationServer.h:76
@ clC
Definition InformationServer.h:82
@ clB
Definition InformationServer.h:80
bool isServerId(id_type id) const
Determines if the passed id belongs to this info server.
virtual void clearValidations()
Clears the committed ranges of the attached results. This one can be overloaded by the derived class....
EState
Enumerate for state of the info server.
Definition InformationServer.h:42
@ issRecord
Definition InformationServer.h:48
@ issPause
Definition InformationServer.h:50
@ issRun
Definition InformationServer.h:46
@ issStop
Definition InformationServer.h:52
InformationServer()
Default constructor.
void setup(const std::string &name, const std::string &namePrefix, long vid, long deviceMask, long serverMask)
When device mask is non-zero, variables are added automatically on creation to this info server.
const char * getStateName(int state) const
Gets the name of the passed state.
void setState(EState)
Sets the current state.
void attachVariable(Variable *var, EClass cls)
Adds a variable to the variables vector.
void detachVariable(Variable *var)
Removes a variable from the variable vector.
Base class for all generic information objects to be able to put them in a typed list together.
Definition InformationBase.h:25
unsigned long long id_type
Type used for the identifying integer (64-bits).
Definition InformationBase.h:30
Class for creating and referencing global created data called result data. This class allows linking ...
Definition ResultData.h:20
Template for linking pointers of member function to Variable instances.
Definition VariableHandler.h:38
EEvent
Events send to the handler set with sf::Variable::setHandler.
Definition VariableTypes.h:130
Class for creating and referencing global or local created parameters or settings called variables....
Definition Variable.h:16
#define _GII_CLASS
Definition gii/global.h:38
Definition Application.h:10