itom
Loading...
Searching...
No Matches
paramMeta.h
1/* ********************************************************************
2 itom software
3 URL: http://www.uni-stuttgart.de/ito
4 Copyright (C) 2020, Institut für Technische Optik (ITO),
5 Universität Stuttgart, Germany
6
7 This file is part of itom and its software development toolkit (SDK).
8
9 itom is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Library General Public Licence as published by
11 the Free Software Foundation; either version 2 of the Licence, or (at
12 your option) any later version.
13
14 In addition, as a special exception, the Institut für Technische
15 Optik (ITO) gives you certain additional rights.
16 These rights are described in the ITO LGPL Exception version 1.0,
17 which can be found in the file LGPL_EXCEPTION.txt in this package.
18
19 itom is distributed in the hope that it will be useful, but
20 WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
22 General Public Licence for more details.
23
24 You should have received a copy of the GNU Library General Public License
25 along with itom. If not, see <http://www.gnu.org/licenses/>.
26*********************************************************************** */
27
28#pragma once
29
30/* includes */
31
32#include "byteArray.h"
33#include "commonGlobal.h"
34#include "retVal.h"
35#include "typeDefs.h"
36
37#include <limits>
38
39/* definition and macros */
40/* global variables (avoid) */
41/* content */
42
43namespace ito
44{
57class ITOMCOMMON_EXPORT ParamMeta
58{
59public:
67 {
68 rttiUnknown = 0,
69 rttiCharMeta = 1,
70 rttiIntMeta = 2,
71 rttiDoubleMeta = 3,
72 rttiStringMeta = 4,
73 rttiHWMeta = 5,
74 rttiDObjMeta = 6,
75 rttiIntArrayMeta = 7,
76 rttiDoubleArrayMeta = 8,
77 rttiCharArrayMeta = 9,
78 rttiIntervalMeta = 10,
79 rttiDoubleIntervalMeta = 11,
81 rttiRangeMeta = 12,
83 rttiRectMeta = 13,
85 rttiStringListMeta = 14
86 };
87
99 {
100 Linear = 0x0001,
101 Logarithmic = 0x0002,
102 Boolean = 0x0004,
103 PureNumber = 0x0008,
104 HexNumber = 0x0010,
105 IPV4Address = 0x0020,
106 MACAddress = 0x0040,
107 UnknownRepresentation = 0x0080
108 };
109
111 explicit ParamMeta(ito::ByteArray category = ito::ByteArray());
112
114 explicit ParamMeta(MetaRtti type, ito::ByteArray category = ito::ByteArray());
115
116 ParamMeta(const ParamMeta &copy);
117
118 ParamMeta &operator=(const ParamMeta &rhs);
119
121 virtual ~ParamMeta();
122
124 inline MetaRtti getType() const
125 {
126 return m_type;
127 }
128
130 inline ito::ByteArray getCategory() const
131 {
132 return m_category;
133 }
134
135 void setCategory(const ito::ByteArray &category);
136
137 virtual bool operator==(const ParamMeta &other) const;
138
139 bool operator!=(const ParamMeta &other) const
140 {
141 return !(*this == other);
142 }
143
144protected:
145 MetaRtti m_type;
147};
148
159class ITOMCOMMON_EXPORT CharMeta : public ParamMeta
160{
161public:
164 explicit CharMeta(char minVal, char maxVal, char stepSize = 1,
165 ito::ByteArray category = ito::ByteArray());
166
167 CharMeta(const CharMeta &copy);
168
169 CharMeta &operator=(const CharMeta &rhs);
170
171 virtual bool operator==(const ParamMeta &other) const;
172
175 static CharMeta *all(ito::ByteArray category = ito::ByteArray());
176
178 inline char getMin() const
179 {
180 return m_minVal;
181 }
182
184 inline char getMax() const
185 {
186 return m_maxVal;
187 }
188
190 inline char getStepSize() const
191 {
192 return m_stepSize;
193 }
194
196 inline ito::ByteArray getUnit() const
197 {
198 return m_unit;
199 }
200
202 void setUnit(const ito::ByteArray &unit);
203
206 {
207 return m_representation;
208 }
209
211 void setRepresentation(ParamMeta::tRepresentation representation);
212
214
218 void setMin(char val);
219
221
225 void setMax(char val);
226
228
232 void setStepSize(char val);
233
234 private:
235 char m_minVal;
236 char m_maxVal;
237 char m_stepSize; // >= 1
240};
241
252class ITOMCOMMON_EXPORT IntMeta : public ParamMeta
253{
254 public:
257 explicit IntMeta(int32 minVal, int32 maxVal, int32 stepSize = 1,
258 ito::ByteArray category = ito::ByteArray());
259
260 IntMeta(const IntMeta &copy);
261
262 IntMeta &operator=(const IntMeta &rhs);
263
264 virtual bool operator==(const ParamMeta &other) const;
265
268 static IntMeta *all(ito::ByteArray category = ito::ByteArray());
269
271 inline int32 getMin() const
272 {
273 return m_minVal;
274 }
275
277 inline int32 getMax() const
278 {
279 return m_maxVal;
280 }
281
283 inline int32 getStepSize() const
284 {
285 return m_stepSize;
286 }
287
289 inline ito::ByteArray getUnit() const
290 {
291 return m_unit;
292 }
293
295 void setUnit(const ito::ByteArray &unit);
296
299 {
300 return m_representation;
301 }
302
304 void setRepresentation(ParamMeta::tRepresentation behaviour);
305
307
311 void setMin(int32 val);
312
314
318 void setMax(int32 val);
319
321
325 void setStepSize(int32 val);
326
327 private:
328 int32 m_minVal;
329 int32 m_maxVal;
330 int32 m_stepSize; // >= 1
333};
334
345class ITOMCOMMON_EXPORT DoubleMeta : public ParamMeta
346{
347 public:
352 {
355 Scientific
356 };
357
359 explicit DoubleMeta(float64 minVal, float64 maxVal, float64 stepSize = 0.0 /*0.0 means no specific step size*/,
360 ito::ByteArray category = ito::ByteArray());
361
362 DoubleMeta(const DoubleMeta &copy);
363
364 DoubleMeta &operator=(const DoubleMeta &rhs);
365
366 virtual bool operator==(const ParamMeta &other) const;
367
370 static DoubleMeta *all(ito::ByteArray category = ito::ByteArray());
371
373 inline float64 getMin() const
374 {
375 return m_minVal;
376 }
377
379 inline float64 getMax() const
380 {
381 return m_maxVal;
382 }
383
385 inline float64 getStepSize() const
386 {
387 return m_stepSize;
388 }
389
391 inline ito::ByteArray getUnit() const
392 {
393 return m_unit;
394 }
395
397 void setUnit(const ito::ByteArray &unit);
398
400 inline int getDisplayPrecision() const
401 {
402 return m_displayPrecision;
403 }
404
406 void setDisplayPrecision(int displayPrecision);
407
410 {
411 return m_displayNotation;
412 }
413
415 void setDisplayNotation(DoubleMeta::tDisplayNotation displayNotation);
416
419 {
420 return m_representation;
421 }
422
424 void setRepresentation(ParamMeta::tRepresentation representation);
425
427
431 void setMin(float64 val);
432
434
438 void setMax(float64 val);
439
441
445 void setStepSize(float64 val);
446
447 private:
448 float64 m_minVal;
449 float64 m_maxVal;
450 float64 m_stepSize; // >= 0, 0.0 means no specific step size
456};
457
468class ITOMCOMMON_EXPORT HWMeta : public ParamMeta
469{
470 public:
472
478 explicit HWMeta(uint32 minType, ito::ByteArray category = ito::ByteArray());
479
481
486 explicit HWMeta(const ito::ByteArray &hwAddInName, ito::ByteArray category = ito::ByteArray());
487
489 HWMeta(const HWMeta &cpy);
490
491 virtual bool operator==(const ParamMeta &other) const;
492
494 HWMeta &operator=(const HWMeta &rhs);
495
497 inline uint32 getMinType() const
498 {
499 return m_minType;
500 }
501
503 inline ito::ByteArray getHWAddInName() const
504 {
505 return m_HWName;
506 }
507
508 private:
509 uint32 m_minType;
511};
512
513class StringMetaPrivate; // forward declaration
514
526class ITOMCOMMON_EXPORT StringMeta : public ParamMeta
527{
528 public:
529 enum tType
530 {
533 RegExp
534 };
535
537
542 StringMeta(tType type, ito::ByteArray category = ito::ByteArray());
543
545
551 StringMeta(tType type, const char *val, ito::ByteArray category = ito::ByteArray());
552
554
560 StringMeta(tType type, const ito::ByteArray &val, ito::ByteArray category = ito::ByteArray());
561
563 StringMeta(const StringMeta &cpy);
564
566 virtual ~StringMeta();
567
568 StringMeta &operator+=(const char *val);
569 StringMeta &operator=(const StringMeta &rhs);
570 virtual bool operator==(const ParamMeta &other) const;
571
572 tType getStringType() const;
573 void setStringType(tType type);
574 int getLen() const;
575 const char *getString(
576 int idx = 0) const;
577 bool addItem(const char *val);
578 bool addItem(const ito::ByteArray &val);
579 void clearItems();
580
581 private:
583};
584
593class ITOMCOMMON_EXPORT DObjMeta : public ParamMeta
594{
595 public:
596
599 explicit DObjMeta(int minDim = 0, int maxDim = (std::numeric_limits<int>::max)(),
600 ito::ByteArray category = ito::ByteArray());
601
603 DObjMeta(const DObjMeta &cpy);
604
606 DObjMeta &operator=(const DObjMeta &rhs);
607
608 virtual bool operator==(const ParamMeta &other) const;
609
611 int getNumAllowedDataTypes() const;
612
614 ito::tDataType getAllowedDataType(int index) const;
615
617 bool isDataTypeAllowed(ito::tDataType dataType) const;
618
620 void appendAllowedDataType(ito::tDataType dataType);
621
623 inline int getMinDim() const
624 {
625 return m_minDim;
626 }
627
629 inline int getMaxDim() const
630 {
631 return m_maxDim;
632 }
633
635 inline void setMinDim(int minDim)
636 {
637 m_minDim = minDim;
638 }
639
641 inline void setMaxDim(int maxDim)
642 {
643 m_maxDim = maxDim;
644 }
645
646 private:
651 int m_minDim;
652 int m_maxDim;
653};
654
663class ITOMCOMMON_EXPORT ListMeta
664{
665public:
667 ListMeta();
668
669 explicit ListMeta(size_t numMin, size_t numMax, size_t numStepSize = 1);
670
672 virtual ~ListMeta();
673
674 virtual bool operator==(const ListMeta &other) const;
675
677 inline size_t getNumMin() const
678 {
679 return m_numMin;
680 }
681
683 inline size_t getNumMax() const
684 {
685 return m_numMax;
686 }
687
689 inline size_t getNumStepSize() const
690 {
691 return m_numStep;
692 }
693
695
699 void setNumMin(size_t val);
700
702
706 void setNumMax(size_t val);
707
709
713 void setNumStepSize(size_t val);
714
715private:
716 size_t m_numMin;
717 size_t m_numMax;
718 size_t m_numStep;
719};
720
732class ITOMCOMMON_EXPORT CharArrayMeta : public CharMeta, public ListMeta
733{
734 public:
735 explicit CharArrayMeta(char minVal, char maxVal, char stepSize = 1, ito::ByteArray category = ito::ByteArray());
736 explicit CharArrayMeta(char minVal, char maxVal, char stepSize, size_t numMin, size_t numMax,
737 size_t numStepSize = 1, ito::ByteArray category = ito::ByteArray());
738
740 CharArrayMeta(const CharArrayMeta &cpy);
741
743 CharArrayMeta &operator=(const CharArrayMeta &rhs);
744
745 virtual bool operator==(const ParamMeta &other) const;
746};
747
759class ITOMCOMMON_EXPORT IntArrayMeta : public IntMeta, public ListMeta
760{
761 public:
762 explicit IntArrayMeta(int32 minVal, int32 maxVal, int stepSize = 1, ito::ByteArray category = ito::ByteArray());
763 explicit IntArrayMeta(int32 minVal, int32 maxVal, int stepSize, size_t numMin, size_t numMax,
764 size_t numStepSize = 1, ito::ByteArray category = ito::ByteArray());
765
767 IntArrayMeta(const IntArrayMeta &cpy);
768
770 IntArrayMeta &operator=(const IntArrayMeta &rhs);
771
772 virtual bool operator==(const ParamMeta &other) const;
773};
774
786class ITOMCOMMON_EXPORT DoubleArrayMeta : public DoubleMeta, public ListMeta
787{
788 public:
789 explicit DoubleArrayMeta(float64 minVal, float64 maxVal, float64 stepSize = 0.0,
790 ito::ByteArray category = ito::ByteArray());
791
792 explicit DoubleArrayMeta(float64 minVal, float64 maxVal, float64 stepSize, size_t numMin, size_t numMax,
793 size_t numStepSize = 1, ito::ByteArray category = ito::ByteArray());
794
797
799 DoubleArrayMeta &operator=(const DoubleArrayMeta &rhs);
800
801 virtual bool operator==(const ParamMeta &other) const;
802};
803
816class ITOMCOMMON_EXPORT DoubleIntervalMeta : public DoubleMeta
817{
818 public:
819 explicit DoubleIntervalMeta(float64 minVal, float64 maxVal, float64 stepSize = 0.0,
820 ito::ByteArray category = ito::ByteArray());
821 explicit DoubleIntervalMeta(float64 minVal, float64 maxVal, float64 stepSize, float64 sizeMin, float64 sizeMax,
822 float64 sizeStep = 0.0, ito::ByteArray category = ito::ByteArray());
823
826
827 virtual bool operator==(const ParamMeta &other) const;
828
830 DoubleIntervalMeta &operator=(const DoubleIntervalMeta &rhs);
831
833 inline float64 getSizeMin() const
834 {
835 return m_sizeMin;
836 }
837
839 inline float64 getSizeMax() const
840 {
841 return m_sizeMax;
842 }
843
845 inline float64 getSizeStepSize() const
846 {
847 return m_sizeStep;
848 }
849
851
855 void setSizeMin(float64 val);
856
858
862 void setSizeMax(float64 val);
863
865
869 void setSizeStep(float64 val);
870
871 private:
872 float64 m_sizeMin;
873 float64 m_sizeMax;
874 float64 m_sizeStep;
875};
876
889class ITOMCOMMON_EXPORT StringListMeta : public StringMeta, public ListMeta
890{
891 public:
893
901 explicit StringListMeta(tType type, size_t numMin, size_t numMax, size_t numStepSize = 1,
902 ito::ByteArray category = ito::ByteArray());
903
905
914 explicit StringListMeta(tType type, const char *val, size_t numMin, size_t numMax, size_t numStepSize = 1,
915 ito::ByteArray category = ito::ByteArray());
916
918
927 explicit StringListMeta(tType type, const ito::ByteArray &val, size_t numMin, size_t numMax, size_t numStepSize = 1,
928 ito::ByteArray category = ito::ByteArray());
929
931 StringListMeta(const StringListMeta &cpy);
932
934 virtual ~StringListMeta();
935
936 virtual bool operator==(const ParamMeta &other) const;
937
939 StringListMeta &operator=(const StringListMeta &rhs);
940};
941
956class ITOMCOMMON_EXPORT IntervalMeta : public IntMeta
957{
958 public:
959 explicit IntervalMeta(int32 minVal, int32 maxVal, int32 stepSize = 1, ito::ByteArray category = ito::ByteArray());
960 explicit IntervalMeta(int32 minVal, int32 maxVal, int32 stepSize, int32 sizeMin, int32 sizeMax,
961 int32 intervalStep = 1, ito::ByteArray category = ito::ByteArray());
962
964 IntervalMeta(const IntervalMeta &cpy);
965
967 IntervalMeta &operator=(const IntervalMeta &rhs);
968
969 virtual bool operator==(const ParamMeta &other) const;
970
972 inline int getSizeMin() const
973 {
974 return m_sizeMin;
975 }
976
978 inline int getSizeMax() const
979 {
980 return m_sizeMax;
981 }
982
984 inline int getSizeStepSize() const
985 {
986 return m_sizeStep;
987 }
988
989 inline bool isIntervalNotRange() const
990 {
991 return m_isIntervalNotRange;
992 }
993
995
999 void setIntervalMin(int32 val);
1000
1002
1006 void setIntervalMax(int32 val);
1007
1009
1013 void setIntervalStep(int32 val);
1014
1015 protected:
1016 int32 m_sizeMin;
1017 int32 m_sizeMax;
1018 int32 m_sizeStep;
1021};
1022
1042class ITOMCOMMON_EXPORT RangeMeta : public IntervalMeta
1043{
1044 public:
1045 explicit RangeMeta(int32 minVal, int32 maxVal, int32 stepSize = 1, ito::ByteArray category = ito::ByteArray());
1046 explicit RangeMeta(int32 minVal, int32 maxVal, int32 stepSize, size_t sizeMin, size_t sizeMax, size_t sizeStep = 1,
1047 ito::ByteArray category = ito::ByteArray());
1048
1050 RangeMeta(const RangeMeta &cpy);
1051
1053 RangeMeta &operator=(const RangeMeta &rhs);
1054};
1055
1067class ITOMCOMMON_EXPORT RectMeta : public ParamMeta
1068{
1069 public:
1070 explicit RectMeta(const ito::RangeMeta &widthMeta, const ito::RangeMeta &heightMeta,
1071 ito::ByteArray category = ito::ByteArray());
1072
1074 RectMeta(const RectMeta &cpy);
1075
1077 RectMeta &operator=(const RectMeta &rhs);
1078
1079 inline const ito::RangeMeta& getWidthRangeMeta() const
1080 {
1081 return m_widthMeta;
1082 }
1083
1084 inline const ito::RangeMeta& getHeightRangeMeta() const
1085 {
1086 return m_heightMeta;
1087 }
1088
1089 void setWidthRangeMeta(const ito::RangeMeta &widthMeta);
1090 void setHeightRangeMeta(const ito::RangeMeta &heightMeta);
1091
1094 {
1095 return m_heightMeta.getUnit();
1096 }
1097
1099 void setUnit(const ito::ByteArray &unit);
1100
1101 virtual bool operator==(const ParamMeta &other) const;
1102
1103 protected:
1104 ito::RangeMeta m_heightMeta;
1105 ito::RangeMeta m_widthMeta;
1106};
1107
1108} // end namespace ito
This is a Qt-free class for byte arrays (strings) without specific encoding information.
Definition byteArray.h:65
Meta-information for Param of type CharArrayMeta.
Definition paramMeta.h:733
meta-information for Param of type Char.
Definition paramMeta.h:160
ParamMeta::tRepresentation m_representation
hint for display representation in GUI widget
Definition paramMeta.h:239
char getMax() const
returns step size
Definition paramMeta.h:184
ito::ByteArray m_unit
unit of value, e.g. 'mm', ...
Definition paramMeta.h:238
ParamMeta::tRepresentation getRepresentation() const
sets display representation
Definition paramMeta.h:205
ito::ByteArray getUnit() const
sets unit string of this parameter
Definition paramMeta.h:196
char getStepSize() const
returns unit
Definition paramMeta.h:190
char getMin() const
returns maximum value
Definition paramMeta.h:178
Meta-information for Param of type DObjPtr.
Definition paramMeta.h:594
void setMinDim(int minDim)
set the maximum number of dimensions of data object
Definition paramMeta.h:635
ito::ByteArray m_allowedTypes
Definition paramMeta.h:650
int getMinDim() const
returns maximum number of dimensions of data object
Definition paramMeta.h:623
int getMaxDim() const
set the minimum allowed dimensions of data object
Definition paramMeta.h:629
Meta-information for Param of type DoubleArrayMeta.
Definition paramMeta.h:787
Meta-information for Param of type DoubleIntervalMeta.
Definition paramMeta.h:817
float64 getSizeMin() const
returns maximum size of range
Definition paramMeta.h:833
float64 getSizeMax() const
returns step size of size of range
Definition paramMeta.h:839
Meta-information for ito::Param of type Double.
Definition paramMeta.h:346
int m_displayPrecision
Definition paramMeta.h:452
float64 getMin() const
returns maximum value
Definition paramMeta.h:373
ito::ByteArray m_unit
unit of value, e.g. 'mm', ...
Definition paramMeta.h:451
ito::ByteArray getUnit() const
sets unit string of this parameter
Definition paramMeta.h:391
tDisplayNotation m_displayNotation
indicates how this double number should be rendered (e.g. in GUI widgets)
Definition paramMeta.h:454
int getDisplayPrecision() const
sets display precision
Definition paramMeta.h:400
DoubleMeta::tDisplayNotation getDisplayNotation() const
sets display notation
Definition paramMeta.h:409
float64 getMax() const
returns step size
Definition paramMeta.h:379
float64 getStepSize() const
returns unit
Definition paramMeta.h:385
ParamMeta::tRepresentation getRepresentation() const
sets display representation
Definition paramMeta.h:418
tDisplayNotation
Display notation style if the related parameters is displayed in any widget.
Definition paramMeta.h:352
@ Automatic
double number is automatically rendered in any GUI element (default)
Definition paramMeta.h:353
@ Fixed
if possible, the double number should be shown as fixed number, e.g. 1000.00
Definition paramMeta.h:354
ParamMeta::tRepresentation m_representation
hint for display representation in GUI widget
Definition paramMeta.h:455
Meta-information for Param of type HWPtr.
Definition paramMeta.h:469
ito::ByteArray m_HWName
zero-terminated name of specific plugin-name or invalid if not defined
Definition paramMeta.h:510
uint32 m_minType
type-bitmask which is minimally required. default: 0
Definition paramMeta.h:509
uint32 getMinType() const
returns name of specific hardware plugin
Definition paramMeta.h:497
Definition paramMeta.h:760
Meta-information for Param of type Int.
Definition paramMeta.h:253
ParamMeta::tRepresentation m_representation
hint for display behaviour in GUI widget
Definition paramMeta.h:332
int32 getMin() const
returns maximum value
Definition paramMeta.h:271
int32 getStepSize() const
returns unit
Definition paramMeta.h:283
int32 getMax() const
returns step size
Definition paramMeta.h:277
ito::ByteArray m_unit
unit of value, e.g. 'mm', ...
Definition paramMeta.h:331
ParamMeta::tRepresentation getRepresentation() const
sets display representation
Definition paramMeta.h:298
ito::ByteArray getUnit() const
sets unit string of this parameter
Definition paramMeta.h:289
Meta-information for Param of type IntArrayMeta that represent an interval [minimum,...
Definition paramMeta.h:957
bool m_isIntervalNotRange
Definition paramMeta.h:1019
int getSizeMin() const
returns maximum size of interval or range
Definition paramMeta.h:972
int getSizeMax() const
returns step size of size of interval or range
Definition paramMeta.h:978
Additional base class for all list or array meta information.
Definition paramMeta.h:664
size_t getNumMax() const
returns step size of number of values
Definition paramMeta.h:683
size_t getNumMin() const
returns maximum number of values
Definition paramMeta.h:677
Base class for all meta-information classes.
Definition paramMeta.h:58
MetaRtti
Runtime type information.
Definition paramMeta.h:67
tRepresentation
The representation of number types indicates the type of widget that is suited best to display and ch...
Definition paramMeta.h:99
MetaRtti getType() const
returns category name of this parameter (default: empty ByteArray)
Definition paramMeta.h:124
ito::ByteArray m_category
optional category name of this parameter
Definition paramMeta.h:146
Meta-information for Param of type IntArrayMeta that represent a range [minVal, maxVal].
Definition paramMeta.h:1043
Meta-information for Param of type IntArrayMeta that represent a rectangle (left, top,...
Definition paramMeta.h:1068
ito::ByteArray getUnit() const
sets unit string of this parameter
Definition paramMeta.h:1093
Meta-information for Param of type STringListMeta.
Definition paramMeta.h:890
Meta-information for Param of type String.
Definition paramMeta.h:527
tType
Definition paramMeta.h:530
@ String
string elements should be considered as strings (exact match)
Definition paramMeta.h:531
@ Wildcard
string elements should be considered as wildcard-expressions (e.g. *.doc)
Definition paramMeta.h:532
Definition paramMeta.cpp:488
Definition apiFunctionsGraph.cpp:40
bool operator==(const ByteArray &a1, const char *a2)
comparison operator that returns true if the content of a1 is equal to the given zero-terminated stri...
Definition byteArray.h:198
tDataType
Definition typeDefs.h:88