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
42class Module;
43class OutputConnector;
44class InputConnector;
45
46//-------------------------------------------------------------------------
48//-------------------------------------------------------------------------
50
51//-------------------------------------------------------------------------
54//-------------------------------------------------------------------------
55class MLEXPORT BoolField : public Field
56{
59
60public:
61
63 BoolField() = default;
64
67 explicit BoolField(const std::string& name);
68
70 void setStringValue(const std::string& value) override;
71
74
78
81
83 std::string getStringValue() const override;
84
86 bool getBoolValue() const;
87
89 bool isOn() const;
90
92 void setValue(bool boolValue) { setBoolValue(boolValue); }
93
95 void updateValue(bool boolValue) { updateBoolValue(boolValue); }
96
98 bool getValue() const { return getBoolValue(); }
99
100protected:
101
103 void setValueFromField(const Field& field) override;
104
105private:
106
108 bool _value{};
109};
110
111
112//-------------------------------------------------------------------------
115//-------------------------------------------------------------------------
116class MLEXPORT IntField : public Field
117{
120
121public:
122
124 IntField() = default;
125
128 explicit IntField(const std::string& name);
129
131 void setStringValue(const std::string& value) override;
132
135
139
143 std::string getStringValue() const override;
144
147
149 void setValue(MLint intValue) { setIntValue(intValue); }
150
152 void updateValue(MLint intValue) { updateIntValue(intValue); }
153
155 MLint getValue() const { return getIntValue(); }
156
157protected:
158
160 void setValueFromField(const Field& field) override;
161
162private:
163
165 MLint _value{};
166};
167
168//-------------------------------------------------------------------------
171//-------------------------------------------------------------------------
173{
176
177public:
185 EnumField(const std::string& name, const std::string enumerationItemNames[], size_t numEnumerationItems);
186
194 EnumField(const std::string& name, const char* const* enumerationItemNames, size_t numEnumerationItems);
195
203 EnumField(const std::string& name, const std::vector<std::string> &enumerationItemNames);
204
206 ~EnumField() override = default;
207
211 void setStringValue(const std::string& value) override;
212
215 void setStringValueDefaulted(const std::string& value);
216
219
223
227 std::string getStringValue() const override;
228
230 int getEnumValue() const;
231
233 struct EnumEntry {
234 EnumEntry():value(-1) {}
235 EnumEntry(const std::string& sv, int v) : stringValue(sv), value(v) { }
236
238 std::string stringValue;
240 int value;
241 };
242
247 const EnumEntry& getEnumEntryAtIndex(size_t index) const;
248
251
253 void setValue(int enumValue) { setEnumValue(enumValue); }
254
256 void updateValue(int enumValue) { updateEnumValue(enumValue); }
257
259 int getValue() const { return getEnumValue(); }
260
261protected:
262
264 void _initialize(const std::string& name="", size_t numEnums=0);
265
267 void _setEnumerationNames(const std::string enumNames[]);
269 void _setEnumerationNames(const char* const* enumNames);
271 void _setEnumerationNames(const std::vector<std::string> &enumNames);
273 void _setEnumerationNames(const std::vector<EnumField::EnumEntry>& enumValues, int initialValue);
274
276 int _value{};
277
279 bool _linearEntries{};
280
282 std::vector<EnumEntry> _entries;
283
284protected:
286 EnumField() = default;
287};
288
291template <typename EnumType>
293{
294public:
296 struct Entry {
297 Entry():stringValue(nullptr), value(-1) {}
298 Entry(const char* sv, EnumType v) : stringValue(sv), value(v) { }
299
301 const char* stringValue;
304 };
305
306public:
308 void add(const char* stringValue, EnumType value) {
309 _entries.emplace_back(stringValue, static_cast<int>(value));
310 }
311
313 void add(const std::string& stringValue, EnumType value) {
314 _entries.emplace_back(stringValue, static_cast<int>(value));
315 }
316
318 void add(const Entry& value) {
319 _entries.push_back(EnumField::EnumEntry(value.stringValue, static_cast<int>(value.value)));
320 }
321
323 EnumValues& operator<<(const Entry& value) {
324 add(value);
325 return *this;
326 }
327
329 const std::vector<EnumField::EnumEntry>& getEntries() const { return _entries; }
330
331protected:
332 std::vector<EnumField::EnumEntry> _entries;
333};
334
338#define ML_ENUM_VALUE(enumValue) internal::createEnumEntry(#enumValue, enumValue)
339
342#define ML_EXTERNAL_ENUM_VALUE(enumClass, enumValue) internal::createEnumEntry(#enumValue, enumClass::enumValue)
343
344namespace internal {
346 template <typename EnumType>
347 inline typename EnumValues<EnumType>::Entry createEnumEntry(const char* value, EnumType enumValue) {
348 return typename EnumValues<EnumType>::Entry(value, enumValue);
349 }
350}
351
352//-------------------------------------------------------------------------
355//-------------------------------------------------------------------------
356template <typename EnumType>
358{
359public:
360 static_assert(sizeof(std::underlying_type<EnumType>) <= sizeof(int), "The underlying type cannot be bigger than int!");
361
364 {
365 const std::vector<EnumField::EnumEntry>& entries = enumValues.getEntries();
366 _initialize(name, entries.size());
367 _setEnumerationNames(entries, static_cast<int>(initialValue));
368 }
369
371 EnumType getEnumValue() const { return static_cast<EnumType>(EnumField::getEnumValue()); }
373 void setEnumValue(EnumType enumValue) { EnumField::setEnumValue(static_cast<int>(enumValue)); }
375 void updateEnumValue(EnumType enumValue) { EnumField::updateEnumValue(static_cast<int>(enumValue)); }
377 EnumType getValue() const { return getEnumValue(); }
379 void setValue(EnumType enumValue) { setEnumValue(enumValue); }
381 void updateValue(EnumType enumValue) { updateEnumValue(enumValue); }
382};
383
384//-------------------------------------------------------------------------
387//-------------------------------------------------------------------------
389{
392
393public:
394
396 FloatField() = default;
397
400 explicit FloatField(const std::string& name);
401
403 void setStringValue(const std::string& stringValue) override;
404
408
414
417 std::string getStringValue() const override;
418
420 float getFloatValue() const;
421
423 void setValue(float floatValue) { setFloatValue(floatValue); }
424
426 void updateValue(float floatValue) { updateFloatValue(floatValue); }
427
429 float getValue() const { return getFloatValue(); }
430
432 static void setValueCallback(void* field, double value);
433
434protected:
436 void setValueFromField(const Field& field) override;
437
439 float _value{};
440};
441
442
443//-------------------------------------------------------------------------
449//-------------------------------------------------------------------------
451{
454
455public:
456
459
464 explicit ProgressField(const std::string& name);
465
469
472
474 inline float getProgressValue() { return getFloatValue(); }
475
479
481 void setValue(float floatValue) { setFloatValue(floatValue); }
482
483private:
485 float _difference{0.02f};
486};
487
488
489//-------------------------------------------------------------------------
492//-------------------------------------------------------------------------
494{
497
498
499public:
500
502 DoubleField() = default;
503
506 explicit DoubleField(const std::string& name);
507
509 void setStringValue(const std::string& stringValue) override;
510
513
519
522 std::string getStringValue() const override;
523
525 double getDoubleValue() const;
526
528 void setValue(double doubleValue) { setDoubleValue(doubleValue); }
529
531 void updateValue(double doubleValue) { updateDoubleValue(doubleValue); }
532
534 double getValue() const { return getDoubleValue(); }
535
537 static void setValueCallback(void* field, double value);
538
539protected:
541 void setValueFromField(const Field& field) override;
542
543private:
545 double _value{};
546};
547
548//-------------------------------------------------------------------------
551//-------------------------------------------------------------------------
553{
556
557public:
558
560 StringField() = default;
561
564 explicit StringField(const std::string& name);
565
567 void setStringValue(const std::string& stringValue) override;
568
571 void updateStringValue(const std::string& stringValue);
572
575 std::string getStringValue() const override;
576
578 void setValue(const std::string& stringValue) { setStringValue(stringValue); }
579
581 void updateValue(const std::string& stringValue) { updateStringValue(stringValue); }
582
584 std::string getValue() const { return getStringValue(); }
585
586private:
589 std::string _value;
590};
591
592
593//-------------------------------------------------------------------------
596//-------------------------------------------------------------------------
598{
601
602public:
603
606
610 explicit NotifyField(const std::string& name);
611
614 void setStringValue(const std::string& /*value*/) override;
615
617 std::string getStringValue() const override;
618
620 void notify();
621
622};
623
627
628//-------------------------------------------------------------------------
632//-------------------------------------------------------------------------
634{
637
638public:
639
642
645 OutputConnectorField(const std::string& name, Module* module, MLint outputImageIndex);
646
649
653 void setStringValue(const std::string& /*value*/) override;
654
658 void touch(FieldSensor::Strength strength=FieldSensor::CHANGED) override;
659
664 std::string getStringValue() const override;
665
668
670 MLint isValidValue() override;
671
672private:
673
675 OutputConnector* _value{};
676};
677
678
679//-------------------------------------------------------------------------
683//-------------------------------------------------------------------------
685{
688
689public:
690
693
698 InputConnectorField(const std::string& name, Module* module, MLint inputImageIndex);
699
702
706 void setStringValue(const std::string& /*value*/) override;
707
710 std::string getStringValue() const override;
711
714
716 MLint isValidValue() override;
717
718private:
720 InputConnector* _value{};
721};
722
723
724//-------------------------------------------------------------------------
727//-------------------------------------------------------------------------
729{
732
733public:
734
736 BaseField() = default;
737
740 explicit BaseField(const std::string& name);
741
743 ~BaseField() override;
744
746 void setStringValue(const std::string& stringValue) override;
747
750
752 void setBaseValue(const RefCountedBasePtr& value);
753
757 std::string getStringValue() const override;
758
761
763 virtual void touchSourceFields();
764
771
773 template <typename T>
774 void addAllowedType() { addAllowedType(T::getClassTypeId()); }
775
779 template <typename T>
780 void setBaseValueAndAddAllowedType(T* value) { addAllowedType(value->getClassTypeId()); setBaseValue(value); }
781
784 template <typename T>
785 void setBaseValueAndAddAllowedType(const ::boost::intrusive_ptr<T>& value) { setBaseValueAndAddAllowedType(value.get()); }
786
788 std::vector<const RuntimeType*> getAllowedTypes() const { return _allowedTypes; }
789
792 bool hasUnallowedType() const { return _unallowedType; }
793
796
798 void setValue(const RefCountedBasePtr& value) { setBaseValue(value); }
799
801 Base* getValue() const { return getBaseValue(); }
802
804 template <class Type>
805 Type getTypedValue() const { return mlbase_cast<Type>(getValue()); }
806
808 template <class Type>
809 Type getTypedBaseValue() const { return mlbase_cast<Type>(getValue()); }
810
811protected:
813 void setValueFromField(const Field& field) override;
814
815private:
817 Base* _value{};
818
820 std::vector<const RuntimeType*> _allowedTypes;
821
823 bool _unallowedType{};
825 bool _isRefCountedBase{};
826};
827
828//-------------------------------------------------------------------------
831//-------------------------------------------------------------------------
832
833template<class T>
835{
836public:
838 explicit TypedBaseField(const std::string& name) : BaseField(name) { BaseField::addAllowedType<T>(); }
839
841 void setValue(T* basePointerValue) { setBaseValue(basePointerValue); }
842
844 void setValue(const ::boost::intrusive_ptr<T>& value) { setValue(value.get()); }
845
847 T* getValue() const { return getTypedValue<T*>(); }
848
849private:
851 using BaseField::addAllowedType;
853 using BaseField::setBaseValueAndAddAllowedType;
854};
855
856
857//-------------------------------------------------------------------------
863//-------------------------------------------------------------------------
865{
868
869public:
870
872 SoNodeField() = default;
873
876 explicit SoNodeField(const std::string& name);
877
879 void setStringValue(const std::string& stringValue) override;
880
883
887 std::string getStringValue() const override;
888
890 SoNode* getSoNodeValue() const;
891
893 void setValue(SoNode* soNodeValue) { setSoNodeValue(soNodeValue); }
894
896 SoNode* getValue() const { return getSoNodeValue(); }
897
898protected:
900 void setValueFromField(const Field& field) override;
901
902private:
904 SoNode* _value{};
905};
906
907
908//-------------------------------------------------------------------------
915//-------------------------------------------------------------------------
917{
920
921public:
922
924 PointerField() = default;
925
928 explicit PointerField(const std::string& name);
929
932 void setStringValue(const std::string& stringValue) override;
933
936
939 std::string getStringValue() const override;
940
942 void* getPointerValue() const;
943
945 void setValue(void* voidPointerValue) { setPointerValue(voidPointerValue); }
946
948 void* getValue() const { return getPointerValue(); }
949
950private:
952 void* _value{};
953};
954
955//-------------------------------------------------------------------------
958//-------------------------------------------------------------------------
960{
963
964public:
965
967 Vector2Field() = default;
968
971 explicit Vector2Field(const std::string& name);
972
974 void setStringValue(const std::string& stringValue) override;
975
978
983
985 inline void setVectorValue(const Vector2& vectorValue) { setVector2Value(vectorValue); }
986
988 std::string getStringValue() const override;
989
991 const Vector2& getVector2Value() const;
992
994 inline const Vector2& getVectorValue() const { return getVector2Value(); }
995
997 void setValue(const Vector2& vectorValue) { setVector2Value(vectorValue); }
998
1000 void updateValue(const Vector2& vectorValue) { updateVector2Value(vectorValue); }
1001
1003 const Vector2& getValue() const { return getVector2Value(); }
1004
1005protected:
1007 void setValueFromField(const Field& field) override;
1008
1009private:
1011 Vector2 _value;
1012};
1013
1014//-------------------------------------------------------------------------
1017//-------------------------------------------------------------------------
1019{
1022
1023public:
1024
1026 Vector3Field() = default;
1027
1030 explicit Vector3Field(const std::string& name);
1031
1033 void setStringValue(const std::string& stringValue) override;
1034
1037
1042
1044 inline void setVectorValue(const Vector3& vectorValue) { setVector3Value(vectorValue); }
1045
1049 std::string getStringValue() const override;
1050
1052 const Vector3& getVector3Value() const;
1053
1055 inline const Vector3& getVectorValue() const { return getVector3Value(); }
1056
1058 void setValue(const Vector3& vectorValue) { setVector3Value(vectorValue); }
1059
1061 void updateValue(const Vector3& vectorValue) { updateVector3Value(vectorValue); }
1062
1064 const Vector3& getValue() const { return getVector3Value(); }
1065
1066
1067protected:
1069 void setValueFromField(const Field& field) override;
1070
1071private:
1073 Vector3 _value;
1074};
1075
1076//-------------------------------------------------------------------------
1079//-------------------------------------------------------------------------
1081{
1084
1085public:
1086
1088 Vector4Field() = default;
1089
1092 explicit Vector4Field(const std::string& name);
1093
1095 void setStringValue(const std::string& stringValue) override;
1096
1099
1104
1106 inline void setVectorValue(const Vector4& vectorValue) { setVector4Value(vectorValue); }
1107
1111 std::string getStringValue() const override;
1112
1114 const Vector4& getVector4Value() const;
1115
1117 inline const Vector4& getVectorValue() const { return getVector4Value(); }
1118
1120 void setValue(const Vector4& vectorValue) { setVector4Value(vectorValue); }
1121
1123 void updateValue(const Vector4& vectorValue) { updateVector4Value(vectorValue); }
1124
1126 const Vector4& getValue() const { return getVector4Value(); }
1127
1128protected:
1130 void setValueFromField(const Field& field) override;
1131
1132private:
1134 Vector4 _value;
1135};
1136
1137//-------------------------------------------------------------------------
1140//-------------------------------------------------------------------------
1142{
1145
1146
1147public:
1148
1150 Vector5Field() = default;
1151
1154 explicit Vector5Field(const std::string& name);
1155
1157 void setStringValue(const std::string& stringValue) override;
1158
1161
1166
1168 inline void setVectorValue(const Vector5& vectorValue) { setVector5Value(vectorValue); }
1169
1173 std::string getStringValue() const override;
1174
1176 const Vector5& getVector5Value() const;
1177
1179 inline const Vector5& getVectorValue() const { return getVector5Value(); }
1180
1182 void setValue(const Vector5& vectorValue) { setVector5Value(vectorValue); }
1183
1185 void updateValue(const Vector5& vectorValue) { updateVector5Value(vectorValue); }
1186
1188 const Vector5& getValue() const { return getVector5Value(); }
1189
1190protected:
1192 void setValueFromField(const Field& field) override;
1193
1194private:
1196 Vector5 _value;
1197};
1198
1199
1200//-------------------------------------------------------------------------
1203//-------------------------------------------------------------------------
1205{
1208
1209
1210public:
1211
1213 Vector6Field() = default;
1214
1217 explicit Vector6Field(const std::string& name);
1218
1220 void setStringValue(const std::string& stringValue) override;
1221
1224
1229
1231 inline void setVectorValue(const Vector6& vectorValue) { setVector6Value(vectorValue); }
1232
1236 std::string getStringValue() const override;
1237
1239 const Vector6& getVector6Value() const;
1240
1242 inline const Vector6& getVectorValue() const { return getVector6Value(); }
1243
1245 void setValue(const Vector6& vectorValue) { setVector6Value(vectorValue); }
1246
1248 void updateValue(const Vector6& vectorValue) { updateVector6Value(vectorValue); }
1249
1251 const Vector6& getValue() const { return getVector6Value(); }
1252
1253protected:
1255 void setValueFromField(const Field& field) override;
1256
1257private:
1259 Vector6 _value;
1260};
1261
1262//-------------------------------------------------------------------------
1265//-------------------------------------------------------------------------
1267{
1270
1271
1272public:
1273
1275 Vector10Field() = default;
1276
1279 explicit Vector10Field(const std::string& name);
1280
1282 void setStringValue(const std::string& stringValue) override;
1283
1286
1291
1293 inline void setVectorValue(const Vector10& vectorValue) { setVector10Value(vectorValue); }
1294
1295
1299 std::string getStringValue() const override;
1300
1303
1305 inline const Vector10& getVectorValue() const { return getVector10Value(); }
1306
1308 void setValue(const Vector10& vectorValue) { setVector10Value(vectorValue); }
1309
1311 void updateValue(const Vector10& vectorValue) { updateVector10Value(vectorValue); }
1312
1314 const Vector10& getValue() const { return getVector10Value(); }
1315
1316protected:
1318 void setValueFromField(const Field& field) override;
1319
1320private:
1322 Vector10 _value;
1323};
1324
1325//-------------------------------------------------------------------------
1330//-------------------------------------------------------------------------
1332{
1335
1336public:
1337
1340
1344 explicit ColorField(const std::string& name);
1345
1347 void setColorValue(float r, float g, float b);
1348
1352 void updateColorValue(float r, float g, float b);
1353
1355 void getColorValue(float& r, float& g, float& b) const;
1356
1358 const Vector3& getColorValue() const { return getVectorValue(); }
1359
1365
1370};
1371
1372
1373//-------------------------------------------------------------------------
1376//-------------------------------------------------------------------------
1378{
1381
1382public:
1385 explicit Matrix2Field(const std::string& name="");
1386
1390 void setStringValue(const std::string& stringValue) override;
1391
1393 void setMatrixValue(const Matrix2& matrixValue);
1394
1397 void setMatrix2Value(const Matrix2& matrixValue);
1398
1402 void updateMatrix2Value(const Matrix2& matrixValue);
1403
1407 std::string getStringValue() const override;
1408
1410 const Matrix2& getMatrixValue() const;
1411
1414 const Matrix2& getMatrix2Value() const;
1415
1417 void setValue(const Matrix2& matrixValue) { setMatrix2Value(matrixValue); }
1418
1420 void updateValue(const Matrix2& matrixValue) { updateMatrix2Value(matrixValue); }
1421
1423 const Matrix2& getValue() const { return getMatrix2Value(); }
1424
1425protected:
1427 void setValueFromField(const Field& field) override;
1428
1429private:
1431 Matrix2 _value;
1432};
1433
1434//-------------------------------------------------------------------------
1437//-------------------------------------------------------------------------
1439{
1442
1443public:
1446 explicit Matrix3Field(const std::string& name="");
1447
1451 void setStringValue(const std::string& stringValue) override;
1452
1454 void setMatrixValue(const Matrix3& matrixValue);
1455
1458 void setMatrix3Value(const Matrix3& matrixValue);
1459
1463 void updateMatrix3Value(const Matrix3& matrixValue);
1464
1468 std::string getStringValue() const override;
1469
1471 const Matrix3& getMatrixValue() const;
1472
1475 const Matrix3& getMatrix3Value() const;
1476
1478 void setValue(const Matrix3& matrixValue) { setMatrix3Value(matrixValue); }
1479
1481 void updateValue(const Matrix3& matrixValue) { updateMatrix3Value(matrixValue); }
1482
1484 const Matrix3& getValue() const { return getMatrix3Value(); }
1485
1486protected:
1488 void setValueFromField(const Field& field) override;
1489
1490private:
1492 Matrix3 _value;
1493};
1494
1495//-------------------------------------------------------------------------
1499//-------------------------------------------------------------------------
1501{
1504
1505public:
1506
1508 MatrixField() = default;
1509
1512 explicit MatrixField(const std::string& name);
1513
1517 void setStringValue(const std::string& stringValue) override;
1518
1520 void setMatrixValue(const Matrix4& matrixValue);
1521
1524 void setMatrix4Value(const Matrix4& matrixValue);
1525
1529 void updateMatrix4Value(const Matrix4& matrixValue);
1530
1534 std::string getStringValue() const override;
1535
1537 const Matrix4& getMatrixValue() const;
1538
1541 const Matrix4& getMatrix4Value() const;
1542
1544 void setValue(const Matrix4& matrixValue) { setMatrix4Value(matrixValue); }
1545
1547 void updateValue(const Matrix4& matrixValue) { updateMatrix4Value(matrixValue); }
1548
1550 const Matrix4& getValue() const { return getMatrix4Value(); }
1551
1552protected:
1554 void setValueFromField(const Field& field) override;
1555
1556private:
1558 Matrix4 _value{Matrix4::getIdentity()};
1559};
1560
1561
1562//-------------------------------------------------------------------------
1565//-------------------------------------------------------------------------
1567{
1570
1571public:
1574 explicit Matrix4Field(const std::string& name="");
1575};
1576
1577//-------------------------------------------------------------------------
1580//-------------------------------------------------------------------------
1582{
1585
1586public:
1589 explicit Matrix5Field(const std::string& name="");
1590
1594 void setStringValue(const std::string& stringValue) override;
1595
1597 void setMatrixValue(const Matrix5& matrixValue);
1598
1601 void setMatrix5Value(const Matrix5& matrixValue);
1602
1606 void updateMatrix5Value(const Matrix5& matrixValue);
1607
1611 std::string getStringValue() const override;
1612
1614 const Matrix5& getMatrixValue() const;
1615
1618 const Matrix5& getMatrix5Value() const;
1619
1621 void setValue(const Matrix5& matrixValue) { setMatrix5Value(matrixValue); }
1622
1624 void updateValue(const Matrix5& matrixValue) { updateMatrix5Value(matrixValue); }
1625
1627 const Matrix5& getValue() const { return getMatrix5Value(); }
1628
1629protected:
1631 void setValueFromField(const Field& field) override;
1632
1633private:
1635 Matrix5 _value;
1636};
1637
1638
1639//-------------------------------------------------------------------------
1642//-------------------------------------------------------------------------
1644{
1647
1648public:
1651 explicit Matrix6Field(const std::string& name="");
1652
1656 void setStringValue(const std::string& stringValue) override;
1657
1659 void setMatrixValue(const Matrix6& matrixValue);
1660
1663 void setMatrix6Value(const Matrix6& matrixValue);
1664
1668 void updateMatrix6Value(const Matrix6& matrixValue);
1669
1673 std::string getStringValue() const override;
1674
1676 const Matrix6& getMatrixValue() const;
1677
1680 const Matrix6& getMatrix6Value() const;
1681
1683 void setValue(const Matrix6& matrixValue) { setMatrix6Value(matrixValue); }
1684
1686 void updateValue(const Matrix6& matrixValue) { updateMatrix6Value(matrixValue); }
1687
1689 const Matrix6& getValue() const { return getMatrix6Value(); }
1690
1691protected:
1693 void setValueFromField(const Field& field) override;
1694
1695private:
1697 Matrix6 _value;
1698};
1699
1700
1701
1702//-------------------------------------------------------------------------
1705//-------------------------------------------------------------------------
1707{
1710
1711public:
1712
1714 MLDataTypeField() = default;
1715
1718 explicit MLDataTypeField(const std::string& name);
1719
1721 void setStringValue(const std::string& stringValue) override;
1722
1725
1729 std::string getStringValue() const override;
1730
1733
1735 void setValue(MLDataType dataType) { setMLDataTypeValue(dataType); }
1736
1738 MLDataType getValue() const { return getMLDataTypeValue(); }
1739
1740private:
1742 MLDataType _value{MLuint8Type};
1743};
1744
1745
1746//-------------------------------------------------------------------------
1750//-------------------------------------------------------------------------
1752{
1755
1756public:
1757
1759 ImageVectorField() = default;
1760
1763 explicit ImageVectorField(const std::string& name);
1764
1766 void setStringValue(const std::string& stringValue) override;
1767
1770
1774
1776 std::string getStringValue() const override;
1777
1780
1782 void setValue(const ImageVector& imageVectorValue) { setImageVectorValue(imageVectorValue); }
1783
1785 void updateValue(const ImageVector& imageVectorValue) { updateImageVectorValue(imageVectorValue); }
1786
1788 const ImageVector& getValue() const { return getImageVectorValue(); }
1789
1790protected:
1792 void setValueFromField(const Field& field) override;
1793
1794private:
1796 ImageVector _value;
1797};
1798
1799
1800
1801//-------------------------------------------------------------------------
1804//-------------------------------------------------------------------------
1806{
1809
1810public:
1811
1813 SubImageBoxField() = default;
1814
1817 explicit SubImageBoxField(const std::string& name);
1818
1820 void setStringValue(const std::string& stringValue) override;
1821
1824
1828
1832 std::string getStringValue() const override;
1833
1836
1838 void setValue(const SubImageBox& subImageBoxValue) { setSubImageBoxValue(subImageBoxValue); }
1839
1841 void updateValue(const SubImageBox& subImageBoxValue) { updateSubImageBoxValue(subImageBoxValue); }
1842
1844 const SubImageBox& getValue() const { return getSubImageBoxValue(); }
1845
1846protected:
1848 void setValueFromField(const Field& field) override;
1849
1850private:
1852 SubImageBox _value;
1853};
1854
1855//-------------------------------------------------------------------------
1858//-------------------------------------------------------------------------
1860{
1863
1864public:
1865
1868
1871 explicit SubImageBoxdField(const std::string& name);
1872
1874 void setStringValue(const std::string& stringValue) override;
1875
1878
1883
1887 std::string getStringValue() const override;
1888
1891
1893 void setValue(const SubImageBoxd& subImageBoxValue) { setSubImageBoxdValue(subImageBoxValue); }
1894
1896 void updateValue(const SubImageBoxd& subImageBoxValue) { updateSubImageBoxdValue(subImageBoxValue); }
1897
1899 const SubImageBoxd& getValue() const { return getSubImageBoxdValue(); }
1900
1901protected:
1903 void setValueFromField(const Field& field) override;
1904
1905private:
1907 SubImageBoxd _value;
1908};
1909
1910//-------------------------------------------------------------------------
1913//-------------------------------------------------------------------------
1915{
1918
1919public:
1923 explicit UniversalTypeField(const std::string& name="", MLDataType dt=-1);
1924
1927
1930
1932 void setStringValue(const std::string& stringValue) override;
1933
1936 std::string getStringValue() const override;
1937
1940 virtual void setDataType(MLDataType dataType);
1941
1943 virtual MLDataType getDataType() const;
1944
1946 virtual void setUniversalTypeValue(const MLTypeData* dataType);
1947
1954
1958
1961
1963 void setValue(const MLTypeData* typeData) { setUniversalTypeValue(typeData); };
1964
1966 const MLTypeData* getValue() const { return getShortLivedUniversalTypeValue(); };
1967
1968protected:
1972
1976
1979
1980private:
1984 std::string _origString;
1985
1988 std::string _strValue;
1989
1991 MLDataType _dataType{};
1992
1994 MLint _isValid{};
1995
1999 MLTypeData* _typeData{};
2000};
2001
2002//----------------------------------------------------------------------------------
2006//----------------------------------------------------------------------------------
2008
2011
2012public:
2015 explicit RotationField(const std::string &name=""): Vector4Field(name) {}
2016
2018 void setRotationValue(const Vector3& vec, double angle);
2019
2022
2024 void getRotationValue(Vector3& vec, double& angle) const;
2025
2028};
2029
2030
2031//----------------------------------------------------------------------------------
2035//----------------------------------------------------------------------------------
2037
2040
2041public:
2044 explicit PlaneField(const std::string &name=""): Vector4Field(name) {}
2045
2047 void setPlaneValue(double f0, double f1, double f2, double f3);
2048
2050 void setPlaneValue(const Plane& p);
2051
2053 void getPlaneValue(double &f0, double &f1, double &f2, double &f3) const;
2054
2056 void getPlaneValue(Plane &plane) const;
2057
2060};
2061
2062
2064
2065
2066#endif // ML_FIELDS_H
2067
2068
2069
@ T
Field to encapsulate a pointer to an ML base object.
Definition mlFields.h:729
Base * getValue() const
Same as getBaseValue().
Definition mlFields.h:801
void setBaseValue(const RefCountedBasePtr &value)
Sets the value from intrusive pointer.
void setValue(Base *basePointerValue)
Same as setBaseValue(Base*).
Definition mlFields.h:795
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:798
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.
void setStringValue(const std::string &stringValue) override
Sets pointer value from string stringValue. If string cannot be parsed successfully,...
BaseField()=default
Implements the runtime type system interface for this class.
std::vector< const RuntimeType * > getAllowedTypes() const
Returns a list of allowed Base types for this field.
Definition mlFields.h:788
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:785
bool hasUnallowedType() const
Returns true if the last call of setBaseValue had a not allowed type as argument, getBaseValue will r...
Definition mlFields.h:792
void addAllowedType(const RuntimeType *allowedType)
Adds type to the list of allowed types.
void addAllowedType()
Same as above, with template parameter where the Base type can be specified directly.
Definition mlFields.h:774
~BaseField() override
Destructor.
Type getTypedBaseValue() const
Returns the typed value if the contained base object is derived from the given Type.
Definition mlFields.h:809
Type getTypedValue() const
Returns the typed value if the contained base object is derived from the given Type.
Definition mlFields.h:805
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
virtual void touchSourceFields()
Touches the source fields.
void setBaseValueAndAddAllowedType(T *value)
Convenience routine for setting the base value and its type at the same time.
Definition mlFields.h:780
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:56
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:98
bool isOn() const
Returns the value of the field as a boolean.
void setValueFromField(const Field &field) override
Reimplementation from Field that 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:92
void updateValue(bool boolValue)
Same as updateBoolValue().
Definition mlFields.h:95
void updateBoolValue(bool boolValue)
Sets the field value to boolValue, but only touches the field if the new value is different from the ...
BoolField()=default
Implements the runtime type system interface for this class.
Field to encapsulate a vector of three float values representing an (RGB) color with all properties o...
Definition mlFields.h:1332
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; creates a field with a name to manage a vector of three float values interpreted as RGB-...
const Vector3 & getColorValue() const
Returns the value of the field as a Vector3.
Definition mlFields.h:1358
void updateColorValue(float r, float g, float b)
Sets the field value to r, g, and b, but only touches the field if the new value is different from th...
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:494
void setValueFromField(const Field &field) override
Reimplementation from Field, which copies the field value more efficiently.
void updateDoubleValue(double doubleValue)
Sets the field value to doubleValue, but only touches the field if the new value is different from th...
double getDoubleValue() const
Returns the current field value.
DoubleField()=default
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)
Sets the field value to doubleValue. By default, the entire double type range can be set.
void setValue(double doubleValue)
Same as setDoubleValue().
Definition mlFields.h:528
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
void updateValue(double doubleValue)
Same as updateDoubleValue().
Definition mlFields.h:531
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:534
Field to encapsulate an enumerated value.
Definition mlFields.h:173
void setEnumValue(int enumValue)
Sets field value to enumValue.
void _setEnumerationNames(const std::vector< EnumField::EnumEntry > &enumValues, int initialValue)
Sets the enumeration item names.
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:282
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 touches the field if the new value is different from the old ...
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.
const EnumEntry & getEnumEntryAtIndex(size_t index) const
Returns the enum entry at given index, which allows to enumerate all existing enum entries.
~EnumField() override=default
Destroys this field and releases internally allocated memory.
size_t getNumEnumerationItems() const
Returns the number of registered enum values defined in constructor.
void setStringValueDefaulted(const std::string &value)
If value equals one of the enum item names, set the field to this item; otherwise,...
void setValue(int enumValue)
Same as setEnumValue().
Definition mlFields.h:253
int getEnumValue() const
Returns the current enum value as integer.
void _setEnumerationNames(const std::string enumNames[])
Sets the enumeration item names.
void updateValue(int enumValue)
Same as updateEnumValue().
Definition mlFields.h:256
void _initialize(const std::string &name="", size_t numEnums=0)
Initializes this field.
void _setEnumerationNames(const char *const *enumNames)
Sets the enumeration item names.
EnumField()=default
Protected constructor to allow derived classes.
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:259
Helper class that stores a list of typed enum values and their string names.
Definition mlFields.h:293
const std::vector< EnumField::EnumEntry > & getEntries() const
Returns access to the collected list of enum entries.
Definition mlFields.h:329
void add(const Entry &value)
Adds an enum value via the given entry, typically created with the ML_ENUM_VALUE() macro.
Definition mlFields.h:318
void add(const std::string &stringValue, EnumType value)
Adds an enum value, manually passing in the name and value.
Definition mlFields.h:313
std::vector< EnumField::EnumEntry > _entries
Definition mlFields.h:332
EnumValues & operator<<(const Entry &value)
Adds an enum value via the given entry, typically created with the ML_ENUM_VALUE() macro.
Definition mlFields.h:323
void add(const char *stringValue, EnumType value)
Adds an enum value, manually passing in the name and value.
Definition mlFields.h:308
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
Sets the field value as string value.
Field to encapsulate a float value.
Definition mlFields.h:389
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; creates 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:429
void updateValue(float floatValue)
Same as updateFloatValue().
Definition mlFields.h:426
void updateFloatValue(float floatValue)
Sets the field value to floatValue, but only touches the field if the new value is different from the...
void setValue(float floatValue)
Same as setFloatValue().
Definition mlFields.h:423
FloatField()=default
Implements the runtime type system interface for this class.
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
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 six integer components.
Definition mlFields.h:1752
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 touches the field if the new value is diffe...
ImageVectorField()=default
Implements the runtime type system interface for this class.
void setValueFromField(const Field &field) override
Reimplementation from Field that 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 six integer values.
void setValue(const ImageVector &imageVectorValue)
Same as setImageVectorValue().
Definition mlFields.h:1782
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:1788
void updateValue(const ImageVector &imageVectorValue)
Same as updateImageVectorValue().
Definition mlFields.h:1785
Field to encapsulate a pointer to an input connector that represents a module input.
Definition mlFields.h:685
std::string getStringValue() const override
Returns a reference to InputConnector as a C-string.
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:117
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:155
void updateValue(MLint intValue)
Same as updateIntValue().
Definition mlFields.h:152
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:149
void updateIntValue(MLint intValue)
Sets field value to intValue, but only touches the field if the new value is different from the old v...
IntField()=default
Implements the runtime type system interface for this class.
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
Field to encapsulate an MLDataType value.
Definition mlFields.h:1707
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:1738
MLDataTypeField()=default
Implements the runtime type system interface for this class.
std::string getStringValue() const override
Returns the value of the field as a string value.
void setMLDataTypeValue(MLDataType dataType)
Sets the field value to data type dataType.
void setValue(MLDataType dataType)
Same as setMLDataTypeValue().
Definition mlFields.h:1735
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:1378
void updateMatrix2Value(const Matrix2 &matrixValue)
Sets the value of the field to matrixValue, but only touches the field if the new value is different ...
void setMatrixValue(const Matrix2 &matrixValue)
Sets the value of the field to matrixValue.
const Matrix2 & getValue() const
Same as getMatrix2Value().
Definition mlFields.h:1423
void setValueFromField(const Field &field) override
Reimplementation from Field that 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:1417
const Matrix2 & getMatrixValue() const
Returns the value of the field.
void updateValue(const Matrix2 &matrixValue)
Same as updateMatrix2Value().
Definition mlFields.h:1420
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:1439
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 that copies the field value more efficiently.
const Matrix3 & getValue() const
Same as getMatrix3Value().
Definition mlFields.h:1484
void setValue(const Matrix3 &matrixValue)
Same as setMatrix3Value().
Definition mlFields.h:1478
void setMatrixValue(const Matrix3 &matrixValue)
Sets the value of the field to matrixValue.
void updateValue(const Matrix3 &matrixValue)
Same as updateMatrix3Value().
Definition mlFields.h:1481
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 touches the field if the new value is different ...
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:1567
Matrix4Field(const std::string &name="")
Implements the runtime type system interface for this class.
Field encapsulating a 5x5 matrix.
Definition mlFields.h:1582
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 that 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:1621
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:1624
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:1627
void updateMatrix5Value(const Matrix5 &matrixValue)
Sets the value of the field to matrixValue, but only touches the field if the new value is different ...
Field encapsulating a 6x6 matrix.
Definition mlFields.h:1644
void updateValue(const Matrix6 &matrixValue)
Same as updateMatrix6Value().
Definition mlFields.h:1686
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:1689
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:1683
void setValueFromField(const Field &field) override
Reimplementation from Field that 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 touches the field if the new value is different ...
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:1501
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.
void setValue(const Matrix4 &matrixValue)
Same as setMatrix4Value().
Definition mlFields.h:1544
void setValueFromField(const Field &field) override
Reimplementation from Field that 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 touches the field if the new value is different ...
MatrixField()=default
Implements the runtime type system interface for this class.
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:1550
void updateValue(const Matrix4 &matrixValue)
Same as updateMatrix4Value().
Definition mlFields.h:1547
Base class for an image processing module of the ML.
Definition mlModule.h:151
Field without value for notifications.
Definition mlFields.h:598
std::string getStringValue() const override
Returns an empty string, as 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:634
std::string getStringValue() const override
Reference to OutputConnector as C-string to return.
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 four double values representing a plane with all properties of Vecto...
Definition mlFields.h:2036
void setPlaneValue(double f0, double f1, double f2, double f3)
Sets field value to f0, f1, f2, and f3.
void getPlaneValue(double &f0, double &f1, double &f2, double &f3) const
Returns the value of the field.
void setPlaneValue(const Plane &p)
Sets field value to p.
PlaneField(const std::string &name="")
Implements the runtime type system interface for this class.
Definition mlFields.h:2044
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:917
void setStringValue(const std::string &stringValue) override
Sets the 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:945
PointerField()=default
Implements the runtime type system interface for this class.
void * getValue() const
Same as getPointerValue().
Definition mlFields.h:948
void setPointerValue(void *voidPointerValue)
Sets the 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:451
void setProgressValue(float floatValue)
Same as setFloatValue().
void setValue(float floatValue)
Same as setFloatValue().
Definition mlFields.h:481
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 such that a new value must be greater than the previous value to be accepted as...
float getProgressValue()
Same as getFloatValue().
Definition mlFields.h:474
Field to encapsulate a vector of four double values representing a rotation with all properties of Ve...
Definition mlFields.h:2007
RotationField(const std::string &name="")
Implements the runtime type system interface for this class.
Definition mlFields.h:2015
Rotation getRotationValue() const
Returns the rotation value as a rotation class instance.
void setRotationValue(const Rotation &rot)
Sets the rotation value by a rotation instance.
void setRotationValue(const Vector3 &vec, double angle)
Sets the rotation as rotation axis and angle how much to rotate.
void getRotationValue(Vector3 &vec, double &angle) const
Returns the rotation as vector (axis) and rotation angle.
Class to handle Rotations (internally, the rotation is stored as a unit quaternion)
Definition mlRotation.h:38
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:865
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 the value of the field to soNodeValue.
void setValue(SoNode *soNodeValue)
Same as setSoNodeValue().
Definition mlFields.h:893
std::string getStringValue() const override
Returns the value of the field as string value.
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
SoNodeField()=default
Implements the runtime type system interface for this class.
SoNode * getValue() const
Same as getSoNodeValue().
Definition mlFields.h:896
void setStringValue(const std::string &stringValue) override
Sets the field value from string to stringValue. On non-successful string parsing,...
Field to encapsulate a string value.
Definition mlFields.h:553
std::string getStringValue() const override
Returns the value of the field as a string value setStringValue must be able to reinterpret this retu...
std::string getValue() const
Same as getStringValue().
Definition mlFields.h:584
void updateStringValue(const std::string &stringValue)
Sets value of the field to stringValue, but only touches the field if the new value is different from...
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.
StringField()=default
Implements the runtime type system interface for this class.
void updateValue(const std::string &stringValue)
Same as updateStringValue().
Definition mlFields.h:581
void setValue(const std::string &stringValue)
Same as setStringValue().
Definition mlFields.h:578
Field to encapsulate an ML integer SubimgBox.
Definition mlFields.h:1806
void setValue(const SubImageBox &subImageBoxValue)
Same as setSubImageBoxValue().
Definition mlFields.h:1838
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 that copies the field value more efficiently.
std::string getStringValue() const override
Returns the value of the field as a string value.
void updateSubImageBoxValue(const SubImageBox &subImageBoxValue)
Sets the value of the field to subImageBoxValue, but only touches the field if the new value is diffe...
const SubImageBox & getSubImageBoxValue() const
Returns the value of the field.
const SubImageBox & getValue() const
Same as getSubImageBoxValue().
Definition mlFields.h:1844
void setSubImageBoxValue(const SubImageBox &subImageBoxValue)
Sets the value of the field to subImageBoxValue.
SubImageBoxField()=default
Implements the runtime type system interface for this class.
void updateValue(const SubImageBox &subImageBoxValue)
Same as updateSubImageBoxValue().
Definition mlFields.h:1841
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:1860
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 touches the field if the new value is diff...
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
const SubImageBoxd & getValue() const
Same as getSubImageBoxdValue().
Definition mlFields.h:1899
void setValue(const SubImageBoxd &subImageBoxValue)
Same as setSubImageBoxdValue().
Definition mlFields.h:1893
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()=default
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:1896
void setSubImageBoxdValue(const SubImageBoxd &subImageBoxfValue)
Sets the value of the field to subImageBoxfValue.
SubImageBoxd - SubImageBox with coordinates of float data type.
static Tmat4< MLdouble > getIdentity()
Returns the identity matrix.
Definition mlMatrix4.h:584
Templated version of BaseField that only stores the template type as pointer.
Definition mlFields.h:835
void setValue(T *basePointerValue)
Sets the value of the field to basePointerValue.
Definition mlFields.h:841
void setValue(const ::boost::intrusive_ptr< T > &value)
Sets the value from intrusive pointer.
Definition mlFields.h:844
T * getValue() const
Returns the current field value.
Definition mlFields.h:847
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:838
TypedEnumField is used to encapsulate a C++ enum value and work with a real enum value instead of int...
Definition mlFields.h:358
TypedEnumField(const std::string &name, const EnumValues< EnumType > &enumValues, EnumType initialValue)
Creates the TypedEnumField with given name, enumValues, and initialValue.
Definition mlFields.h:363
EnumType getEnumValue() const
Returns the current enum value.
Definition mlFields.h:371
void setEnumValue(EnumType enumValue)
Sets the current enum value and touches the field.
Definition mlFields.h:373
EnumType getValue() const
Same as getEnumValue().
Definition mlFields.h:377
void updateValue(EnumType enumValue)
Same as updateEnumValue().
Definition mlFields.h:381
void updateEnumValue(EnumType enumValue)
Sets the current enum value and only touches the field if the value has changed.
Definition mlFields.h:375
void setValue(EnumType enumValue)
Same as setEnumValue().
Definition mlFields.h:379
Field to encapsulate any of the registered ML types.
Definition mlFields.h:1915
virtual void _updateIsValidAndTypeDataFromOrigString()
Parses _origString depending on the current data type and updates _isValid and _typeData.
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
virtual void _updateIsValidAndStrValueFromTypeData()
Parses _typeData depending on the current data type and updates _isValid and _strValue.
virtual void setDataType(MLDataType dataType)
Sets the data type to dataType.
const MLTypeData * getValue() const
Same as getShortLivedUniversalTypeValue().
Definition mlFields.h:1966
void setValue(const MLTypeData *typeData)
Same as setUniversalTypeValue().
Definition mlFields.h:1963
void _updateFieldFromOrigString()
Combines the above methods, returns _origString on invalid data type, and touches the field.
MLint isValidValue() override
Returns true (=1) if field value is valid, otherwise false (=0).
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 must NOT be modifi...
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 ten double values.
Definition mlFields.h:1267
Vector10Field()=default
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:1308
void setVectorValue(const Vector10 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1293
const Vector10 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1305
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:1311
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
const Vector10 & getValue() const
Same as getVector10Value().
Definition mlFields.h:1314
void updateVector10Value(const Vector10 &vectorValue)
Sets the value of the field to vectorValue, but only touches the field if the new value is different ...
Vector10Field(const std::string &name)
Constructor; creates a field with a name to manage a vector of ten 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 two double values.
Definition mlFields.h:960
std::string getStringValue() const override
Returns the value of the field as a string value.
Vector2Field()=default
Implements the runtime type system interface for this class.
void setVectorValue(const Vector2 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:985
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
void updateValue(const Vector2 &vectorValue)
Same as updateVector2Value().
Definition mlFields.h:1000
void setValue(const Vector2 &vectorValue)
Same as setVector2Value().
Definition mlFields.h:997
const Vector2 & getValue() const
Same as getVector2Value().
Definition mlFields.h:1003
const Vector2 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:994
void updateVector2Value(const Vector2 &vectorValue)
Sets the value of the field to vectorValue, but only touches the field if the new value is different ...
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 two double values.
void setVector2Value(const Vector2 &vectorValue)
Sets the value of the field to vectorValue.
void setStringValue(const std::string &stringValue) override
Sets the value of the field to stringValue.
Field to encapsulate a vector of three double values.
Definition mlFields.h:1019
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
Vector3Field()=default
Implements the runtime type system interface for this class.
const Vector3 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1055
void updateValue(const Vector3 &vectorValue)
Same as updateVector3Value().
Definition mlFields.h:1061
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 three double values.
void updateVector3Value(const Vector3 &vectorValue)
Sets the value of the field to vectorValue, but only touches the field if the new value is different ...
const Vector3 & getValue() const
Same as getVector3Value().
Definition mlFields.h:1064
void setVectorValue(const Vector3 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1044
void setValue(const Vector3 &vectorValue)
Same as setVector3Value().
Definition mlFields.h:1058
std::string getStringValue() const override
Returns the value of the field as string value.
Field to encapsulate a vector of four double values.
Definition mlFields.h:1081
Vector4Field()=default
Implements the runtime type system interface for this class.
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 touches the field if the new value is different ...
const Vector4 & getValue() const
Same as getVector4Value().
Definition mlFields.h:1126
void setValue(const Vector4 &vectorValue)
Same as setVector4Value().
Definition mlFields.h:1120
const Vector4 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1117
Vector4Field(const std::string &name)
Constructor; creates a field with a name to manage a vector of four 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:1106
void setVector4Value(const Vector4 &vectorValue)
Sets the value of the field to vectorValue.
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
void updateValue(const Vector4 &vectorValue)
Same as updateVector4Value().
Definition mlFields.h:1123
const Vector4 & getVector4Value() const
Returns the value of the field.
Field to encapsulate a vector of five double values.
Definition mlFields.h:1142
void updateValue(const Vector5 &vectorValue)
Same as updateVector5Value().
Definition mlFields.h:1185
Vector5Field()=default
Implements the runtime type system interface for this class.
std::string getStringValue() const override
Returns the value of the field as a string value.
const Vector5 & getValue() const
Same as getVector5Value().
Definition mlFields.h:1188
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:1179
Vector5Field(const std::string &name)
Constructor; creates a field with a name to manage a vector of five double values initialized to (0,...
void setVectorValue(const Vector5 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1168
void updateVector5Value(const Vector5 &vectorValue)
Sets the value of the field to vectorValue, but only touches the field if the new value is different ...
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
void setValue(const Vector5 &vectorValue)
Same as setVector5Value().
Definition mlFields.h:1182
Field to encapsulate a vector of six double values.
Definition mlFields.h:1205
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:1242
void setVectorValue(const Vector6 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1231
void updateValue(const Vector6 &vectorValue)
Same as updateVector6Value().
Definition mlFields.h:1248
void updateVector6Value(const Vector6 &vectorValue)
Sets the value of the field to vectorValue, but only touches the field if the new value is different ...
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:1245
std::string getStringValue() const override
Returns the value of the field as a string value.
Vector6Field()=default
Implements the runtime type system interface for this class.
Vector6Field(const std::string &name)
Constructor; creates a field with a name to manage a vector of six double values.
void setValueFromField(const Field &field) override
Reimplementation from Field that copies the field value more efficiently.
const Vector6 & getValue() const
Same as getVector6Value().
Definition mlFields.h:1251
#define ML_ABSTRACT_CLASS_HEADER(className)
Similar to ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non-existing export symbol.
MLint32 MLDataType
MLDataType.
Definition mlTypeDefs.h:596
@ MLuint8Type
Enumerator for the unsigned 8-bit ML integer type.
Definition mlTypeDefs.h:621
#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
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:347
MLEXPORT void MLInitFields()
Initialize all standard fields of the ML.
Defines the entry for one enum value.
Definition mlFields.h:233
EnumEntry(const std::string &sv, int v)
Definition mlFields.h:235
std::string stringValue
The string value of the entry.
Definition mlFields.h:238
int value
The enum value of the entry.
Definition mlFields.h:240
Defines the entry for one enum value.
Definition mlFields.h:296
EnumType value
The enum value of the entry.
Definition mlFields.h:303
const char * stringValue
The string value of the entry.
Definition mlFields.h:301
Entry(const char *sv, EnumType v)
Definition mlFields.h:298