MeVisLab Toolbox Reference
mlFields.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_FIELDS_H
14#define ML_FIELDS_H
15
20
21// ML-includes
22#include "mlInitSystemML.h"
23#include "mlField.h"
24#include "mlRuntimeSubClass.h"
25
26#include "mlPlane.h"
27#include "mlRotation.h"
28#include "mlSubImageBoxd.h"
29#include "mlRefCountedBase.h"
30
31#include <type_traits>
32
34// Inventor Nodes
35class SoNode;
36
38
39
41
43class Module;
44class OutputConnector;
45class InputConnector;
47
48//-------------------------------------------------------------------------
50//-------------------------------------------------------------------------
52
53//-------------------------------------------------------------------------
56//-------------------------------------------------------------------------
57class MLEXPORT BoolField : public Field
58{
61
62
63public:
64
67
70 BoolField(const std::string& name);
71
73 void setStringValue(const std::string& value) override;
74
77
81
84
86 std::string getStringValue() const override;
87
89 bool getBoolValue() const;
90
92 bool isOn() const;
93
95 void setValue(bool boolValue) { setBoolValue(boolValue); }
96
98 void updateValue(bool boolValue) { updateBoolValue(boolValue); }
99
101 bool getValue() const { return getBoolValue(); }
102
103protected:
104
106 void setValueFromField(const Field& field) override;
107
108private:
109
111 bool* _valuePtr;
112
114 bool _internalValue;
115
117 void _initialize(const std::string& name="", bool* valuePtr=nullptr);
118};
119
120
121//-------------------------------------------------------------------------
124//-------------------------------------------------------------------------
125class MLEXPORT IntField : public Field
126{
129
130public:
131
134
137 IntField(const std::string& name);
138
140 void setStringValue(const std::string& value) override;
141
144
148
152 std::string getStringValue() const override;
153
156
158 void setValue(MLint intValue) { setIntValue(intValue); }
159
161 void updateValue(MLint intValue) { updateIntValue(intValue); }
162
164 MLint getValue() const { return getIntValue(); }
165
166protected:
167
169 void setValueFromField(const Field& field) override;
170
171private:
172
174 MLintPtr _valuePtr;
175
177 MLint _internalValue;
178
180 void _initialize(const std::string& name="", MLintPtr valuePtr=nullptr);
181
184 MLint _minValue;
187 MLint _maxValue;
188};
189
190//-------------------------------------------------------------------------
193//-------------------------------------------------------------------------
195{
198
199public:
207 EnumField(const std::string& name, const std::string enumerationItemNames[], size_t numEnumerationItems);
208
216 EnumField(const std::string& name, const char* const* enumerationItemNames, size_t numEnumerationItems);
217
225 EnumField(const std::string& name, const std::vector<std::string> &enumerationItemNames);
226
228 ~EnumField() override;
229
233 void setStringValue(const std::string& value) override;
234
237 void setStringValueDefaulted(const std::string& value);
238
241
245
249 std::string getStringValue() const override;
250
252 int getEnumValue() const;
253
255 struct EnumEntry {
256 EnumEntry():value(-1) {}
257 EnumEntry(const std::string& sv, int v) : stringValue(sv), value(v) { }
258
260 std::string stringValue;
262 int value;
263 };
264
269 const EnumEntry& getEnumEntryAtIndex(size_t index) const;
270
273
275 void setValue(int enumValue) { setEnumValue(enumValue); }
276
278 void updateValue(int enumValue) { updateEnumValue(enumValue); }
279
281 int getValue() const { return getEnumValue(); }
282
283protected:
284
286 void _initialize(const std::string& name="", size_t numEnums=0, int* valuePtr=nullptr);
287
289 void _setEnumerationNames(const std::string enumNames[]);
291 void _setEnumerationNames(const char* const* enumNames);
293 void _setEnumerationNames(const std::vector<std::string> &enumNames);
295 void _setEnumerationNames(const std::vector<EnumField::EnumEntry>& enumValues, int initialValue);
296
300
303
306
308 std::vector<EnumEntry> _entries;
309
310protected:
313};
314
317template <typename EnumType>
319{
320public:
322 struct Entry {
323 Entry():stringValue(nullptr), value(-1) {}
324 Entry(const char* sv, EnumType v) : stringValue(sv), value(v) { }
325
327 const char* stringValue;
330 };
331
332public:
334 void add(const char* stringValue, EnumType value) {
335 _entries.push_back(EnumField::EnumEntry(stringValue, static_cast<int>(value)));
336 }
337
339 void add(const std::string& stringValue, EnumType value) {
340 _entries.push_back(EnumField::EnumEntry(stringValue, static_cast<int>(value)));
341 }
342
344 void add(const Entry& value) {
345 _entries.push_back(EnumField::EnumEntry(value.stringValue, static_cast<int>(value.value)));
346 }
347
349 EnumValues& operator<<(const Entry& value) {
350 add(value);
351 return *this;
352 }
353
355 const std::vector<EnumField::EnumEntry>& getEntries() const { return _entries; }
356
357protected:
358 std::vector<EnumField::EnumEntry> _entries;
359};
360
364#define ML_ENUM_VALUE(enumValue) internal::createEnumEntry(#enumValue, enumValue)
365
368#define ML_EXTERNAL_ENUM_VALUE(enumClass, enumValue) internal::createEnumEntry(#enumValue, enumClass::enumValue)
369
370namespace internal {
372 template <typename EnumType>
373 inline typename EnumValues<EnumType>::Entry createEnumEntry(const char* value, EnumType enumValue) {
374 return typename EnumValues<EnumType>::Entry(value, enumValue);
375 }
376}
377
378//-------------------------------------------------------------------------
381//-------------------------------------------------------------------------
382template <typename EnumType>
384{
385public:
386 static_assert(sizeof(std::underlying_type<EnumType>) <= sizeof(int), "The underlying type cannot be bigger than int!");
387
390 {
391 const std::vector<EnumField::EnumEntry>& entries = enumValues.getEntries();
392 _initialize(name, entries.size());
393 _setEnumerationNames(entries, static_cast<int>(initialValue));
394 }
395
397 EnumType getEnumValue() const { return static_cast<EnumType>(EnumField::getEnumValue()); }
399 void setEnumValue(EnumType enumValue) { EnumField::setEnumValue(static_cast<int>(enumValue)); }
401 void updateEnumValue(EnumType enumValue) { EnumField::updateEnumValue(static_cast<int>(enumValue)); }
403 EnumType getValue() const { return getEnumValue(); }
405 void setValue(EnumType enumValue) { setEnumValue(enumValue); }
407 void updateValue(EnumType enumValue) { updateEnumValue(enumValue); }
408};
409
410//-------------------------------------------------------------------------
413//-------------------------------------------------------------------------
415{
418
419public:
420
423
426 FloatField(const std::string& name);
427
429 void setStringValue(const std::string& stringValue) override;
430
434
440
443 std::string getStringValue() const override;
444
446 float getFloatValue() const;
447
449 void setValue(float floatValue) { setFloatValue(floatValue); }
450
452 void updateValue(float floatValue) { updateFloatValue(floatValue); }
453
455 float getValue() const { return getFloatValue(); }
456
458 static void setValueCallback(void* field, double value);
459
460protected:
462 void setValueFromField(const Field& field) override;
463
465 void _initialize(const std::string& name="", float* valuePtr=nullptr);
466
467
469 float* _valuePtr;
470
473
480};
481
482
483//-------------------------------------------------------------------------
489//-------------------------------------------------------------------------
491{
494
495public:
496
499
504 ProgressField(const std::string& name);
505
509
512
514 inline float getProgressValue() { return getFloatValue(); }
515
519
521 void setValue(float floatValue) { setFloatValue(floatValue); }
522
523private:
525 float _difference;
526
528 void _initialize();
529
530};
531
532
533//-------------------------------------------------------------------------
536//-------------------------------------------------------------------------
538{
541
542
543public:
544
547
550 DoubleField(const std::string& name);
551
553 void setStringValue(const std::string& stringValue) override;
554
557
563
566 std::string getStringValue() const override;
567
569 double getDoubleValue() const;
570
572 void setValue(double doubleValue) { setDoubleValue(doubleValue); }
573
575 void updateValue(double doubleValue) { updateDoubleValue(doubleValue); }
576
578 double getValue() const { return getDoubleValue(); }
579
581 static void setValueCallback(void* field, double value);
582
583protected:
585 void setValueFromField(const Field& field) override;
586
587private:
589 double* _valuePtr;
590
592 double _internalValue;
593
595 void _initialize(const std::string& name="", double* valuePtr=nullptr);
596
599 double _minValue;
602 double _maxValue;
603};
604
605//-------------------------------------------------------------------------
608//-------------------------------------------------------------------------
610{
613
614
615public:
616
619
622 StringField(const std::string& name);
623
625 void setStringValue(const std::string& stringValue) override;
626
629 void updateStringValue(const std::string& stringValue);
630
633 std::string getStringValue() const override;
634
636 void setValue(const std::string& stringValue) { setStringValue(stringValue); }
637
639 void updateValue(const std::string& stringValue) { updateStringValue(stringValue); }
640
642 std::string getValue() const { return getStringValue(); }
643
644private:
647 std::string _value;
648
650 void _initialize(const std::string& name="");
651};
652
653
654//-------------------------------------------------------------------------
657//-------------------------------------------------------------------------
659{
662
663public:
664
667
671 NotifyField(const std::string& name);
672
675 void setStringValue(const std::string& /*value*/) override;
676
678 std::string getStringValue() const override;
679
681 void notify();
682
683};
684
688
689//-------------------------------------------------------------------------
693//-------------------------------------------------------------------------
695{
698
699public:
700
703
706 OutputConnectorField(const std::string& name, Module* module, MLint outputImageIndex);
707
710
714 void setStringValue(const std::string& /*value*/) override;
715
719 void touch(FieldSensor::Strength strength=FieldSensor::CHANGED) override;
720
725 std::string getStringValue() const override;
726
729
731 MLint isValidValue() override;
732
733
734private:
735
737 OutputConnector* _valuePtr;
738
740 void _initialize();
741};
742
743
744//-------------------------------------------------------------------------
748//-------------------------------------------------------------------------
750{
753
754public:
755
758
763 InputConnectorField(const std::string& name, Module* module, MLint inputImageIndex);
764
767
771 void setStringValue(const std::string& /*value*/) override;
772
775 std::string getStringValue() const override;
776
779
781 MLint isValidValue() override;
782
783private:
785 InputConnector* _valuePtr;
786
788 void _initialize();
789};
790
791
792//-------------------------------------------------------------------------
795//-------------------------------------------------------------------------
797{
800
801public:
802
805
808 BaseField(const std::string& name);
809
811 ~BaseField() override;
812
814 void setStringValue(const std::string& stringValue) override;
815
818
820 void setBaseValue(const RefCountedBasePtr& value);
821
825 std::string getStringValue() const override;
826
829
831 virtual void touchSourceFields (void);
832
839
841 template <typename T>
842 void addAllowedType() { addAllowedType(T::getClassTypeId()); }
843
847 template <typename T>
848 void setBaseValueAndAddAllowedType(T* value) { addAllowedType(value->getClassTypeId()); setBaseValue(value); }
849
852 template <typename T>
853 void setBaseValueAndAddAllowedType(const ::boost::intrusive_ptr<T>& value) { setBaseValueAndAddAllowedType(value.get()); }
854
856 std::vector<const RuntimeType*> getAllowedTypes() const { return _allowedTypes; }
857
860 bool hasUnallowedType() const { return _unallowedType; }
861
864
866 void setValue(const RefCountedBasePtr& value) { setBaseValue(value); }
867
869 Base* getValue() const { return getBaseValue(); }
870
872 template <class Type>
873 Type getTypedValue() const { return mlbase_cast<Type>(getValue()); }
874
876 template <class Type>
877 Type getTypedBaseValue() const { return mlbase_cast<Type>(getValue()); }
878
879protected:
881 void setValueFromField(const Field& field) override;
882
883private:
885 Base* _value;
886
888 std::vector<const RuntimeType*> _allowedTypes;
889
891 bool _unallowedType;
893 bool _isRefCountedBase;
894
896 void _initialize(const std::string& name="");
897
898};
899
900//-------------------------------------------------------------------------
903//-------------------------------------------------------------------------
904
905template<class T>
907{
908public:
910 TypedBaseField(const std::string& name) : BaseField(name) { BaseField::addAllowedType<T>(); }
911
913 void setValue(T* basePointerValue) { setBaseValue(basePointerValue); }
914
916 void setValue(const ::boost::intrusive_ptr<T>& value) { setValue(value.get()); }
917
919 T* getValue() const { return getTypedValue<T*>(); }
920
921private:
923 void addAllowedType() {}
925 void setBaseValueAndAddAllowedType() {}
926};
927
928
929//-------------------------------------------------------------------------
935//-------------------------------------------------------------------------
937{
940
941public:
942
945
948 SoNodeField(const std::string& name);
949
951 void setStringValue(const std::string& stringValue) override;
952
955
959 std::string getStringValue() const override;
960
962 SoNode* getSoNodeValue() const;
963
965 void setValue(SoNode* soNodeValue) { setSoNodeValue(soNodeValue); }
966
968 SoNode* getValue() const { return getSoNodeValue(); }
969
970protected:
972 void setValueFromField(const Field& field) override;
973
974private:
976 SoNode* _internalValue;
977
979 void _initialize(const std::string& name="");
980};
981
982
983//-------------------------------------------------------------------------
990//-------------------------------------------------------------------------
992{
995
996public:
997
1000
1003 PointerField(const std::string& name);
1004
1007 void setStringValue(const std::string& stringValue) override;
1008
1011
1014 std::string getStringValue() const override;
1015
1017 void* getPointerValue() const;
1018
1020 void setValue(void* voidPointerValue) { setPointerValue(voidPointerValue); }
1021
1023 void* getValue() const { return getPointerValue(); }
1024
1025private:
1027 void* _valuePtr;
1028
1030 void _initialize(const std::string& name="");
1031};
1032
1033//-------------------------------------------------------------------------
1036//-------------------------------------------------------------------------
1038{
1041
1042public:
1043
1046
1049 Vector2Field(const std::string& name);
1050
1052 void setStringValue(const std::string& stringValue) override;
1053
1056
1061
1063 inline void setVectorValue(const Vector2& vectorValue) { setVector2Value(vectorValue); }
1064
1066 std::string getStringValue() const override;
1067
1069 const Vector2& getVector2Value() const;
1070
1072 inline const Vector2& getVectorValue() const { return getVector2Value(); }
1073
1075 void setValue(const Vector2& vectorValue) { setVector2Value(vectorValue); }
1076
1078 void updateValue(const Vector2& vectorValue) { updateVector2Value(vectorValue); }
1079
1081 const Vector2& getValue() const { return getVector2Value(); }
1082
1083protected:
1085 void setValueFromField(const Field& field) override;
1086
1087private:
1089 Vector2* _valuePtr;
1090
1092 Vector2 _internalValue;
1093
1095 void _initialize(const std::string& name="", Vector2* valuePtr=nullptr);
1096};
1097
1098//-------------------------------------------------------------------------
1101//-------------------------------------------------------------------------
1103{
1106
1107public:
1108
1111
1114 Vector3Field(const std::string& name);
1115
1117 void setStringValue(const std::string& stringValue) override;
1118
1121
1126
1128 inline void setVectorValue(const Vector3& vectorValue) { setVector3Value(vectorValue); }
1129
1133 std::string getStringValue() const override;
1134
1136 const Vector3& getVector3Value() const;
1137
1139 inline const Vector3& getVectorValue() const { return getVector3Value(); }
1140
1142 void setValue(const Vector3& vectorValue) { setVector3Value(vectorValue); }
1143
1145 void updateValue(const Vector3& vectorValue) { updateVector3Value(vectorValue); }
1146
1148 const Vector3& getValue() const { return getVector3Value(); }
1149
1150
1151protected:
1153 void setValueFromField(const Field& field) override;
1154
1155private:
1157 Vector3* _valuePtr;
1158
1160 Vector3 _internalValue;
1161
1163 void _initialize(const std::string& name="", Vector3* valuePtr=nullptr);
1164};
1165
1166//-------------------------------------------------------------------------
1169//-------------------------------------------------------------------------
1171{
1174
1175public:
1176
1179
1182 Vector4Field(const std::string& name);
1183
1185 void setStringValue(const std::string& stringValue) override;
1186
1189
1194
1196 inline void setVectorValue(const Vector4& vectorValue) { setVector4Value(vectorValue); }
1197
1198
1202 std::string getStringValue() const override;
1203
1205 const Vector4& getVector4Value() const;
1206
1208 inline const Vector4& getVectorValue() const { return getVector4Value(); }
1209
1211 void setValue(const Vector4& vectorValue) { setVector4Value(vectorValue); }
1212
1214 void updateValue(const Vector4& vectorValue) { updateVector4Value(vectorValue); }
1215
1217 const Vector4& getValue() const { return getVector4Value(); }
1218
1219protected:
1221 void setValueFromField(const Field& field) override;
1222
1223private:
1225 Vector4* _valuePtr;
1226
1228 Vector4 _internalValue;
1229
1231 void _initialize(const std::string& name="", Vector4* valuePtr=nullptr);
1232};
1233
1234//-------------------------------------------------------------------------
1237//-------------------------------------------------------------------------
1239{
1242
1243
1244public:
1245
1248
1251 Vector5Field(const std::string& name);
1252
1254 void setStringValue(const std::string& stringValue) override;
1255
1258
1263
1265 inline void setVectorValue(const Vector5& vectorValue) { setVector5Value(vectorValue); }
1266
1270 std::string getStringValue() const override;
1271
1273 const Vector5& getVector5Value() const;
1274
1276 inline const Vector5& getVectorValue() const { return getVector5Value(); }
1277
1279 void setValue(const Vector5& vectorValue) { setVector5Value(vectorValue); }
1280
1282 void updateValue(const Vector5& vectorValue) { updateVector5Value(vectorValue); }
1283
1285 const Vector5& getValue() const { return getVector5Value(); }
1286
1287protected:
1289 void setValueFromField(const Field& field) override;
1290
1291private:
1293 Vector5 _value;
1294
1296 void _initialize(const std::string& name="");
1297};
1298
1299
1300//-------------------------------------------------------------------------
1303//-------------------------------------------------------------------------
1305{
1308
1309
1310public:
1311
1314
1317 Vector6Field(const std::string& name);
1318
1320 void setStringValue(const std::string& stringValue) override;
1321
1324
1329
1331 inline void setVectorValue(const Vector6& vectorValue) { setVector6Value(vectorValue); }
1332
1336 std::string getStringValue() const override;
1337
1339 const Vector6& getVector6Value() const;
1340
1342 inline const Vector6& getVectorValue() const { return getVector6Value(); }
1343
1345 void setValue(const Vector6& vectorValue) { setVector6Value(vectorValue); }
1346
1348 void updateValue(const Vector6& vectorValue) { updateVector6Value(vectorValue); }
1349
1351 const Vector6& getValue() const { return getVector6Value(); }
1352
1353protected:
1355 void setValueFromField(const Field& field) override;
1356
1357private:
1359 Vector6* _valuePtr;
1360
1362 Vector6 _internalValue;
1363
1365 void _initialize(const std::string& name="", Vector6* valuePtr=nullptr);
1366};
1367
1368//-------------------------------------------------------------------------
1371//-------------------------------------------------------------------------
1373{
1376
1377
1378public:
1379
1382
1385 Vector10Field(const std::string& name);
1386
1388 void setStringValue(const std::string& stringValue) override;
1389
1392
1397
1399 inline void setVectorValue(const Vector10& vectorValue) { setVector10Value(vectorValue); }
1400
1401
1405 std::string getStringValue() const override;
1406
1409
1411 inline const Vector10& getVectorValue() const { return getVector10Value(); }
1412
1414 void setValue(const Vector10& vectorValue) { setVector10Value(vectorValue); }
1415
1417 void updateValue(const Vector10& vectorValue) { updateVector10Value(vectorValue); }
1418
1420 const Vector10& getValue() const { return getVector10Value(); }
1421
1422protected:
1424 void setValueFromField(const Field& field) override;
1425
1426private:
1428 Vector10 _value;
1429
1431 void _initialize(const std::string& name="");
1432};
1433
1434//-------------------------------------------------------------------------
1439//-------------------------------------------------------------------------
1441{
1444
1445public:
1446
1449
1453 ColorField(const std::string& name);
1454
1456 void setColorValue(float r, float g, float b);
1457
1461 void updateColorValue(float r, float g, float b);
1462
1464 void getColorValue(float& r, float& g, float& b) const;
1465
1467 const Vector3& getColorValue() const { return getVectorValue(); }
1468
1474
1479};
1480
1481
1482//-------------------------------------------------------------------------
1485//-------------------------------------------------------------------------
1487{
1490
1491public:
1494 Matrix2Field(const std::string& name="");
1495
1499 void setStringValue(const std::string& stringValue) override;
1500
1502 void setMatrixValue(const Matrix2& matrixValue);
1503
1506 void setMatrix2Value(const Matrix2& matrixValue);
1507
1511 void updateMatrix2Value(const Matrix2& matrixValue);
1512
1516 std::string getStringValue() const override;
1517
1519 const Matrix2& getMatrixValue() const;
1520
1523 const Matrix2& getMatrix2Value() const;
1524
1526 void setValue(const Matrix2& matrixValue) { setMatrix2Value(matrixValue); }
1527
1529 void updateValue(const Matrix2& matrixValue) { updateMatrix2Value(matrixValue); }
1530
1532 const Matrix2& getValue() const { return getMatrix2Value(); }
1533
1534protected:
1536 void setValueFromField(const Field& field) override;
1537
1538private:
1540 Matrix2 _value;
1541};
1542
1543//-------------------------------------------------------------------------
1546//-------------------------------------------------------------------------
1548{
1551
1552public:
1555 Matrix3Field(const std::string& name="");
1556
1560 void setStringValue(const std::string& stringValue) override;
1561
1563 void setMatrixValue(const Matrix3& matrixValue);
1564
1567 void setMatrix3Value(const Matrix3& matrixValue);
1568
1572 void updateMatrix3Value(const Matrix3& matrixValue);
1573
1577 std::string getStringValue() const override;
1578
1580 const Matrix3& getMatrixValue() const;
1581
1584 const Matrix3& getMatrix3Value() const;
1585
1587 void setValue(const Matrix3& matrixValue) { setMatrix3Value(matrixValue); }
1588
1590 void updateValue(const Matrix3& matrixValue) { updateMatrix3Value(matrixValue); }
1591
1593 const Matrix3& getValue() const { return getMatrix3Value(); }
1594
1595protected:
1597 void setValueFromField(const Field& field) override;
1598
1599private:
1601 Matrix3 _value;
1602};
1603
1604//-------------------------------------------------------------------------
1608//-------------------------------------------------------------------------
1610{
1613
1614public:
1615
1618
1621 MatrixField(const std::string& name);
1622
1626 void setStringValue(const std::string& stringValue) override;
1627
1629 void setMatrixValue(const Matrix4& matrixValue);
1630
1633 void setMatrix4Value(const Matrix4& matrixValue);
1634
1638 void updateMatrix4Value(const Matrix4& matrixValue);
1639
1643 std::string getStringValue() const override;
1644
1646 const Matrix4& getMatrixValue() const;
1647
1650 const Matrix4& getMatrix4Value() const;
1651
1653 void setValue(const Matrix4& matrixValue) { setMatrix4Value(matrixValue); }
1654
1656 void updateValue(const Matrix4& matrixValue) { updateMatrix4Value(matrixValue); }
1657
1659 const Matrix4& getValue() const { return getMatrix4Value(); }
1660
1661protected:
1663 void setValueFromField(const Field& field) override;
1664
1665private:
1667 Matrix4* _valuePtr;
1668
1670 Matrix4 _internalValue;
1671
1673 void _initialize(const std::string& name="", Matrix4* valuePtr=nullptr);
1674};
1675
1676
1677//-------------------------------------------------------------------------
1680//-------------------------------------------------------------------------
1682{
1685
1686public:
1689 Matrix4Field(const std::string& name="");
1690};
1691
1692//-------------------------------------------------------------------------
1695//-------------------------------------------------------------------------
1697{
1700
1701public:
1704 Matrix5Field(const std::string& name="");
1705
1709 void setStringValue(const std::string& stringValue) override;
1710
1712 void setMatrixValue(const Matrix5& matrixValue);
1713
1716 void setMatrix5Value(const Matrix5& matrixValue);
1717
1721 void updateMatrix5Value(const Matrix5& matrixValue);
1722
1726 std::string getStringValue() const override;
1727
1729 const Matrix5& getMatrixValue() const;
1730
1733 const Matrix5& getMatrix5Value() const;
1734
1736 void setValue(const Matrix5& matrixValue) { setMatrix5Value(matrixValue); }
1737
1739 void updateValue(const Matrix5& matrixValue) { updateMatrix5Value(matrixValue); }
1740
1742 const Matrix5& getValue() const { return getMatrix5Value(); }
1743
1744protected:
1746 void setValueFromField(const Field& field) override;
1747
1748private:
1750 Matrix5 _value;
1751};
1752
1753
1754//-------------------------------------------------------------------------
1757//-------------------------------------------------------------------------
1759{
1762
1763public:
1766 Matrix6Field(const std::string& name="");
1767
1771 void setStringValue(const std::string& stringValue) override;
1772
1774 void setMatrixValue(const Matrix6& matrixValue);
1775
1778 void setMatrix6Value(const Matrix6& matrixValue);
1779
1783 void updateMatrix6Value(const Matrix6& matrixValue);
1784
1788 std::string getStringValue() const override;
1789
1791 const Matrix6& getMatrixValue() const;
1792
1795 const Matrix6& getMatrix6Value() const;
1796
1798 void setValue(const Matrix6& matrixValue) { setMatrix6Value(matrixValue); }
1799
1801 void updateValue(const Matrix6& matrixValue) { updateMatrix6Value(matrixValue); }
1802
1804 const Matrix6& getValue() const { return getMatrix6Value(); }
1805
1806protected:
1808 void setValueFromField(const Field& field) override;
1809
1810private:
1812 Matrix6 _value;
1813};
1814
1815
1816
1817//-------------------------------------------------------------------------
1820//-------------------------------------------------------------------------
1822{
1825
1826public:
1827
1830
1833 MLDataTypeField(const std::string& name);
1834
1836 void setStringValue(const std::string& stringValue) override;
1837
1840
1844 std::string getStringValue() const override;
1845
1848
1850 void setValue(MLDataType dataType) { setMLDataTypeValue(dataType); }
1851
1853 MLDataType getValue() const { return getMLDataTypeValue(); }
1854
1855private:
1857 MLDataType* _valuePtr;
1859 MLDataType _internalValue;
1860
1862 void _initialize(const std::string& name="", MLDataType* valuePtr=nullptr);
1863};
1864
1865
1866//-------------------------------------------------------------------------
1870//-------------------------------------------------------------------------
1872{
1875
1876public:
1877
1880
1883 ImageVectorField(const std::string& name);
1884
1886 void setStringValue(const std::string& stringValue) override;
1887
1890
1894
1896 std::string getStringValue() const override;
1897
1900
1902 void setValue(const ImageVector& imageVectorValue) { setImageVectorValue(imageVectorValue); }
1903
1905 void updateValue(const ImageVector& imageVectorValue) { updateImageVectorValue(imageVectorValue); }
1906
1908 const ImageVector& getValue() const { return getImageVectorValue(); }
1909
1910protected:
1912 void setValueFromField(const Field& field) override;
1913
1914private:
1916 ImageVector* _valuePtr;
1917
1919 ImageVector _internalValue;
1920
1922 void _initialize(const std::string& name="", ImageVector* valuePtr=nullptr);
1923};
1924
1925
1926
1927//-------------------------------------------------------------------------
1930//-------------------------------------------------------------------------
1932{
1935
1936public:
1937
1940
1943 SubImageBoxField(const std::string& name);
1944
1946 void setStringValue(const std::string& stringValue) override;
1947
1950
1954
1958 std::string getStringValue() const override;
1959
1962
1964 void setValue(const SubImageBox& subImageBoxValue) { setSubImageBoxValue(subImageBoxValue); }
1965
1967 void updateValue(const SubImageBox& subImageBoxValue) { updateSubImageBoxValue(subImageBoxValue); }
1968
1970 const SubImageBox& getValue() const { return getSubImageBoxValue(); }
1971
1972protected:
1974 void setValueFromField(const Field& field) override;
1975
1976private:
1978 SubImageBox* _valuePtr;
1980 SubImageBox _internalValue;
1981
1983 void _initialize(const std::string& name="", SubImageBox* valuePtr=nullptr);
1984};
1985
1986//-------------------------------------------------------------------------
1989//-------------------------------------------------------------------------
1991{
1994
1995public:
1996
1999
2002 SubImageBoxdField(const std::string& name);
2003
2005 void setStringValue(const std::string& stringValue) override;
2006
2009
2014
2018 std::string getStringValue() const override;
2019
2022
2024 void setValue(const SubImageBoxd& subImageBoxValue) { setSubImageBoxdValue(subImageBoxValue); }
2025
2027 void updateValue(const SubImageBoxd& subImageBoxValue) { updateSubImageBoxdValue(subImageBoxValue); }
2028
2030 const SubImageBoxd& getValue() const { return getSubImageBoxdValue(); }
2031
2032protected:
2034 void setValueFromField(const Field& field) override;
2035
2036private:
2038 SubImageBoxd* _valuePtr;
2039
2041 SubImageBoxd _internalValue;
2042
2044 void _initialize(const std::string& name="", SubImageBoxd* valuePtr=nullptr);
2045};
2046
2047//-------------------------------------------------------------------------
2050//-------------------------------------------------------------------------
2052{
2055
2056public:
2060 UniversalTypeField(const std::string& name="", MLDataType dt=-1);
2061
2064
2067
2069 void setStringValue(const std::string& stringValue) override;
2070
2073 std::string getStringValue() const override;
2074
2077 virtual void setDataType(MLDataType dataType);
2078
2080 virtual MLDataType getDataType() const;
2081
2083 virtual void setUniversalTypeValue(const MLTypeData* dataType);
2084
2091
2096
2099
2101 void setValue(const MLTypeData* typeData) { setUniversalTypeValue(typeData); }
2102
2104 MLTypeData* getValue() const { return getUniversalTypeValue(); }
2105
2106protected:
2110
2114
2117
2118private:
2122 std::string _origString;
2123
2126 std::string _strValue;
2127
2129 MLDataType _dataType;
2130
2132 MLint _isValid;
2133
2137 MLTypeData* _typeData;
2138};
2139
2140//----------------------------------------------------------------------------------
2144//----------------------------------------------------------------------------------
2146
2149
2150public:
2153 RotationField(const std::string &name=""): Vector4Field(name) {}
2154
2156 void setRotationValue(const Vector3& vec, double angle);
2157
2160
2162 void getRotationValue(Vector3& vec, double& angle) const;
2163
2166};
2167
2168
2169//----------------------------------------------------------------------------------
2173//----------------------------------------------------------------------------------
2175
2178
2179public:
2182 PlaneField(const std::string &name=""): Vector4Field(name) {}
2183
2185 void setPlaneValue(double f0, double f1, double f2, double f3);
2186
2188 void setPlaneValue(const Plane& p);
2189
2191 void getPlaneValue(double &f0, double &f1, double &f2, double &f3) const;
2192
2194 void getPlaneValue(Plane &plane) const;
2195
2198};
2199
2200
2202
2203
2204#endif //of __mlFields_H
2205
2206
2207
@ T
Field to encapsulate a pointer to an ML base object.
Definition mlFields.h:797
Base * getValue() const
Same as getBaseValue().
Definition mlFields.h:869
void setBaseValue(const RefCountedBasePtr &value)
Sets the value from intrusive pointer.
void setValue(Base *basePointerValue)
Same as setBaseValue(Base*).
Definition mlFields.h:863
BaseField(const std::string &name)
Constructor, creates a field with a name to manage a base pointer.
void setValue(const RefCountedBasePtr &value)
Same as setBaseValue(const RefCountedBasePtr&).
Definition mlFields.h:866
std::string getStringValue() const override
Returns the value of the field as a string value.
void setBaseValue(Base *basePointerValue)
Sets the value of the field to basePointerValue.
Base * getBaseValue() const
Returns current field value.
BaseField()
Implements the runtime type system interface for this class.
void setStringValue(const std::string &stringValue) override
Sets pointer value from string stringValue. If string cannot be parsed successfully,...
std::vector< const RuntimeType * > getAllowedTypes() const
Get list of allowed Base types for this field.
Definition mlFields.h:856
void setBaseValueAndAddAllowedType(const ::boost::intrusive_ptr< T > &value)
convenience routine for setting the base value and its type at the same time using an intrusive point...
Definition mlFields.h:853
bool hasUnallowedType() const
return true if the last call of setBaseValue had an unallowed type as argument, getBaseValue will ret...
Definition mlFields.h:860
void addAllowedType(const RuntimeType *allowedType)
Add type to list of allowed types.
void addAllowedType()
Same as above, with template parameter where the Base type can be specified directly.
Definition mlFields.h:842
~BaseField() override
Destructor.
virtual void touchSourceFields(void)
Touches the source fields.
Type getTypedBaseValue() const
Get typed value if the contained base object is derived from the given Type.
Definition mlFields.h:877
Type getTypedValue() const
Get typed value if the contained base object is derived from the given Type.
Definition mlFields.h:873
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void setBaseValueAndAddAllowedType(T *value)
convenience routine for setting the base value and its type at the same time.
Definition mlFields.h:848
Class representing general ML objects that support import/export via strings (setPersistentState() an...
Definition mlBase.h:59
Field to encapsulate a boolean value.
Definition mlFields.h:58
BoolField()
Implements the runtime type system interface for this class.
void setBoolValue(bool boolValue)
Sets the field value to boolValue.
std::string getStringValue() const override
Returns the value of the field as string value.
bool getValue() const
Same as getBoolValue().
Definition mlFields.h:101
bool isOn() const
Returns the value of the field as Boolean.
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void toggleValue()
Toggles the Boolean field value.
void setStringValue(const std::string &value) override
Sets the value of the field to value.
BoolField(const std::string &name)
Constructor, creates a field with a name to manage a Boolean value.
bool getBoolValue() const
Returns the value of the field as a Boolean.
void setValue(bool boolValue)
Same as setBoolValue().
Definition mlFields.h:95
void updateValue(bool boolValue)
Same as updateBoolValue().
Definition mlFields.h:98
void updateBoolValue(bool boolValue)
Sets the field value to boolValue, but only touch field if the new value is different from the old va...
Field to encapsulate a vector of 3 float values representing an (rgb) color with all properties of Ve...
Definition mlFields.h:1441
void setColorValue(float r, float g, float b)
Sets the field value to r, g and b.
ColorField()
Implements the runtime type system interface for this class.
void setPackedColorValue(MLuint32 rgba)
Sets the packed uint32 color value to rgba.
ColorField(const std::string &name)
Constructor, create a field with a name to manage a vector of 3 float values interpreted as rgb-color...
const Vector3 & getColorValue() const
Returns the value of the field as a Vector3.
Definition mlFields.h:1467
void updateColorValue(float r, float g, float b)
Sets the field value to r, g and b, but only touch field if the new value is different from the old v...
MLuint32 getPackedColorValue() const
Returns the packed uint32 color value.
void getColorValue(float &r, float &g, float &b) const
Returns the value of the field into the floats r, g, and b.
Field to encapsulate a double value.
Definition mlFields.h:538
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void updateDoubleValue(double doubleValue)
Set field value to doubleValue, but only touch field if the new value is different from the old value...
double getDoubleValue() const
Returns current field value.
DoubleField()
Implements the runtime type system interface for this class.
DoubleField(const std::string &name)
Constructor, creates a field with a name to manage a double value.
std::string getStringValue() const override
Returns the value of the field as a string value setStringValue must be able to reinterpret this retu...
void setDoubleValue(double doubleValue)
Set field value to doubleValue. By default the entire double type range can be set.
void setValue(double doubleValue)
Same as setDoubleValue().
Definition mlFields.h:572
void setStringValue(const std::string &stringValue) override
Sets value of the field to stringValue.
void updateValue(double doubleValue)
Same as updateDoubleValue().
Definition mlFields.h:575
static void setValueCallback(void *field, double value)
Callback method that can be used as a MLRequestProgressCB to set the progress to the field.
double getValue() const
Same as getDoubleValue().
Definition mlFields.h:578
Field to encapsulate an enumerated value.
Definition mlFields.h:195
void setEnumValue(int enumValue)
Sets field value to enumValue.
void _setEnumerationNames(const std::vector< EnumField::EnumEntry > &enumValues, int initialValue)
Sets the enumeration item names.
int _internalValue
Stores the int value (if no external deprecated reference was given).
Definition mlFields.h:302
void setStringValue(const std::string &value) override
Sets value of the field to the enum item with given name value.
std::vector< EnumEntry > _entries
Stores the possible enum values and names.
Definition mlFields.h:308
void _setEnumerationNames(const std::vector< std::string > &enumNames)
Sets the enumeration item names.
std::string getStringValue() const override
Returns the value of the field as string value.
void updateEnumValue(int enumValue)
Sets field value to enumValue, but only touch field if the new value is different from the old value.
EnumField(const std::string &name, const char *const *enumerationItemNames, size_t numEnumerationItems)
Constructor, creates a field with a name to manage an enum value.
EnumField(const std::string &name, const std::string enumerationItemNames[], size_t numEnumerationItems)
Implements the runtime type system interface for this class.
EnumField()
Protected constructor to allow derived classes.
Definition mlFields.h:312
bool _linearEntries
Stores if enum entry values start at 0 and increase by 1.
Definition mlFields.h:305
const EnumEntry & getEnumEntryAtIndex(size_t index) const
Returns the enum entry at given index, which allows to enumerate all existing enum entries.
size_t getNumEnumerationItems() const
Returns the number of registered enum values defined in constructor.
~EnumField() override
Destroys this field and releases internally allocated memory.
void setStringValueDefaulted(const std::string &value)
If value equals one of the enum item names, set the field to this item, otherwise set it to the first...
void setValue(int enumValue)
Same as setEnumValue().
Definition mlFields.h:275
int getEnumValue() const
Returns the current enum value as integer.
int * _valuePtr
Points to the variable containing the field value; we use an integer to be compatible to normal enum ...
Definition mlFields.h:299
void _setEnumerationNames(const std::string enumNames[])
Sets the enumeration item names.
void _initialize(const std::string &name="", size_t numEnums=0, int *valuePtr=nullptr)
Initializes this field.
void updateValue(int enumValue)
Same as updateEnumValue().
Definition mlFields.h:278
void _setEnumerationNames(const char *const *enumNames)
Sets the enumeration item names.
EnumField(const std::string &name, const std::vector< std::string > &enumerationItemNames)
Constructor, creates a field with a name to manage an enum value.
int getValue() const
Same as getEnumValue().
Definition mlFields.h:281
Helper class that stores a list of typed enum values and their string names.
Definition mlFields.h:319
const std::vector< EnumField::EnumEntry > & getEntries() const
Get access to the collected list of enum entries.
Definition mlFields.h:355
void add(const Entry &value)
Add an enum value via the given entry, which is typically created with the ML_ENUM_VALUE() macro.
Definition mlFields.h:344
void add(const std::string &stringValue, EnumType value)
Add an enum value, manually passing in the name and value.
Definition mlFields.h:339
std::vector< EnumField::EnumEntry > _entries
Definition mlFields.h:358
EnumValues & operator<<(const Entry &value)
Add an enum value via the given entry, which is typically created with the ML_ENUM_VALUE() macro.
Definition mlFields.h:349
void add(const char *stringValue, EnumType value)
Add an enum value, manually passing in the name and value.
Definition mlFields.h:334
Strength
Enumeration type describing the strength of notifications.
Base class for all fields used in the ML.
Definition mlField.h:73
virtual std::string getStringValue() const =0
Returns the value of the field as string value.
virtual void setStringValue(const std::string &value)=0
Set field value as string value.
Field to encapsulate a float value.
Definition mlFields.h:415
float _internalValue
Stores the float value (if no external deprecated reference was given).
Definition mlFields.h:472
std::string getStringValue() const override
Returns the value of the field as a string value.
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
float getFloatValue() const
Returns the value of the field.
void setFloatValue(float floatValue)
Sets the field value to floatValue.
FloatField(const std::string &name)
Constructor, create a field with a name to manage a float value, with 0 as a default value.
float getValue() const
Same as getFloatValue().
Definition mlFields.h:455
float _maxValue
Maximum float value which can be set.
Definition mlFields.h:479
float * _valuePtr
Points to the variable containing the field value.
Definition mlFields.h:469
FloatField()
Implements the runtime type system interface for this class.
void updateValue(float floatValue)
Same as updateFloatValue().
Definition mlFields.h:452
void updateFloatValue(float floatValue)
Sets the field value to floatValue, but only touch field if the new value is different from the old v...
void setValue(float floatValue)
Same as setFloatValue().
Definition mlFields.h:449
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently..
void _initialize(const std::string &name="", float *valuePtr=nullptr)
Initializes this field.
float _minValue
Minimum float value which can be set.
Definition mlFields.h:476
static void setValueCallback(void *field, double value)
Callback method that can be used as a MLRequestProgressCB to set the progress to the field.
Field to encapsulate an ML vector ImageVector with 6 integer components.
Definition mlFields.h:1872
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
void updateImageVectorValue(const ImageVector &imageVectorValue)
Sets the value of the field to imageVectorValue, but only touch field if the new value is different f...
ImageVectorField()
Implements the runtime type system interface for this class.
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void setImageVectorValue(const ImageVector &imageVectorValue)
Sets the value of the field to imageVectorValue.
ImageVectorField(const std::string &name)
Constructor, creates a field with a name to manage a vector of 6 integer values.
void setValue(const ImageVector &imageVectorValue)
Same as setImageVectorValue().
Definition mlFields.h:1902
std::string getStringValue() const override
Returns the value of the field as a string value.
const ImageVector & getImageVectorValue() const
Returns the value of the field.
const ImageVector & getValue() const
Same as getImageVectorValue().
Definition mlFields.h:1908
void updateValue(const ImageVector &imageVectorValue)
Same as updateImageVectorValue().
Definition mlFields.h:1905
Field to encapsulate a pointer to an input connector which represents a module input.
Definition mlFields.h:750
std::string getStringValue() const override
Returns a reference to InputConnector as a C-string (InputConnector does not have a value).
InputConnector & getInputConnectorValue() const
Returns a reference to the InputConnector.
~InputConnectorField() override
Destroys the field.
MLint isValidValue() override
Returns 1 if connector field contains a valid connector pointer.
void setStringValue(const std::string &) override
Only calls touch() to propagate notifications.
InputConnectorField()
Implements the runtime type system interface for this class.
InputConnectorField(const std::string &name, Module *module, MLint inputImageIndex)
Constructor, creates a field with a name to manage an InputConnector on the Module module at index in...
Class to manage an input connection of a Module module.
Field to encapsulate an integer value.
Definition mlFields.h:126
void setIntValue(MLint intValue)
Sets field value to intValue.
IntField(const std::string &name)
Constructor, creates a field with a name to manage an integer value.
MLint getValue() const
Same as getIntValue().
Definition mlFields.h:164
void updateValue(MLint intValue)
Same as updateIntValue().
Definition mlFields.h:161
void setStringValue(const std::string &value) override
Sets value of the field to value.
MLint getIntValue() const
Returns the value of the field as an MLint.
std::string getStringValue() const override
Returns the value of the field as a string value.
void setValue(MLint intValue)
Same as setIntValue().
Definition mlFields.h:158
void updateIntValue(MLint intValue)
Sets field value to intValue, but only touch field if the new value is different from the old value.
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
IntField()
Implements the runtime type system interface for this class.
Field to encapsulate an MLDataType value.
Definition mlFields.h:1822
MLDataType getMLDataTypeValue() const
Returns the value of the field.
MLDataTypeField(const std::string &name)
Constructor, creates a field with a name to manage an MLDataType value.
MLDataType getValue() const
Same as getMLDataTypeValue().
Definition mlFields.h:1853
std::string getStringValue() const override
Returns the value of the field as a string value.
MLDataTypeField()
Implements the runtime type system interface for this class.
void setMLDataTypeValue(MLDataType dataType)
Sets the field value to data type dataType.
void setValue(MLDataType dataType)
Same as setMLDataTypeValue().
Definition mlFields.h:1850
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue. Invalid types set the type to MLint8Type.
Field encapsulating a 2x2 matrix.
Definition mlFields.h:1487
void updateMatrix2Value(const Matrix2 &matrixValue)
Sets the value of the field to matrixValue, but only touch field if the new value is different from t...
void setMatrixValue(const Matrix2 &matrixValue)
Sets the value of the field to matrixValue.
const Matrix2 & getValue() const
Same as getMatrix2Value().
Definition mlFields.h:1532
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void setStringValue(const std::string &stringValue) override
Sets the field value to stringValue="a11 a12 a21 a22".
const Matrix2 & getMatrix2Value() const
Returns the value of the field; same as getMatrixValue for symmetry to other fields.
Matrix2Field(const std::string &name="")
Implements the runtime type system interface for this class.
void setValue(const Matrix2 &matrixValue)
Same as setMatrix2Value().
Definition mlFields.h:1526
const Matrix2 & getMatrixValue() const
Returns the value of the field.
void updateValue(const Matrix2 &matrixValue)
Same as updateMatrix2Value().
Definition mlFields.h:1529
std::string getStringValue() const override
Returns the value of the field as a string value.
void setMatrix2Value(const Matrix2 &matrixValue)
Sets the value of the field to matrixValue; same as setMatrixValue for symmetry to other fields.
Field encapsulating a 3x3 matrix.
Definition mlFields.h:1548
const Matrix3 & getMatrix3Value() const
Returns the value of the field; same as getMatrixValue for symmetry to other fields.
void setStringValue(const std::string &stringValue) override
Sets the field value to stringValue="a11 a12 ... a33".
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
const Matrix3 & getValue() const
Same as getMatrix3Value().
Definition mlFields.h:1593
void setValue(const Matrix3 &matrixValue)
Same as setMatrix3Value().
Definition mlFields.h:1587
void setMatrixValue(const Matrix3 &matrixValue)
Sets the value of the field to matrixValue.
void updateValue(const Matrix3 &matrixValue)
Same as updateMatrix3Value().
Definition mlFields.h:1590
Matrix3Field(const std::string &name="")
Implements the runtime type system interface for this class.
void setMatrix3Value(const Matrix3 &matrixValue)
Sets the value of the field to matrixValue; same as setMatrixValue for symmetry to other fields.
void updateMatrix3Value(const Matrix3 &matrixValue)
Sets the value of the field to matrixValue, but only touch field if the new value is different from t...
std::string getStringValue() const override
Returns the value of the field as a string value.
const Matrix3 & getMatrixValue() const
Returns the value of the field.
Field to encapsulate a 4x4 matrix.
Definition mlFields.h:1682
Matrix4Field(const std::string &name="")
Implements the runtime type system interface for this class.
Field encapsulating a 5x5 matrix.
Definition mlFields.h:1697
void setMatrix5Value(const Matrix5 &matrixValue)
Sets the value of the field to matrixValue; same as setMatrixValue for symmetry to other fields.
void setMatrixValue(const Matrix5 &matrixValue)
Sets the value of the field to matrixValue.
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
Matrix5Field(const std::string &name="")
Implements the runtime type system interface for this class.
void setValue(const Matrix5 &matrixValue)
Same as setMatrix5Value().
Definition mlFields.h:1736
const Matrix5 & getMatrix5Value() const
Returns the value of the field; same as getMatrixValue for symmetry to other fields.
std::string getStringValue() const override
Returns the value of the field as a string value.
void updateValue(const Matrix5 &matrixValue)
Same as updateMatrix5Value().
Definition mlFields.h:1739
const Matrix5 & getMatrixValue() const
Returns the value of the field.
void setStringValue(const std::string &stringValue) override
Sets the field value to stringValue="a11 a12 ... a55".
const Matrix5 & getValue() const
Same as getMatrix4Value().
Definition mlFields.h:1742
void updateMatrix5Value(const Matrix5 &matrixValue)
Sets the value of the field to matrixValue, but only touch field if the new value is different from t...
Field encapsulating a 6x6 matrix.
Definition mlFields.h:1759
void updateValue(const Matrix6 &matrixValue)
Same as updateMatrix6Value().
Definition mlFields.h:1801
std::string getStringValue() const override
Returns the value of the field as a string value.
const Matrix6 & getValue() const
Same as getMatrix6Value().
Definition mlFields.h:1804
Matrix6Field(const std::string &name="")
Implements the runtime type system interface for this class.
void setValue(const Matrix6 &matrixValue)
Same as setMatrix6Value().
Definition mlFields.h:1798
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void setMatrixValue(const Matrix6 &matrixValue)
Sets the value of the field to matrixValue.
const Matrix6 & getMatrix6Value() const
Returns the value of the field; same as getMatrixValue for symmetry to other fields.
const Matrix6 & getMatrixValue() const
Returns the value of the field.
void updateMatrix6Value(const Matrix6 &matrixValue)
Sets the value of the field to matrixValue, but only touch field if the new value is different from t...
void setStringValue(const std::string &stringValue) override
Sets the field value to stringValue="a11 a12 ... a66".
void setMatrix6Value(const Matrix6 &matrixValue)
Sets the value of the field to matrixValue; same as setMatrixValue for symmetry to other fields.
Field to encapsulate a 4x4 matrix, same as Matrix4Field for backward compatibility.
Definition mlFields.h:1610
void setStringValue(const std::string &stringValue) override
Sets the field value to stringValue="a11 a12 ... a44".
const Matrix4 & getMatrixValue() const
Returns the value of the field.
MatrixField()
Implements the runtime type system interface for this class.
void setValue(const Matrix4 &matrixValue)
Same as setMatrix4Value().
Definition mlFields.h:1653
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void setMatrix4Value(const Matrix4 &matrixValue)
Sets the value of the field to matrixValue; same as setMatrixValue for symmetry to other fields.
MatrixField(const std::string &name)
Constructor, creates a field with a name to manage a 4x4 matrix.
void updateMatrix4Value(const Matrix4 &matrixValue)
Sets the value of the field to matrixValue, but only touch field if the new value is different from t...
const Matrix4 & getMatrix4Value() const
Returns the value of the field; same as getMatrixValue for symmetry to other fields.
std::string getStringValue() const override
Returns the value of the field as a string value.
void setMatrixValue(const Matrix4 &matrixValue)
Sets the value of the field to matrixValue.
const Matrix4 & getValue() const
Same as getMatrix4Value().
Definition mlFields.h:1659
void updateValue(const Matrix4 &matrixValue)
Same as updateMatrix4Value().
Definition mlFields.h:1656
Base class for an image processing module of the ML.
Definition mlModule.h:151
Field without value for notifications.
Definition mlFields.h:659
std::string getStringValue() const override
Returns an empty string, because the field has no value.
void setStringValue(const std::string &) override
Only calls notifyAttachments() to notify attached fields or sensors.
void notify()
Calls touch() to notify connected sensors or fields.
NotifyField()
Implements the runtime type system interface for this class.
NotifyField(const std::string &name)
Constructor, creates a notification field with a name.
Field to encapsulate a pointer to an output connector which represents a module output.
Definition mlFields.h:695
std::string getStringValue() const override
Reference to OutputConnector as C-string to return (OutputConnector do not have a value,...
MLint isValidValue() override
Returns 1 if connector field contains a valid connector pointer.
OutputConnectorField()
Implements the runtime type system interface for this class.
OutputConnectorField(const std::string &name, Module *module, MLint outputImageIndex)
Constructor, creates a field with a name to manage an OutputConnector on the Module module at index o...
void setStringValue(const std::string &) override
Only calls touch() to propagate notifications.
void touch(FieldSensor::Strength strength=FieldSensor::CHANGED) override
A notified output image must also clear its PagedImage if it is considered as changed.
OutputConnector & getOutputConnectorValue() const
Returns a reference to the OutputConnector.
~OutputConnectorField() override
Destroys the field.
Class to manage an output connection for a Module module.
Field to encapsulate a vector of 4 double values representing a plane with all properties of Vector4F...
Definition mlFields.h:2174
void setPlaneValue(double f0, double f1, double f2, double f3)
Set field value to (f0, f1, f2, f3).
void getPlaneValue(double &f0, double &f1, double &f2, double &f3) const
Returns the value of the field.
void setPlaneValue(const Plane &p)
Set field value to p.
PlaneField(const std::string &name="")
Implements the runtime type system interface for this class.
Definition mlFields.h:2182
Plane getPlaneValue() const
Returns the value of the field.
void getPlaneValue(Plane &plane) const
Returns the value of the field.
Class defining a plane in 3D.
Definition mlPlane.h:30
Field to encapsulate a void pointer to arbitrary data.
Definition mlFields.h:992
void setStringValue(const std::string &stringValue) override
Sets field value from string to stringValue.
void * getPointerValue() const
Returns the value of the field.
std::string getStringValue() const override
Returns the value of the field as string value.
void setValue(void *voidPointerValue)
Same as setPointerValue().
Definition mlFields.h:1020
PointerField()
Implements the runtime type system interface for this class.
void * getValue() const
Same as getPointerValue().
Definition mlFields.h:1023
void setPointerValue(void *voidPointerValue)
Sets value of the field to voidPointerValue.
PointerField(const std::string &name)
Constructor, creates a field with a name to manage a void pointer.
Field to encapsulate an increasing float value from range [0,1].
Definition mlFields.h:491
void setProgressValue(float floatValue)
Same as setFloatValue().
void setValue(float floatValue)
Same as setFloatValue().
Definition mlFields.h:521
ProgressField(const std::string &name)
Constructor, creates a field with a name to manage a progressive float value.
ProgressField()
Implements the runtime type system interface for this class.
void setFloatValue(float floatValue)
Sets field value to floatValue if floatValue==0, floatValue==1 or floatValue > previous floatValue + ...
void setUpdateDifference(float epsilonValue)
Sets an epsilon value which a new value must have more than the previous value to be accepted as new ...
float getProgressValue()
Same as getFloatValue().
Definition mlFields.h:514
Field to encapsulate a vector of 4 double values representing a rotation with all properties of Vecto...
Definition mlFields.h:2145
RotationField(const std::string &name="")
Implements the runtime type system interface for this class.
Definition mlFields.h:2153
Rotation getRotationValue() const
Returns rotation value as a rotation class instance.
void setRotationValue(const Rotation &rot)
Sets rotation value by a rotation instance.
void setRotationValue(const Vector3 &vec, double angle)
Set rotation as rotation axes and angle how much to rotate.
void getRotationValue(Vector3 &vec, double &angle) const
Returns rotation as vector and rotation angle.
Class to handle Rotations (internally the rotation is stored as a unit quaternion)
Definition mlRotation.h:40
RuntimeType contains type and inheritance information of a class and a static dictionary with informa...
Field to encapsulate a pointer to an SoNode instance of OpenInventor.
Definition mlFields.h:937
SoNodeField()
Implements the runtime type system interface for this class.
SoNode * getSoNodeValue() const
Returns the value of the field.
SoNodeField(const std::string &name)
Constructor, creates a field with a name to manage a SoNode pointer.
void setSoNodeValue(SoNode *soNodeValue)
Sets value of the field to soNodeValue.
void setValue(SoNode *soNodeValue)
Same as setSoNodeValue().
Definition mlFields.h:965
std::string getStringValue() const override
Returns the value of the field as string value.
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
SoNode * getValue() const
Same as getSoNodeValue().
Definition mlFields.h:968
void setStringValue(const std::string &stringValue) override
Sets field value from string to stringValue. On non-successful string parsing, a NULL pointer is set.
Field to encapsulate a string value.
Definition mlFields.h:610
std::string getStringValue() const override
Returns the value of the field as a string value setStringValue must be able to reinterpret this retu...
StringField()
Implements the runtime type system interface for this class.
std::string getValue() const
Same as getStringValue().
Definition mlFields.h:642
void updateStringValue(const std::string &stringValue)
Sets value of the field to stringValue, but only touch field if the new value is different from the o...
StringField(const std::string &name)
Constructor, creates a field with a name to manage a string value.
void setStringValue(const std::string &stringValue) override
Sets value of the field to stringValue.
void updateValue(const std::string &stringValue)
Same as updateStringValue().
Definition mlFields.h:639
void setValue(const std::string &stringValue)
Same as setStringValue().
Definition mlFields.h:636
Field to encapsulate an ML integer SubimgBox.
Definition mlFields.h:1932
void setValue(const SubImageBox &subImageBoxValue)
Same as setSubImageBoxValue().
Definition mlFields.h:1964
SubImageBoxField(const std::string &name)
Constructor, creates a field with a name to manage an integer box.
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
std::string getStringValue() const override
Returns the value of the field as a string value.
SubImageBoxField()
Implements the runtime type system interface for this class.
void updateSubImageBoxValue(const SubImageBox &subImageBoxValue)
Sets the value of the field to subImageBoxValue, but only touch field if the new value is different f...
const SubImageBox & getSubImageBoxValue() const
Returns the value of the field.
const SubImageBox & getValue() const
Same as getSubImageBoxValue().
Definition mlFields.h:1970
void setSubImageBoxValue(const SubImageBox &subImageBoxValue)
Sets the value of the field to subImageBoxValue.
void updateValue(const SubImageBox &subImageBoxValue)
Same as updateSubImageBoxValue().
Definition mlFields.h:1967
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
Field to encapsulate an ML double SubimgBox.
Definition mlFields.h:1991
const SubImageBoxd & getSubImageBoxdValue() const
Returns the value of the field.
void updateSubImageBoxdValue(const SubImageBoxd &subImageBoxfValue)
Sets the value of the field to subImageBoxfValue, but only touch field if the new value is different ...
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
const SubImageBoxd & getValue() const
Same as getSubImageBoxdValue().
Definition mlFields.h:2030
void setValue(const SubImageBoxd &subImageBoxValue)
Same as setSubImageBoxdValue().
Definition mlFields.h:2024
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
std::string getStringValue() const override
Returns the value of the field as a string value.
SubImageBoxdField()
Implements the runtime type system interface for this class.
SubImageBoxdField(const std::string &name)
Constructor, creates a field with a name to manage a float box.
void updateValue(const SubImageBoxd &subImageBoxValue)
Same as updateSubImageBoxdValue().
Definition mlFields.h:2027
void setSubImageBoxdValue(const SubImageBoxd &subImageBoxfValue)
Sets the value of the field to subImageBoxfValue.
SubImageBoxd - SubImageBox with coordinates of float data type.
Templated version of BaseField which only stores the template type as pointer.
Definition mlFields.h:907
void setValue(T *basePointerValue)
Sets the value of the field to basePointerValue.
Definition mlFields.h:913
void setValue(const ::boost::intrusive_ptr< T > &value)
Sets the value from intrusive pointer.
Definition mlFields.h:916
T * getValue() const
Returns current field value.
Definition mlFields.h:919
TypedBaseField(const std::string &name)
Constructor, creates a field with a name to manage a typed Base pointer. Default value is NULL.
Definition mlFields.h:910
TypedEnumField is used to encapsulate a C++ enum value and work with a real enum value instead of int...
Definition mlFields.h:384
TypedEnumField(const std::string &name, const EnumValues< EnumType > &enumValues, EnumType initialValue)
Create the TypedEnumField with given name, enumValues and initialValue.
Definition mlFields.h:389
EnumType getEnumValue() const
Gets the current enum value.
Definition mlFields.h:397
void setEnumValue(EnumType enumValue)
Sets the current enum value and touches the field.
Definition mlFields.h:399
EnumType getValue() const
Same as getEnumValue().
Definition mlFields.h:403
void updateValue(EnumType enumValue)
Same as updateEnumValue().
Definition mlFields.h:407
void updateEnumValue(EnumType enumValue)
Sets the current enum value and only touches the field if the value has changed.
Definition mlFields.h:401
void setValue(EnumType enumValue)
Same as setEnumValue().
Definition mlFields.h:405
Field to encapsulate any of the registered ML types.
Definition mlFields.h:2052
virtual void _updateIsValidAndTypeDataFromOrigString()
Parse _origString dependent on the current data type and update _isValid and _typeData.
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
virtual void _updateIsValidAndStrValueFromTypeData()
Parse _typeData dependent on the current data type and update _isValid and _strValue.
virtual void setDataType(MLDataType dataType)
Sets the data type to dataType.
void setValue(const MLTypeData *typeData)
Same as setUniversalTypeValue().
Definition mlFields.h:2101
void _updateFieldFromOrigString()
Combine the above methods, return _origString on invalid data type, and touch the field.
MLint isValidValue() override
Returns true (=1) if field value is valid, otherwise false (=0).
MLTypeData * getValue() const
Same as getUniversalTypeValue().
Definition mlFields.h:2104
virtual void setUniversalTypeValue(const MLTypeData *dataType)
Sets the value of the field to dataType. The passed data is copied.
virtual MLDataType getDataType() const
Returns the current data type of this field. Default is invalid, i.e., -1.
UniversalTypeField(const std::string &name="", MLDataType dt=-1)
Implements the runtime type system interface for this class.
std::string getStringValue() const override
Returns the value of the field as a string value.
~UniversalTypeField() override
Destructor, frees buffer for type data.
virtual MLldouble getValueCastToLDouble() const
Returns the current value of the field cast to MLldouble.
virtual const MLTypeData * getShortLivedUniversalTypeValue() const
Returns the temporary internal buffer value of the field which is short-lived and which must NOT be m...
virtual MLTypeData * getUniversalTypeValue() const
Returns the current value of the field as a memory copy which can be changed by the caller.
Field to encapsulate a vector of 10 double values.
Definition mlFields.h:1373
Vector10Field()
Implements the runtime type system interface for this class.
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
void setValue(const Vector10 &vectorValue)
Same as setVector10Value().
Definition mlFields.h:1414
void setVectorValue(const Vector10 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1399
const Vector10 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1411
const Vector10 & getVector10Value() const
Returns the value of the field.
void setVector10Value(const Vector10 &vectorValue)
Sets the value of the field to vectorValue.
void updateValue(const Vector10 &vectorValue)
Same as updateVector10Value().
Definition mlFields.h:1417
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
const Vector10 & getValue() const
Same as getVector10Value().
Definition mlFields.h:1420
void updateVector10Value(const Vector10 &vectorValue)
Sets the value of the field to vectorValue, but only touch field if the new value is different from t...
Vector10Field(const std::string &name)
Constructor, creates a field with a name to manage a vector of 10 double values initialized to (0,...
std::string getStringValue() const override
Returns the value of the field as string value.
Field to encapsulate a vector of 2 double values.
Definition mlFields.h:1038
std::string getStringValue() const override
Returns the value of the field as a string value.
void setVectorValue(const Vector2 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1063
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void updateValue(const Vector2 &vectorValue)
Same as updateVector2Value().
Definition mlFields.h:1078
void setValue(const Vector2 &vectorValue)
Same as setVector2Value().
Definition mlFields.h:1075
const Vector2 & getValue() const
Same as getVector2Value().
Definition mlFields.h:1081
const Vector2 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1072
void updateVector2Value(const Vector2 &vectorValue)
Sets the value of the field to vectorValue, but only touch field if the new value is different from t...
const Vector2 & getVector2Value() const
Returns the value of the field.
Vector2Field(const std::string &name)
Constructor, creates a field with a name to manage a vector of 2 double values.
void setVector2Value(const Vector2 &vectorValue)
Sets the value of the field to vectorValue.
Vector2Field()
Implements the runtime type system interface for this class.
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
Field to encapsulate a vector of 3 double values.
Definition mlFields.h:1103
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
const Vector3 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1139
void updateValue(const Vector3 &vectorValue)
Same as updateVector3Value().
Definition mlFields.h:1145
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
const Vector3 & getVector3Value() const
Returns the value of the field.
void setVector3Value(const Vector3 &vectorValue)
Sets the value of the field to vectorValue.
Vector3Field(const std::string &name)
Constructor, creates a field with a name to manage a vector of 3 double values.
void updateVector3Value(const Vector3 &vectorValue)
Sets the value of the field to vectorValue, but only touch field if the new value is different from t...
Vector3Field()
Implements the runtime type system interface for this class.
const Vector3 & getValue() const
Same as getVector3Value().
Definition mlFields.h:1148
void setVectorValue(const Vector3 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1128
void setValue(const Vector3 &vectorValue)
Same as setVector3Value().
Definition mlFields.h:1142
std::string getStringValue() const override
Returns the value of the field as string value setStringValue must be able to reinterpret this return...
Field to encapsulate a vector of 4 double values.
Definition mlFields.h:1171
std::string getStringValue() const override
Returns the value of the field as a string value.
void updateVector4Value(const Vector4 &vectorValue)
Sets the value of the field to vectorValue, but only touch field if the new value is different from t...
const Vector4 & getValue() const
Same as getVector4Value().
Definition mlFields.h:1217
void setValue(const Vector4 &vectorValue)
Same as setVector4Value().
Definition mlFields.h:1211
const Vector4 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1208
Vector4Field(const std::string &name)
Constructor, creates a field with a name to manage a vector of 4 double values.
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
void setVectorValue(const Vector4 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1196
void setVector4Value(const Vector4 &vectorValue)
Sets the value of the field to vectorValue.
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void updateValue(const Vector4 &vectorValue)
Same as updateVector4Value().
Definition mlFields.h:1214
const Vector4 & getVector4Value() const
Returns the value of the field.
Vector4Field()
Implements the runtime type system interface for this class.
Field to encapsulate a vector of 5 double values.
Definition mlFields.h:1239
void updateValue(const Vector5 &vectorValue)
Same as updateVector5Value().
Definition mlFields.h:1282
std::string getStringValue() const override
Returns the value of the field as a string value.
Vector5Field()
Implements the runtime type system interface for this class.
const Vector5 & getValue() const
Same as getVector5Value().
Definition mlFields.h:1285
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
const Vector5 & getVector5Value() const
Returns the value of the field.
void setVector5Value(const Vector5 &vectorValue)
Sets the value of the field to vectorValue.
const Vector5 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1276
Vector5Field(const std::string &name)
Constructor, creates a field with a name to manage a vector of 5 double values initialized to (0,...
void setVectorValue(const Vector5 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1265
void updateVector5Value(const Vector5 &vectorValue)
Sets the value of the field to vectorValue, but only touch field if the new value is different from t...
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
void setValue(const Vector5 &vectorValue)
Same as setVector5Value().
Definition mlFields.h:1279
Field to encapsulate a vector of 6 double values.
Definition mlFields.h:1305
Vector6Field()
Implements the runtime type system interface for this class.
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
const Vector6 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1342
void setVectorValue(const Vector6 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1331
void updateValue(const Vector6 &vectorValue)
Same as updateVector6Value().
Definition mlFields.h:1348
void updateVector6Value(const Vector6 &vectorValue)
Sets the value of the field to vectorValue, but only touch field if the new value is different from t...
void setVector6Value(const Vector6 &vectorValue)
Sets the value of the field to vectorValue.
const Vector6 & getVector6Value() const
Returns the value of the field.
void setValue(const Vector6 &vectorValue)
Same as setVector6Value().
Definition mlFields.h:1345
std::string getStringValue() const override
Returns the value of the field as a string value.
Vector6Field(const std::string &name)
Constructor, creates a field with a name to manage a vector of 6 double values.
void setValueFromField(const Field &field) override
Reimplementation from Field which copies the field value more efficiently.
const Vector6 & getValue() const
Same as getVector6Value().
Definition mlFields.h:1351
#define ML_ABSTRACT_CLASS_HEADER(className)
Same like ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non existing export symbol.
MLint32 MLDataType
MLDataType.
Definition mlTypeDefs.h:596
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
#define ML_CLASS_HEADER(className)
Same like ML_CLASS_HEADER_EXPORTED with a non existing export symbol.
long double MLldouble
Definition mlTypeDefs.h:232
MLint64 * MLintPtr
A pointer to the signed ML integer type MLint.
Definition mlTypeDefs.h:493
unsigned int MLuint32
Definition mlTypeDefs.h:185
unsigned char MLTypeData
This is the pointer type used to point to the data of MLType data instances.
MLint64 MLint
A signed ML integer type with at least 64 bits used for index calculations on very large images even ...
Definition mlTypeDefs.h:490
EnumValues< EnumType >::Entry createEnumEntry(const char *value, EnumType enumValue)
Helper method to infer the EnumType via the function signature.
Definition mlFields.h:373
MLEXPORT void MLInitFields()
Initialize all standard fields of the ML.
Defines the entry for one enum value.
Definition mlFields.h:255
EnumEntry(const std::string &sv, int v)
Definition mlFields.h:257
std::string stringValue
The string value of the entry.
Definition mlFields.h:260
int value
The enum value of the entry.
Definition mlFields.h:262
Defines the entry for one enum value.
Definition mlFields.h:322
EnumType value
The enum value of the entry.
Definition mlFields.h:329
const char * stringValue
The string value of the entry.
Definition mlFields.h:327
Entry(const char *sv, EnumType v)
Definition mlFields.h:324