Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
RsaInterface.h
Go to the documentation of this file.
1#pragma once
3#include <misc/gen/TVector.h>
4#include <misc/gen/Value.h>
6#include <rsa/iface/global.h>
7#include <utility>
8
9namespace sf
10{
11
12// Forward declaration.
14
19{
20 public:
25 {
26 explicit Parameters(int mode)
27 : _mode(mode)
28 {}
29
30 int _mode;
31 };
32
36 explicit RsaInterface(const Parameters&);
37
41 virtual ~RsaInterface();
42
47 bool initialize();
48
54
59 [[nodiscard]] EAcquisitionType getType() const;
60
66 bool storeSettings(bool read);
67
71 [[nodiscard]] int getError() const;
72
76 unsigned getChannelCount();
77
83 unsigned getGateCount(unsigned channel);
84
91 std::string getGateName(unsigned int gate, unsigned int channel = 0);
92
99 bool setPopManual(int channel, EPopManual pm);
100
106 [[nodiscard]] EPopManual getPopManual(int channel) const;
107
114 bool getParamInfo(IdType id, ParamInfo& info) const;
115
123 bool getParam(IdType id, Value& value) const;
124
133 bool setParam(IdType id, const Value& value, bool skip_event);
134
142 bool paramSetGet(IdType id, Value& value, bool skip_event);
143
155 virtual bool handleParam(IdType id, ParamInfo* info, const Value* setval, Value* getval) = 0;
156
160 bool setParam(EDefaultParam param, unsigned gate, unsigned ch, const Value& value, bool skip_event);
161
165 bool getParam(EDefaultParam param, unsigned gate, unsigned ch, Value& value) const;
166
173 virtual bool setRunMode(bool on, bool clear) = 0;
174
178 [[nodiscard]] virtual bool getRunMode() const = 0;
179
187 [[nodiscard]] virtual IdType
188 getParamId(EDefaultParam param, unsigned gate = UINT_MAX, unsigned channel = UINT_MAX) const = 0;// NOLINT(google-default-arguments)
189
195 virtual bool enumParamIds(IdList& ids) = 0;
196
201 void setParamHook(NotifyProc proc, void* data);
202
206 void setResultHook(NotifyProc proc, void* data);
207
215 [[nodiscard]] virtual IdType
216 getResultId(EDefaultResult result, unsigned gate = UINT_MAX, unsigned channel = UINT_MAX) const = 0;// NOLINT(google-default-arguments)
217
223 virtual bool enumResultIds(IdList& ids) = 0;
224
229
233 virtual bool handleResult(IdType id, ResultInfo* info, BufferInfo* bufInfo) = 0;
234
240
245 [[nodiscard]] bool isInitialized() const;
246
251 [[nodiscard]] std::string getProfilePath() const;
252
258
259 protected:
267 virtual bool doInitialize(bool init)
268 {
269 return true;
270 }
271
278
285
294
295 private:
296 // Holds the pointer to the parameter change procedure.
297 NotifyProc _paramNotifyProcedure;
298 // Holds the pointer to the result change procedure.
299 NotifyProc _resultNotifyProcedure;
300 // Holds the data set with the hook.
301 void* _paramNotifyData;
302 // Holds the data set with the hook.
303 void* _resultNotifyData;
304 // Holds flag of implementation initialization.
305 bool _initialized;
306 // Holds the implementation type.
307 EAcquisitionType _acquisitionType;
308
309 // Declarations of static functions and data members to be able to create registered RSA implementations.
311};
312
314{
315 return _initialized;
316}
317
318}// namespace sf
#define SF_DECL_IFACE(InterfaceType, ParamType, FuncName)
Declares a public static function in the class where it is used. Where: InterfaceType: Global typenam...
Definition TClassRegistration.h:71
Dialog containing multiple property pages.
Definition qt/PropertySheetDialog.h:14
Base class for the repetitive signal acquisition interface.
Definition RsaInterface.h:19
std::string getGateName(unsigned int gate, unsigned int channel=0)
Gets the name of the passed gate and channel.
unsigned getGateCount(unsigned channel)
Gets the amount of gates for this channels' implementation.
bool uninitialize()
Un-initializes the implementation. Calls doInitialize.
bool storeSettings(bool read)
Writes the non exported parameters to profile.
virtual IdType getParamId(EDefaultParam param, unsigned gate=UINT_MAX, unsigned channel=UINT_MAX) const =0
Gets the ID of the parameter for the specified gate.
virtual void addPropertyPages(PropertySheetDialog *sheet)
Adds controller specific property pages to the passed sheet.
bool getParamInfo(IdType id, ParamInfo &info) const
bool getParam(IdType id, Value &value) const
Gets the value of the specified parameter id. When the ID does not exist it returns false.
bool paramSetGet(IdType id, Value &value, bool skip_event)
Sets and immediately gets the same value again clipped or not.
unsigned getChannelCount()
Gets the amount of channels for this implementation.
bool getResultBuffer(IdType id, BufferInfo &bufInfo)
Gets the result buffer associated with the result id passed in the result hook at the time of the cal...
bool setParam(EDefaultParam param, unsigned gate, unsigned ch, const Value &value, bool skip_event)
Same as setParam() but the ID is formed by getParamId()
int getError() const
Gets the error value.
EAcquisitionType getType() const
bool initialize()
Initializes the implementation for operation. Calls doInitialize.
void callParamHook(IdType id)
Calls the hooked function when it exists.
bool isInitialized() const
For testing initialization by the implementation.
Definition RsaInterface.h:313
virtual bool handleParam(IdType id, ParamInfo *info, const Value *setval, Value *getval)=0
Pure virtual method to be overridden in a derived class. This method handles the interface parameters...
bool getResultInfo(IdType id, ResultInfo &info)
Retrieve information about the passed id.
virtual bool getRunMode() const =0
Gets the current run mode of a derived class.
bool getParam(EDefaultParam param, unsigned gate, unsigned ch, Value &value) const
Same as getParam() but the ID is formed by getParamId()
virtual bool handleResult(IdType id, ResultInfo *info, BufferInfo *bufInfo)=0
Handles results.
virtual bool doInitialize(bool init)
Must be overridden by a derived class. Should check the hardware configuration.
Definition RsaInterface.h:267
bool setPopManual(int channel, EPopManual pm)
Sets the pop manual state for a channel.
void setParamHook(NotifyProc proc, void *data)
Sets a procedure hook for the interface implementation to be called when the value changes as a resul...
virtual ~RsaInterface()
Virtual destructor for derived classes.
bool setType(EAcquisitionType at)
Sets the implementation type of the implementation used by the server side. Only allowed before and d...
EPopManual getPopManual(int channel) const
Gets the pop-manual state on a channel.
virtual bool setRunMode(bool on, bool clear)=0
Sets the implementation in hold or Run mode.
void setResultHook(NotifyProc proc, void *data)
Sets a procedure hook for the interface implementation to be called when there ias data result has da...
bool setParam(IdType id, const Value &value, bool skip_event)
Sets the value of the specified parameter id. When the ID does not exist it returns false.
virtual IdType getResultId(EDefaultResult result, unsigned gate=UINT_MAX, unsigned channel=UINT_MAX) const =0
Returns the ID of the result for the specified gate.
RsaInterface(const Parameters &)
Constructor for passing general structure for derived classes.
std::string getProfilePath() const
Returns the path of the static configuration of the driver.
void callResultHook(IdType id)
Calls the hooked function when it exists.
virtual bool enumParamIds(IdList &ids)=0
Gets all interface parameters ids.
virtual bool enumResultIds(IdList &ids)=0
Gets interface results ids.
Counted vector having additional methods and operators for ease of usage.
Definition TVector.h:25
Value container class able to performing arithmetic functions.
Definition Value.h:19
Definition Application.h:10
class _MISC_CLASS PropertySheetDialog
Definition gen/PropertySheetDialog.h:18
#define _RSA_CLASS
Definition rsa/iface/global.h:35
Parameters structure passed to an RSA implementation class.
Definition RsaInterface.h:25
Parameters(int mode)
Definition RsaInterface.h:26
int _mode
Definition RsaInterface.h:30
Definition RsaTypes.h:328
Structure to hold parameter information.
Definition RsaTypes.h:121
Definition RsaTypes.h:232
Type holding all types for the RsaInterface in a single namespaced structure.
Definition RsaTypes.h:22
EDefaultResult
Definition RsaTypes.h:471
EDefaultParam
Definition RsaTypes.h:384
unsigned long long IdType
Type for gathering parameter ID's.
Definition RsaTypes.h:26
EAcquisitionType
Definition RsaTypes.h:372
EPopManual
Enumerate for the pop manual function.
Definition RsaTypes.h:506