Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
RsaTypes.h
Go to the documentation of this file.
1#pragma once
2#include <misc/gen/Value.h>
3#include <rsa/iface/global.h>
4
5namespace sf
6{
7
11constexpr const char* US_METHOD_PEAK = "Peak";
12
16constexpr const char* US_METHOD_COPY = "Copy";
17
22{
26 typedef unsigned long long IdType;
27
32
36 typedef void (*NotifyProc)(void* data, IdType id);
37
42 {
43 ParamState() = default;
44
45 ParamState(const ParamState& ps) = default;
46
47 ParamState(std::string name, Value val)
48 : name(std::move(name))
49 , value(std::move(val))
50 {}
51
52 bool operator==(const ParamState& ps) const
53 {
54 return name == ps.name;
55 }
56
60 std::string name;
65 };
66
71
76 {
78 pfReadonly = 1 << 0,
80 pfEffectsParameter = 1 << 1,
82 pfEffectsResult = 1 << 2,
84 pfEffectsData = 1 << 3,
86 pfChannelSingle = 1 << 4,
88 pfGate = 1 << 5,
90 pfMethod = 1 << 6,
92 pfExport = 1 << 7,
94 pfSystem = 1 << 8,
96 pfWriteable = 1 << 9,
98 pfAlias = 1 << 10,
100 pfArchive = 1 << 11,
102 pfWriteAtOff = 1 << 12,
103 };
108 {
109 rfGate = 1 << 0,// Result is generated by a gate.
110 rfIndex = 1 << 1,// Result contains synced i/o input.
111 rfAsync = 1 << 2,// Result data is not sync synchronous.
112 rfAsyncIndex = 1 << 3,// Result keeps track of sync counter values at the time async data was generated.
113 rfHugeData = 1 << 4,// Result that generates a huge amount of data.
114 rfStored = 1 << 5,// Generates data to be stored.
115 };
116
121 {
123 {
124 Init();
125 }
126
128 {
129 Copy(pi);
130 }
131
133 {
134 Copy(pi);
135 return *this;
136 }
137
138 void Init()
139 {
140 Id = 0;
141 Flags = 0;
142 Gate = 0;
143 Index = 0;
144 Channel = 0;
145 Name.clear();
146 Unit.clear();
147 Description.clear();
148 Round.setType(Value::vitUndefined);
149 Default.set(Round);
150 Minimum.set(Round);
151 Maximum.set(Round);
152 States.clear();
153 }
154
156 {
157 Id = pi.Id;
158 Name = pi.Name;
159 Description = pi.Description;
160 Gate = pi.Gate;
161 Channel = pi.Channel;
162 Flags = pi.Flags;
163 Index = pi.Index;
164 Round = pi.Round;
165 Default = pi.Default;
166 Maximum = pi.Maximum;
167 Minimum = pi.Minimum;
168 States = pi.States;
169 return *this;
170 }
171
175 IdType Id{0};
180 unsigned Gate{0};
184 unsigned Index{0};
189 unsigned Channel{0};
193 std::string Name;
197 std::string Unit;
201 std::string Description;
225 int Flags{0};
226 };
227
232 {
233 ResultInfo() = default;
234
235 void reset()
236 {
237 Id = 0;
238 Flags = 0;
239 Gate = 0;
240 Index = 0;
241 Channel = 0;
242 Name.clear();
243 Description.clear();
244 Bits = 0;
245 WordSize = 0;
246 ArraySize = 0;
247 Offset = 0;
248 }
249
251 {
252 Copy(pi);
253 }
254
256 {
257 Copy(pi);
258 return *this;
259 }
260
262 {
263 Id = pi.Id;
264 Flags = pi.Flags;
265 Name = pi.Name;
266 Gate = pi.Gate;
267 Index = pi.Index;
268 Channel = pi.Channel;
269 WordSize = pi.WordSize;
270 ArraySize = pi.ArraySize;
271 Bits = pi.Bits;
272 Offset = pi.Offset;
273 return *this;
274 }
275
279 IdType Id{0};
283 int Flags{0};
288 unsigned Gate{0};
292 unsigned Index{0};
297 unsigned Channel{0};
301 std::string Name;
305 std::string Description;
309 unsigned Bits{0};
313 unsigned WordSize{0};
317 unsigned ArraySize{0};
321 int Offset{0};
322 };
323
328 {
332 BufferInfo() = default;
333
337 void Clear()
338 {
339 Buffer = nullptr;
340 Size = 0;
341 BlockBufSize = 0;
342 Remain = 0;
343 Counter = 0;
344 }
345
349 void* Buffer{nullptr};
353 size_t Size{0};
357 size_t BlockBufSize{0};
361 size_t Remain{0};
365 size_t Counter{0};
366 };
367
372 {
376 atEddyCurrent
377 };
378
383 enum EDefaultParam : uint64_t
384 {
386 apNone = 0x0000,
387 /*
388 * Interface parameters from here.
389 * 0x0000 is used for the interface implementation parameter.
390 * 0x0001 is used for the RunMode parameter.
391 */
393 apChannels = 0x0002,
395 apError = 0x0003,
396 // Restart is imminent when an error occurs less than zero.
397 // Acquisition cannot continue when errors occur larger than zero.
399 apErrorMessage = 0x0004,
401 apAmplitudeUnit = 0x0005,
403 apUserFirst = 0x000F,
404 /*
405 * Channel parameters from here.
406 */
408 apChannel_Mask = 0x4000,
410 apChannel_RepRate = 0x4001,
412 apChannel_SyncMode = 0x4002,
414 apChannel_Gates = 0x4003,
416 apChannel_Inputs = 0x4004,
418 apChannel_TimeUnits = 0x4005,
420 apChannel_CopyDelay = 0x4006,
422 apChannel_CopyRange = 0x4007,
424 apChannel_SampleRate = 0x4008,
426 apChannel_CopyEnable = 0x4009,
431 apChannel_PopManual = 0x400A,
436 apChannel_BiDirMode = 0x400B,
438 apChannel_UserFirst = 0x401F,
439 /*
440 * Gate parameters from here.
441 */
443 apGate_Mask = 0x8000,
445 apGate_Name = 0x8001,
447 apGate_Delay = 0x8002,
449 apGate_Range = 0x8003,
451 apGate_SlaveTo = 0x8004,
453 apGate_Enable = 0x8005,
455 apGate_Method = 0x8006,
457 apGate_Threshold = 0x8007,
459 apGate_Amplitude = 0x8008,
461 apGate_TimeOfFlight = 0x8009,
463 apGate_UserFirst = 0x801F,
464 };
465
470 enum EDefaultResult : uint64_t
471 {
473 arNone = 0x0000,
475 arUserFirst = 0x0001,
476 /*
477 * Channel results from here.
478 */
480 arChannel_Mask = 0x4000,
482 arChannel_PopIndex = 0x4001,
484 arChannel_CopyData = 0x4002,
486 arChannel_CopyIndex = 0x4003,
488 arChannel_UserFirst = 0x401F,
489 /*
490 * Gate results from here.
491 */
493 arGate_Amplitude = 0x8001,
494 arGate_TimeOfFlight = 0x8002,
495 arGate_Copy = 0x8003,
497 arGate_Mask = 0x8000,
499 arGate_UserFirst = 0x801F
500 };
501
506 {
508 pmDisabled = 0,
512 pmTrigger
513 };
514};
515
516}// namespace sf
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
constexpr const char * US_METHOD_PEAK
Names used for method identification.
Definition RsaTypes.h:11
constexpr const char * US_METHOD_COPY
Method for generating sample copy results in array's of Amplitude values.
Definition RsaTypes.h:16
#define _RSA_CLASS
Definition rsa/iface/global.h:35
Definition RsaTypes.h:328
BufferInfo()=default
Initializing constructor.
void Clear()
Definition RsaTypes.h:337
Structure to hold parameter information.
Definition RsaTypes.h:121
ParamInfo(const ParamInfo &pi)
Definition RsaTypes.h:127
std::string Name
Definition RsaTypes.h:193
Value Minimum
Definition RsaTypes.h:213
ParamInfo & operator=(const ParamInfo &pi)
Definition RsaTypes.h:132
ParamInfo & Copy(const ParamInfo &pi)
Definition RsaTypes.h:155
int Flags
Definition RsaTypes.h:225
Value Maximum
Definition RsaTypes.h:217
Value Default
Definition RsaTypes.h:209
IdType Id
Definition RsaTypes.h:175
std::string Description
Definition RsaTypes.h:201
unsigned Index
Definition RsaTypes.h:184
std::string Unit
Definition RsaTypes.h:197
Value Round
Definition RsaTypes.h:205
void Init()
Definition RsaTypes.h:138
unsigned Channel
Definition RsaTypes.h:189
unsigned Gate
Definition RsaTypes.h:180
ParamInfo()
Definition RsaTypes.h:122
ParamStates States
Definition RsaTypes.h:221
Structure to hold a single state consisting of a name and value.
Definition RsaTypes.h:42
Value value
Holds the value of the state.
Definition RsaTypes.h:64
ParamState(std::string name, Value val)
Definition RsaTypes.h:47
ParamState(const ParamState &ps)=default
std::string name
Holds the name of the state.
Definition RsaTypes.h:60
bool operator==(const ParamState &ps) const
Definition RsaTypes.h:52
Definition RsaTypes.h:232
unsigned Channel
Holds the channel number of this parameter. When channel is UINT_MAX the param is not a gate related ...
Definition RsaTypes.h:297
std::string Name
Name of the parameter.
Definition RsaTypes.h:301
void reset()
Definition RsaTypes.h:235
unsigned Index
Param index in the hierarchy of the gate or non gate params.
Definition RsaTypes.h:292
IdType Id
Holds a unique id for the current situation.
Definition RsaTypes.h:279
int Flags
Flags.
Definition RsaTypes.h:283
std::string Description
Usage off the parameter of the parameter.
Definition RsaTypes.h:305
ResultInfo(const ResultInfo &pi)
Definition RsaTypes.h:250
int Offset
Level offset of the generated data.
Definition RsaTypes.h:321
ResultInfo & operator=(const ResultInfo &pi)
Definition RsaTypes.h:255
ResultInfo & Copy(const ResultInfo &pi)
Definition RsaTypes.h:261
unsigned Bits
Amount of Bits used to store the actual value.
Definition RsaTypes.h:309
unsigned WordSize
Amount of bytes 1, 2 or 4 (later 8) used for storing a single value.
Definition RsaTypes.h:313
unsigned Gate
Holds the gate number this gate belongs to. When gate is UINT_MAX the param is not a gate related par...
Definition RsaTypes.h:288
unsigned ArraySize
Amount of values in an array for an arrayed value.
Definition RsaTypes.h:317
Type holding all types for the RsaInterface in a single namespaced structure.
Definition RsaTypes.h:22
EDefaultResult
Definition RsaTypes.h:471
TVector< ParamState > ParamStates
Vector to specify states.
Definition RsaTypes.h:70
TVector< IdType > IdList
Type for gathering parameter ID's.
Definition RsaTypes.h:31
EDefaultParam
Definition RsaTypes.h:384
EResultFlag
Result flags for defining result behaviour.
Definition RsaTypes.h:108
unsigned long long IdType
Type for gathering parameter ID's.
Definition RsaTypes.h:26
EAcquisitionType
Definition RsaTypes.h:372
@ atUltrasonic
Definition RsaTypes.h:374
EPopManual
Enumerate for the pop manual function.
Definition RsaTypes.h:506
@ pmReady
Definition RsaTypes.h:510
EParamFlag
Parameter flags for defining parameter behaviour.
Definition RsaTypes.h:76