MeVisLab Toolbox Reference
Loading...
Searching...
No Matches
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:
62 BoolField() = default;
63
66 explicit BoolField(const std::string& name);
67
69 void setStringValue(const std::string& value) override;
70
73
77
80
82 std::string getStringValue() const override;
83
85 bool getBoolValue() const;
86
88 bool isOn() const;
89
92 {
93 setBoolValue(boolValue);
94 }
95
98 {
99 updateBoolValue(boolValue);
100 }
101
103 bool getValue() const
104 {
105 return getBoolValue();
106 }
107
108protected:
110 void setValueFromField(const Field& field) override;
111
112private:
114 bool _value{};
115};
116
117
118//-------------------------------------------------------------------------
121//-------------------------------------------------------------------------
122class MLEXPORT IntField : public Field
123{
126
127public:
129 IntField() = default;
130
133 explicit IntField(const std::string& name);
134
136 void setStringValue(const std::string& value) override;
137
140
144
148 std::string getStringValue() const override;
149
152
155 {
156 setIntValue(intValue);
157 }
158
161 {
162 updateIntValue(intValue);
163 }
164
167 {
168 return getIntValue();
169 }
170
171protected:
173 void setValueFromField(const Field& field) override;
174
175private:
177 MLint _value{};
178};
179
180//-------------------------------------------------------------------------
183//-------------------------------------------------------------------------
185{
188
189public:
197 EnumField(const std::string& name, const std::string enumerationItemNames[], size_t numEnumerationItems);
198
206 EnumField(const std::string& name, const char* const* enumerationItemNames, size_t numEnumerationItems);
207
215 EnumField(const std::string& name, const std::vector<std::string>& enumerationItemNames);
216
218 ~EnumField() override = default;
219
223 void setStringValue(const std::string& value) override;
224
227 void setStringValueDefaulted(const std::string& value);
228
231
235
239 std::string getStringValue() const override;
240
242 int getEnumValue() const;
243
246 {
248 : value(-1)
249 {}
250 EnumEntry(const std::string& sv, int v)
251 : stringValue(sv)
252 , value(v)
253 {}
254
256 std::string stringValue;
258 int value;
259 };
260
265 const EnumEntry& getEnumEntryAtIndex(size_t index) const;
266
269
272 {
273 setEnumValue(enumValue);
274 }
275
278 {
279 updateEnumValue(enumValue);
280 }
281
283 int getValue() const
284 {
285 return getEnumValue();
286 }
287
288protected:
290 void _initialize(const std::string& name = "", size_t numEnums = 0);
291
293 void _setEnumerationNames(const std::string enumNames[]);
295 void _setEnumerationNames(const char* const* enumNames);
297 void _setEnumerationNames(const std::vector<std::string>& enumNames);
299 void _setEnumerationNames(const std::vector<EnumField::EnumEntry>& enumValues, int initialValue);
300
302 int _value{};
303
305 bool _linearEntries{};
306
308 std::vector<EnumEntry> _entries;
309
310protected:
312 EnumField() = default;
313};
314
317template <typename EnumType> class EnumValues
318{
319public:
321 struct Entry
322 {
324 : stringValue(nullptr)
325 , value(-1)
326 {}
327 Entry(const char* sv, EnumType v)
328 : stringValue(sv)
329 , value(v)
330 {}
331
333 const char* stringValue;
336 };
337
338public:
340 void add(const char* stringValue, EnumType value)
341 {
342 _entries.emplace_back(stringValue, static_cast<int>(value));
343 }
344
346 void add(const std::string& stringValue, EnumType value)
347 {
348 _entries.emplace_back(stringValue, static_cast<int>(value));
349 }
350
352 void add(const Entry& value)
353 {
354 _entries.push_back(EnumField::EnumEntry(value.stringValue, static_cast<int>(value.value)));
355 }
356
359 {
360 add(value);
361 return *this;
362 }
363
365 const std::vector<EnumField::EnumEntry>& getEntries() const
366 {
367 return _entries;
368 }
369
370protected:
371 std::vector<EnumField::EnumEntry> _entries;
372};
373
377#define ML_ENUM_VALUE(enumValue) internal::createEnumEntry(#enumValue, enumValue)
378
381#define ML_EXTERNAL_ENUM_VALUE(enumClass, enumValue) internal::createEnumEntry(#enumValue, enumClass::enumValue)
382
383namespace internal
384{
386 template <typename EnumType>
388 {
389 return typename EnumValues<EnumType>::Entry(value, enumValue);
390 }
391} // namespace internal
392
393//-------------------------------------------------------------------------
396//-------------------------------------------------------------------------
397template <typename EnumType> class TypedEnumField : public EnumField
398{
399public:
400 static_assert(sizeof(std::underlying_type<EnumType>) <= sizeof(int),
401 "The underlying type cannot be bigger than int!");
402
405 : EnumField()
406 {
407 const std::vector<EnumField::EnumEntry>& entries = enumValues.getEntries();
408 _initialize(name, entries.size());
409 _setEnumerationNames(entries, static_cast<int>(initialValue));
410 }
411
414 {
415 return static_cast<EnumType>(EnumField::getEnumValue());
416 }
419 {
420 EnumField::setEnumValue(static_cast<int>(enumValue));
421 }
424 {
425 EnumField::updateEnumValue(static_cast<int>(enumValue));
426 }
429 {
430 return getEnumValue();
431 }
434 {
435 setEnumValue(enumValue);
436 }
439 {
440 updateEnumValue(enumValue);
441 }
442};
443
444//-------------------------------------------------------------------------
447//-------------------------------------------------------------------------
449{
452
453public:
455 FloatField() = default;
456
459 explicit FloatField(const std::string& name);
460
462 void setStringValue(const std::string& stringValue) override;
463
467
473
476 std::string getStringValue() const override;
477
479 float getFloatValue() const;
480
483 {
484 setFloatValue(floatValue);
485 }
486
489 {
490 updateFloatValue(floatValue);
491 }
492
494 float getValue() const
495 {
496 return getFloatValue();
497 }
498
500 static void setValueCallback(void* field, double value);
501
502protected:
504 void setValueFromField(const Field& field) override;
505
507 float _value{};
508};
509
510
511//-------------------------------------------------------------------------
517//-------------------------------------------------------------------------
519{
522
523public:
526
531 explicit ProgressField(const std::string& name);
532
536
539
541 inline float getProgressValue()
542 {
543 return getFloatValue();
544 }
545
549
552 {
553 setFloatValue(floatValue);
554 }
555
556private:
558 float _difference{0.02f};
559};
560
561
562//-------------------------------------------------------------------------
565//-------------------------------------------------------------------------
567{
570
571
572public:
574 DoubleField() = default;
575
578 explicit DoubleField(const std::string& name);
579
581 void setStringValue(const std::string& stringValue) override;
582
585
591
594 std::string getStringValue() const override;
595
597 double getDoubleValue() const;
598
601 {
602 setDoubleValue(doubleValue);
603 }
604
607 {
608 updateDoubleValue(doubleValue);
609 }
610
612 double getValue() const
613 {
614 return getDoubleValue();
615 }
616
618 static void setValueCallback(void* field, double value);
619
620protected:
622 void setValueFromField(const Field& field) override;
623
624private:
626 double _value{};
627};
628
629//-------------------------------------------------------------------------
632//-------------------------------------------------------------------------
634{
637
638public:
640 StringField() = default;
641
644 explicit StringField(const std::string& name);
645
647 void setStringValue(const std::string& stringValue) override;
648
651 void updateStringValue(const std::string& stringValue);
652
655 std::string getStringValue() const override;
656
658 void setValue(const std::string& stringValue)
659 {
660 setStringValue(stringValue);
661 }
662
664 void updateValue(const std::string& stringValue)
665 {
666 updateStringValue(stringValue);
667 }
668
670 std::string getValue() const
671 {
672 return getStringValue();
673 }
674
675private:
678 std::string _value;
679};
680
681
682//-------------------------------------------------------------------------
685//-------------------------------------------------------------------------
687{
690
691public:
694
698 explicit NotifyField(const std::string& name);
699
702 void setStringValue(const std::string& /*value*/) override;
703
705 std::string getStringValue() const override;
706
708 void notify();
709};
710
714
715//-------------------------------------------------------------------------
719//-------------------------------------------------------------------------
721{
724
725public:
728
731 OutputConnectorField(const std::string& name, Module* module, MLint outputImageIndex);
732
735
739 void setStringValue(const std::string& /*value*/) override;
740
744 void touch(FieldSensor::Strength strength = FieldSensor::CHANGED) override;
745
750 std::string getStringValue() const override;
751
754
756 MLint isValidValue() override;
757
758private:
760 OutputConnector* _value{};
761};
762
763
764//-------------------------------------------------------------------------
768//-------------------------------------------------------------------------
770{
773
774public:
777
782 InputConnectorField(const std::string& name, Module* module, MLint inputImageIndex);
783
786
790 void setStringValue(const std::string& /*value*/) override;
791
794 std::string getStringValue() const override;
795
798
800 MLint isValidValue() override;
801
802private:
804 InputConnector* _value{};
805};
806
807
808//-------------------------------------------------------------------------
811//-------------------------------------------------------------------------
813{
816
817public:
819 BaseField() = default;
820
823 explicit BaseField(const std::string& name);
824
826 ~BaseField() override;
827
829 void setStringValue(const std::string& stringValue) override;
830
833
835 void setBaseValue(const RefCountedBasePtr& value);
836
840 std::string getStringValue() const override;
841
844
846 virtual void touchSourceFields();
847
854
856 template <typename T> void addAllowedType()
857 {
858 addAllowedType(T::getClassTypeId());
859 }
860
864 template <typename T> void setBaseValueAndAddAllowedType(T* value)
865 {
866 addAllowedType(value->getClassTypeId());
867 setBaseValue(value);
868 }
869
872 template <typename T> void setBaseValueAndAddAllowedType(const ::boost::intrusive_ptr<T>& value)
873 {
874 setBaseValueAndAddAllowedType(value.get());
875 }
876
878 std::vector<const RuntimeType*> getAllowedTypes() const
879 {
880 return _allowedTypes;
881 }
882
885 bool hasUnallowedType() const
886 {
887 return _unallowedType;
888 }
889
892 {
893 setBaseValue(basePointerValue);
894 }
895
897 void setValue(const RefCountedBasePtr& value)
898 {
899 setBaseValue(value);
900 }
901
903 Base* getValue() const
904 {
905 return getBaseValue();
906 }
907
909 template <class Type> Type getTypedValue() const
910 {
911 return mlbase_cast<Type>(getValue());
912 }
913
915 template <class Type> Type getTypedBaseValue() const
916 {
917 return mlbase_cast<Type>(getValue());
918 }
919
920protected:
922 void setValueFromField(const Field& field) override;
923
924private:
926 Base* _value{};
927
929 std::vector<const RuntimeType*> _allowedTypes;
930
932 bool _unallowedType{};
934 bool _isRefCountedBase{};
935};
936
937//-------------------------------------------------------------------------
940//-------------------------------------------------------------------------
941
942template <class T> class TypedBaseField : public BaseField
943{
944public:
946 explicit TypedBaseField(const std::string& name)
947 : BaseField(name)
948 {
949 BaseField::addAllowedType<T>();
950 }
951
954 {
955 setBaseValue(basePointerValue);
956 }
957
959 void setValue(const ::boost::intrusive_ptr<T>& value)
960 {
961 setValue(value.get());
962 }
963
965 T* getValue() const
966 {
967 return getTypedValue<T*>();
968 }
969
970private:
972 using BaseField::addAllowedType;
974 using BaseField::setBaseValueAndAddAllowedType;
975};
976
977
978//-------------------------------------------------------------------------
984//-------------------------------------------------------------------------
986{
989
990public:
992 SoNodeField() = default;
993
996 explicit SoNodeField(const std::string& name);
997
999 void setStringValue(const std::string& stringValue) override;
1000
1003
1007 std::string getStringValue() const override;
1008
1010 SoNode* getSoNodeValue() const;
1011
1013 void setValue(SoNode* soNodeValue)
1014 {
1015 setSoNodeValue(soNodeValue);
1016 }
1017
1019 SoNode* getValue() const
1020 {
1021 return getSoNodeValue();
1022 }
1023
1024protected:
1026 void setValueFromField(const Field& field) override;
1027
1028private:
1030 SoNode* _value{};
1031};
1032
1033
1034//-------------------------------------------------------------------------
1041//-------------------------------------------------------------------------
1043{
1046
1047public:
1049 PointerField() = default;
1050
1053 explicit PointerField(const std::string& name);
1054
1057 void setStringValue(const std::string& stringValue) override;
1058
1061
1064 std::string getStringValue() const override;
1065
1067 void* getPointerValue() const;
1068
1071 {
1072 setPointerValue(voidPointerValue);
1073 }
1074
1076 void* getValue() const
1077 {
1078 return getPointerValue();
1079 }
1080
1081private:
1083 void* _value{};
1084};
1085
1086//-------------------------------------------------------------------------
1089//-------------------------------------------------------------------------
1091{
1094
1095public:
1097 Vector2Field() = default;
1098
1101 explicit Vector2Field(const std::string& name);
1102
1104 void setStringValue(const std::string& stringValue) override;
1105
1108
1113
1116 {
1117 setVector2Value(vectorValue);
1118 }
1119
1121 std::string getStringValue() const override;
1122
1124 const Vector2& getVector2Value() const;
1125
1127 inline const Vector2& getVectorValue() const
1128 {
1129 return getVector2Value();
1130 }
1131
1134 {
1135 setVector2Value(vectorValue);
1136 }
1137
1140 {
1141 updateVector2Value(vectorValue);
1142 }
1143
1145 const Vector2& getValue() const
1146 {
1147 return getVector2Value();
1148 }
1149
1150protected:
1152 void setValueFromField(const Field& field) override;
1153
1154private:
1156 Vector2 _value;
1157};
1158
1159//-------------------------------------------------------------------------
1162//-------------------------------------------------------------------------
1164{
1167
1168public:
1170 Vector3Field() = default;
1171
1174 explicit Vector3Field(const std::string& name);
1175
1177 void setStringValue(const std::string& stringValue) override;
1178
1181
1186
1189 {
1190 setVector3Value(vectorValue);
1191 }
1192
1196 std::string getStringValue() const override;
1197
1199 const Vector3& getVector3Value() const;
1200
1202 inline const Vector3& getVectorValue() const
1203 {
1204 return getVector3Value();
1205 }
1206
1209 {
1210 setVector3Value(vectorValue);
1211 }
1212
1215 {
1216 updateVector3Value(vectorValue);
1217 }
1218
1220 const Vector3& getValue() const
1221 {
1222 return getVector3Value();
1223 }
1224
1225
1226protected:
1228 void setValueFromField(const Field& field) override;
1229
1230private:
1232 Vector3 _value;
1233};
1234
1235//-------------------------------------------------------------------------
1238//-------------------------------------------------------------------------
1240{
1243
1244public:
1246 Vector4Field() = default;
1247
1250 explicit Vector4Field(const std::string& name);
1251
1253 void setStringValue(const std::string& stringValue) override;
1254
1257
1262
1265 {
1266 setVector4Value(vectorValue);
1267 }
1268
1272 std::string getStringValue() const override;
1273
1275 const Vector4& getVector4Value() const;
1276
1278 inline const Vector4& getVectorValue() const
1279 {
1280 return getVector4Value();
1281 }
1282
1285 {
1286 setVector4Value(vectorValue);
1287 }
1288
1291 {
1292 updateVector4Value(vectorValue);
1293 }
1294
1296 const Vector4& getValue() const
1297 {
1298 return getVector4Value();
1299 }
1300
1301protected:
1303 void setValueFromField(const Field& field) override;
1304
1305private:
1307 Vector4 _value;
1308};
1309
1310//-------------------------------------------------------------------------
1313//-------------------------------------------------------------------------
1315{
1318
1319
1320public:
1322 Vector5Field() = default;
1323
1326 explicit Vector5Field(const std::string& name);
1327
1329 void setStringValue(const std::string& stringValue) override;
1330
1333
1338
1341 {
1342 setVector5Value(vectorValue);
1343 }
1344
1348 std::string getStringValue() const override;
1349
1351 const Vector5& getVector5Value() const;
1352
1354 inline const Vector5& getVectorValue() const
1355 {
1356 return getVector5Value();
1357 }
1358
1361 {
1362 setVector5Value(vectorValue);
1363 }
1364
1367 {
1368 updateVector5Value(vectorValue);
1369 }
1370
1372 const Vector5& getValue() const
1373 {
1374 return getVector5Value();
1375 }
1376
1377protected:
1379 void setValueFromField(const Field& field) override;
1380
1381private:
1383 Vector5 _value;
1384};
1385
1386
1387//-------------------------------------------------------------------------
1390//-------------------------------------------------------------------------
1392{
1395
1396
1397public:
1399 Vector6Field() = default;
1400
1403 explicit Vector6Field(const std::string& name);
1404
1406 void setStringValue(const std::string& stringValue) override;
1407
1410
1415
1418 {
1419 setVector6Value(vectorValue);
1420 }
1421
1425 std::string getStringValue() const override;
1426
1428 const Vector6& getVector6Value() const;
1429
1431 inline const Vector6& getVectorValue() const
1432 {
1433 return getVector6Value();
1434 }
1435
1438 {
1439 setVector6Value(vectorValue);
1440 }
1441
1444 {
1445 updateVector6Value(vectorValue);
1446 }
1447
1449 const Vector6& getValue() const
1450 {
1451 return getVector6Value();
1452 }
1453
1454protected:
1456 void setValueFromField(const Field& field) override;
1457
1458private:
1460 Vector6 _value;
1461};
1462
1463//-------------------------------------------------------------------------
1466//-------------------------------------------------------------------------
1468{
1471
1472
1473public:
1475 Vector10Field() = default;
1476
1479 explicit Vector10Field(const std::string& name);
1480
1482 void setStringValue(const std::string& stringValue) override;
1483
1486
1491
1494 {
1495 setVector10Value(vectorValue);
1496 }
1497
1498
1502 std::string getStringValue() const override;
1503
1506
1508 inline const Vector10& getVectorValue() const
1509 {
1510 return getVector10Value();
1511 }
1512
1515 {
1516 setVector10Value(vectorValue);
1517 }
1518
1521 {
1522 updateVector10Value(vectorValue);
1523 }
1524
1526 const Vector10& getValue() const
1527 {
1528 return getVector10Value();
1529 }
1530
1531protected:
1533 void setValueFromField(const Field& field) override;
1534
1535private:
1537 Vector10 _value;
1538};
1539
1540//-------------------------------------------------------------------------
1545//-------------------------------------------------------------------------
1547{
1550
1551public:
1554
1558 explicit ColorField(const std::string& name);
1559
1561 void setColorValue(float r, float g, float b);
1562
1566 void updateColorValue(float r, float g, float b);
1567
1569 void getColorValue(float& r, float& g, float& b) const;
1570
1572 const Vector3& getColorValue() const
1573 {
1574 return getVectorValue();
1575 }
1576
1582
1587};
1588
1589
1590//-------------------------------------------------------------------------
1593//-------------------------------------------------------------------------
1595{
1598
1599public:
1602 explicit Matrix2Field(const std::string& name = "");
1603
1607 void setStringValue(const std::string& stringValue) override;
1608
1610 void setMatrixValue(const Matrix2& matrixValue);
1611
1614 void setMatrix2Value(const Matrix2& matrixValue);
1615
1619 void updateMatrix2Value(const Matrix2& matrixValue);
1620
1624 std::string getStringValue() const override;
1625
1627 const Matrix2& getMatrixValue() const;
1628
1631 const Matrix2& getMatrix2Value() const;
1632
1634 void setValue(const Matrix2& matrixValue)
1635 {
1636 setMatrix2Value(matrixValue);
1637 }
1638
1640 void updateValue(const Matrix2& matrixValue)
1641 {
1642 updateMatrix2Value(matrixValue);
1643 }
1644
1646 const Matrix2& getValue() const
1647 {
1648 return getMatrix2Value();
1649 }
1650
1651protected:
1653 void setValueFromField(const Field& field) override;
1654
1655private:
1657 Matrix2 _value;
1658};
1659
1660//-------------------------------------------------------------------------
1663//-------------------------------------------------------------------------
1665{
1668
1669public:
1672 explicit Matrix3Field(const std::string& name = "");
1673
1677 void setStringValue(const std::string& stringValue) override;
1678
1680 void setMatrixValue(const Matrix3& matrixValue);
1681
1684 void setMatrix3Value(const Matrix3& matrixValue);
1685
1689 void updateMatrix3Value(const Matrix3& matrixValue);
1690
1694 std::string getStringValue() const override;
1695
1697 const Matrix3& getMatrixValue() const;
1698
1701 const Matrix3& getMatrix3Value() const;
1702
1704 void setValue(const Matrix3& matrixValue)
1705 {
1706 setMatrix3Value(matrixValue);
1707 }
1708
1710 void updateValue(const Matrix3& matrixValue)
1711 {
1712 updateMatrix3Value(matrixValue);
1713 }
1714
1716 const Matrix3& getValue() const
1717 {
1718 return getMatrix3Value();
1719 }
1720
1721protected:
1723 void setValueFromField(const Field& field) override;
1724
1725private:
1727 Matrix3 _value;
1728};
1729
1730//-------------------------------------------------------------------------
1734//-------------------------------------------------------------------------
1736{
1739
1740public:
1742 MatrixField() = default;
1743
1746 explicit MatrixField(const std::string& name);
1747
1751 void setStringValue(const std::string& stringValue) override;
1752
1754 void setMatrixValue(const Matrix4& matrixValue);
1755
1758 void setMatrix4Value(const Matrix4& matrixValue);
1759
1763 void updateMatrix4Value(const Matrix4& matrixValue);
1764
1768 std::string getStringValue() const override;
1769
1771 const Matrix4& getMatrixValue() const;
1772
1775 const Matrix4& getMatrix4Value() const;
1776
1778 void setValue(const Matrix4& matrixValue)
1779 {
1780 setMatrix4Value(matrixValue);
1781 }
1782
1784 void updateValue(const Matrix4& matrixValue)
1785 {
1786 updateMatrix4Value(matrixValue);
1787 }
1788
1790 const Matrix4& getValue() const
1791 {
1792 return getMatrix4Value();
1793 }
1794
1795protected:
1797 void setValueFromField(const Field& field) override;
1798
1799private:
1801 Matrix4 _value{Matrix4::getIdentity()};
1802};
1803
1804
1805//-------------------------------------------------------------------------
1808//-------------------------------------------------------------------------
1810{
1813
1814public:
1817 explicit Matrix4Field(const std::string& name = "");
1818};
1819
1820//-------------------------------------------------------------------------
1823//-------------------------------------------------------------------------
1825{
1828
1829public:
1832 explicit Matrix5Field(const std::string& name = "");
1833
1837 void setStringValue(const std::string& stringValue) override;
1838
1840 void setMatrixValue(const Matrix5& matrixValue);
1841
1844 void setMatrix5Value(const Matrix5& matrixValue);
1845
1849 void updateMatrix5Value(const Matrix5& matrixValue);
1850
1854 std::string getStringValue() const override;
1855
1857 const Matrix5& getMatrixValue() const;
1858
1861 const Matrix5& getMatrix5Value() const;
1862
1864 void setValue(const Matrix5& matrixValue)
1865 {
1866 setMatrix5Value(matrixValue);
1867 }
1868
1870 void updateValue(const Matrix5& matrixValue)
1871 {
1872 updateMatrix5Value(matrixValue);
1873 }
1874
1876 const Matrix5& getValue() const
1877 {
1878 return getMatrix5Value();
1879 }
1880
1881protected:
1883 void setValueFromField(const Field& field) override;
1884
1885private:
1887 Matrix5 _value;
1888};
1889
1890
1891//-------------------------------------------------------------------------
1894//-------------------------------------------------------------------------
1896{
1899
1900public:
1903 explicit Matrix6Field(const std::string& name = "");
1904
1908 void setStringValue(const std::string& stringValue) override;
1909
1911 void setMatrixValue(const Matrix6& matrixValue);
1912
1915 void setMatrix6Value(const Matrix6& matrixValue);
1916
1920 void updateMatrix6Value(const Matrix6& matrixValue);
1921
1925 std::string getStringValue() const override;
1926
1928 const Matrix6& getMatrixValue() const;
1929
1932 const Matrix6& getMatrix6Value() const;
1933
1935 void setValue(const Matrix6& matrixValue)
1936 {
1937 setMatrix6Value(matrixValue);
1938 }
1939
1941 void updateValue(const Matrix6& matrixValue)
1942 {
1943 updateMatrix6Value(matrixValue);
1944 }
1945
1947 const Matrix6& getValue() const
1948 {
1949 return getMatrix6Value();
1950 }
1951
1952protected:
1954 void setValueFromField(const Field& field) override;
1955
1956private:
1958 Matrix6 _value;
1959};
1960
1961
1962//-------------------------------------------------------------------------
1965//-------------------------------------------------------------------------
1967{
1970
1971public:
1973 MLDataTypeField() = default;
1974
1977 explicit MLDataTypeField(const std::string& name);
1978
1980 void setStringValue(const std::string& stringValue) override;
1981
1984
1988 std::string getStringValue() const override;
1989
1992
1994 void setValue(MLDataType dataType)
1995 {
1996 setMLDataTypeValue(dataType);
1997 }
1998
2001 {
2002 return getMLDataTypeValue();
2003 }
2004
2005private:
2007 MLDataType _value{MLuint8Type};
2008};
2009
2010
2011//-------------------------------------------------------------------------
2015//-------------------------------------------------------------------------
2017{
2020
2021public:
2023 ImageVectorField() = default;
2024
2027 explicit ImageVectorField(const std::string& name);
2028
2030 void setStringValue(const std::string& stringValue) override;
2031
2034
2038
2040 std::string getStringValue() const override;
2041
2044
2047 {
2048 setImageVectorValue(imageVectorValue);
2049 }
2050
2053 {
2054 updateImageVectorValue(imageVectorValue);
2055 }
2056
2058 const ImageVector& getValue() const
2059 {
2060 return getImageVectorValue();
2061 }
2062
2063protected:
2065 void setValueFromField(const Field& field) override;
2066
2067private:
2069 ImageVector _value;
2070};
2071
2072
2073//-------------------------------------------------------------------------
2076//-------------------------------------------------------------------------
2078{
2081
2082public:
2084 SubImageBoxField() = default;
2085
2088 explicit SubImageBoxField(const std::string& name);
2089
2091 void setStringValue(const std::string& stringValue) override;
2092
2095
2099
2103 std::string getStringValue() const override;
2104
2107
2110 {
2111 setSubImageBoxValue(subImageBoxValue);
2112 }
2113
2116 {
2117 updateSubImageBoxValue(subImageBoxValue);
2118 }
2119
2121 const SubImageBox& getValue() const
2122 {
2123 return getSubImageBoxValue();
2124 }
2125
2126protected:
2128 void setValueFromField(const Field& field) override;
2129
2130private:
2132 SubImageBox _value;
2133};
2134
2135//-------------------------------------------------------------------------
2138//-------------------------------------------------------------------------
2140{
2143
2144public:
2147
2150 explicit SubImageBoxdField(const std::string& name);
2151
2153 void setStringValue(const std::string& stringValue) override;
2154
2157
2162
2166 std::string getStringValue() const override;
2167
2170
2173 {
2174 setSubImageBoxdValue(subImageBoxValue);
2175 }
2176
2179 {
2180 updateSubImageBoxdValue(subImageBoxValue);
2181 }
2182
2184 const SubImageBoxd& getValue() const
2185 {
2186 return getSubImageBoxdValue();
2187 }
2188
2189protected:
2191 void setValueFromField(const Field& field) override;
2192
2193private:
2195 SubImageBoxd _value;
2196};
2197
2198//-------------------------------------------------------------------------
2201//-------------------------------------------------------------------------
2203{
2206
2207public:
2211 explicit UniversalTypeField(const std::string& name = "", MLDataType dt = -1);
2212
2215
2218
2220 void setStringValue(const std::string& stringValue) override;
2221
2224 std::string getStringValue() const override;
2225
2228 virtual void setDataType(MLDataType dataType);
2229
2231 virtual MLDataType getDataType() const;
2232
2234 virtual void setUniversalTypeValue(const MLTypeData* dataType);
2235
2241 [[deprecated("Use getShortLivedUniversalTypeValue() instead.")]]
2243 {
2244 return static_cast<MLTypeData*>(MLMemDup(_typeData, MLSizeOf(_dataType), ML_FATAL_MEMORY_ERROR));
2245 };
2246
2250
2253
2256 {
2257 setUniversalTypeValue(typeData);
2258 };
2259
2261 const MLTypeData* getValue() const
2262 {
2263 return getShortLivedUniversalTypeValue();
2264 };
2265
2266protected:
2270
2274
2277
2278private:
2282 std::string _origString;
2283
2286 std::string _strValue;
2287
2289 MLDataType _dataType{};
2290
2292 MLint _isValid{};
2293
2297 MLTypeData* _typeData{};
2298};
2299
2300//----------------------------------------------------------------------------------
2304//----------------------------------------------------------------------------------
2306{
2307
2310
2311public:
2314 explicit RotationField(const std::string& name = "")
2315 : Vector4Field(name)
2316 {}
2317
2319 void setRotationValue(const Vector3& vec, double angle);
2320
2323
2325 void getRotationValue(Vector3& vec, double& angle) const;
2326
2329};
2330
2331
2332//----------------------------------------------------------------------------------
2336//----------------------------------------------------------------------------------
2338{
2339
2342
2343public:
2346 explicit PlaneField(const std::string& name = "")
2347 : Vector4Field(name)
2348 {}
2349
2351 void setPlaneValue(double f0, double f1, double f2, double f3);
2352
2354 void setPlaneValue(const Plane& p);
2355
2357 void getPlaneValue(double& f0, double& f1, double& f2, double& f3) const;
2358
2360 void getPlaneValue(Plane& plane) const;
2361
2364};
2365
2366
2368
2369
2370#endif // ML_FIELDS_H
@ T
Field to encapsulate a pointer to an ML base object.
Definition mlFields.h:813
Base * getValue() const
Same as getBaseValue().
Definition mlFields.h:903
void setBaseValue(const RefCountedBasePtr &value)
Sets the value from intrusive pointer.
void setValue(Base *basePointerValue)
Same as setBaseValue(Base*).
Definition mlFields.h:891
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:897
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:878
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:872
bool hasUnallowedType() const
Returns true if the last call of setBaseValue had a not allowed type as argument, getBaseValue will r...
Definition mlFields.h:885
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:856
~BaseField() override
Destructor.
Type getTypedBaseValue() const
Returns the typed value if the contained base object is derived from the given Type.
Definition mlFields.h:915
Type getTypedValue() const
Returns the typed value if the contained base object is derived from the given Type.
Definition mlFields.h:909
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:864
Class representing general ML objects that support import/export via strings (setPersistentState() an...
Definition mlBase.h:63
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:103
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:91
void updateValue(bool boolValue)
Same as updateBoolValue().
Definition mlFields.h:97
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:1547
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:1572
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:567
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:600
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:606
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:612
Field to encapsulate an enumerated value.
Definition mlFields.h:185
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: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 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:271
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:277
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:283
Helper class that stores a list of typed enum values and their string names.
Definition mlFields.h:318
const std::vector< EnumField::EnumEntry > & getEntries() const
Returns access to the collected list of enum entries.
Definition mlFields.h:365
void add(const Entry &value)
Adds an enum value via the given entry, typically created with the ML_ENUM_VALUE() macro.
Definition mlFields.h:352
void add(const std::string &stringValue, EnumType value)
Adds an enum value, manually passing in the name and value.
Definition mlFields.h:346
std::vector< EnumField::EnumEntry > _entries
Definition mlFields.h:371
EnumValues & operator<<(const Entry &value)
Adds an enum value via the given entry, typically created with the ML_ENUM_VALUE() macro.
Definition mlFields.h:358
void add(const char *stringValue, EnumType value)
Adds an enum value, manually passing in the name and value.
Definition mlFields.h:340
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:449
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:494
void updateValue(float floatValue)
Same as updateFloatValue().
Definition mlFields.h:488
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:482
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:2017
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:2046
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:2058
void updateValue(const ImageVector &imageVectorValue)
Same as updateImageVectorValue().
Definition mlFields.h:2052
Field to encapsulate a pointer to an input connector that represents a module input.
Definition mlFields.h:770
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:123
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:166
void updateValue(MLint intValue)
Same as updateIntValue().
Definition mlFields.h:160
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:154
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:1967
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:2000
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:1994
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:1595
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:1646
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:1634
const Matrix2 & getMatrixValue() const
Returns the value of the field.
void updateValue(const Matrix2 &matrixValue)
Same as updateMatrix2Value().
Definition mlFields.h:1640
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:1665
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:1716
void setValue(const Matrix3 &matrixValue)
Same as setMatrix3Value().
Definition mlFields.h:1704
void setMatrixValue(const Matrix3 &matrixValue)
Sets the value of the field to matrixValue.
void updateValue(const Matrix3 &matrixValue)
Same as updateMatrix3Value().
Definition mlFields.h:1710
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:1810
Matrix4Field(const std::string &name="")
Implements the runtime type system interface for this class.
Field encapsulating a 5x5 matrix.
Definition mlFields.h:1825
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:1864
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:1870
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:1876
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:1896
void updateValue(const Matrix6 &matrixValue)
Same as updateMatrix6Value().
Definition mlFields.h:1941
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:1947
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:1935
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:1736
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:1778
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:1790
void updateValue(const Matrix4 &matrixValue)
Same as updateMatrix4Value().
Definition mlFields.h:1784
Base class for an image processing module of the ML.
Definition mlModule.h:150
Field without value for notifications.
Definition mlFields.h:687
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:721
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:2338
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:2346
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:1043
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:1070
PointerField()=default
Implements the runtime type system interface for this class.
void * getValue() const
Same as getPointerValue().
Definition mlFields.h:1076
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:519
void setProgressValue(float floatValue)
Same as setFloatValue().
void setValue(float floatValue)
Same as setFloatValue().
Definition mlFields.h:551
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:541
Field to encapsulate a vector of four double values representing a rotation with all properties of Ve...
Definition mlFields.h:2306
RotationField(const std::string &name="")
Implements the runtime type system interface for this class.
Definition mlFields.h:2314
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:986
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:1013
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:1019
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:634
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:670
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:664
void setValue(const std::string &stringValue)
Same as setStringValue().
Definition mlFields.h:658
Field to encapsulate an ML integer SubimgBox.
Definition mlFields.h:2078
void setValue(const SubImageBox &subImageBoxValue)
Same as setSubImageBoxValue().
Definition mlFields.h:2109
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:2121
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:2115
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:2140
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:2184
void setValue(const SubImageBoxd &subImageBoxValue)
Same as setSubImageBoxdValue().
Definition mlFields.h:2172
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:2178
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:608
Templated version of BaseField that only stores the template type as pointer.
Definition mlFields.h:943
void setValue(T *basePointerValue)
Sets the value of the field to basePointerValue.
Definition mlFields.h:953
void setValue(const ::boost::intrusive_ptr< T > &value)
Sets the value from intrusive pointer.
Definition mlFields.h:959
T * getValue() const
Returns the current field value.
Definition mlFields.h:965
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:946
TypedEnumField is used to encapsulate a C++ enum value and work with a real enum value instead of int...
Definition mlFields.h:398
TypedEnumField(const std::string &name, const EnumValues< EnumType > &enumValues, EnumType initialValue)
Creates the TypedEnumField with given name, enumValues, and initialValue.
Definition mlFields.h:404
EnumType getEnumValue() const
Returns the current enum value.
Definition mlFields.h:413
void setEnumValue(EnumType enumValue)
Sets the current enum value and touches the field.
Definition mlFields.h:418
EnumType getValue() const
Same as getEnumValue().
Definition mlFields.h:428
void updateValue(EnumType enumValue)
Same as updateEnumValue().
Definition mlFields.h:438
void updateEnumValue(EnumType enumValue)
Sets the current enum value and only touches the field if the value has changed.
Definition mlFields.h:423
void setValue(EnumType enumValue)
Same as setEnumValue().
Definition mlFields.h:433
Field to encapsulate any of the registered ML types.
Definition mlFields.h:2203
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:2261
void setValue(const MLTypeData *typeData)
Same as setUniversalTypeValue().
Definition mlFields.h:2255
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.
Definition mlFields.h:2242
Field to encapsulate a vector of ten double values.
Definition mlFields.h:1468
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:1514
void setVectorValue(const Vector10 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1493
const Vector10 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1508
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:1520
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:1526
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:1091
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:1115
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:1139
void setValue(const Vector2 &vectorValue)
Same as setVector2Value().
Definition mlFields.h:1133
const Vector2 & getValue() const
Same as getVector2Value().
Definition mlFields.h:1145
const Vector2 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1127
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:1164
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:1202
void updateValue(const Vector3 &vectorValue)
Same as updateVector3Value().
Definition mlFields.h:1214
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:1220
void setVectorValue(const Vector3 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1188
void setValue(const Vector3 &vectorValue)
Same as setVector3Value().
Definition mlFields.h:1208
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:1240
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:1296
void setValue(const Vector4 &vectorValue)
Same as setVector4Value().
Definition mlFields.h:1284
const Vector4 & getVectorValue() const
Returns the value of the field.
Definition mlFields.h:1278
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:1264
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:1290
const Vector4 & getVector4Value() const
Returns the value of the field.
Field to encapsulate a vector of five double values.
Definition mlFields.h:1315
void updateValue(const Vector5 &vectorValue)
Same as updateVector5Value().
Definition mlFields.h:1366
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:1372
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:1354
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:1340
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:1360
Field to encapsulate a vector of six double values.
Definition mlFields.h:1392
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:1431
void setVectorValue(const Vector6 &vectorValue)
Sets the value of the field to vectorValue.
Definition mlFields.h:1417
void updateValue(const Vector6 &vectorValue)
Same as updateVector6Value().
Definition mlFields.h:1443
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:1437
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:1449
#define ML_ABSTRACT_CLASS_HEADER(className)
Similar to ML_ABSTRACT_CLASS_HEADER_EXPORTED with a non-existing export symbol.
MLEXPORT size_t MLSizeOf(MLDataType dataType)
Returns the size of the data type dataType in bytes.
MLint32 MLDataType
MLDataType.
Definition mlTypeDefs.h:592
@ MLuint8Type
Enumerator for the unsigned 8-bit ML integer type.
Definition mlTypeDefs.h:617
#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.
@ ML_FATAL_MEMORY_ERROR
On allocation failure, a fatal error print is done and NULL is returned.
Definition mlTypeDefs.h:729
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:489
ML_UTILS_EXPORT void * MLMemDup(const void *src, MLuint numBytes, MLMemoryErrorHandling handleFailure)
Copies the memory pointed to by src of size numBytes in a newly allocated buffer that must be freed b...
EnumValues< EnumType >::Entry createEnumEntry(const char *value, EnumType enumValue)
Helper method to infer the EnumType via the function signature.
Definition mlFields.h:387
MLEXPORT void MLInitFields()
Initialize all standard fields of the ML.
Defines the entry for one enum value.
Definition mlFields.h:246
EnumEntry(const std::string &sv, int v)
Definition mlFields.h:250
std::string stringValue
The string value of the entry.
Definition mlFields.h:256
int value
The enum value of the entry.
Definition mlFields.h:258
Defines the entry for one enum value.
Definition mlFields.h:322
EnumType value
The enum value of the entry.
Definition mlFields.h:335
const char * stringValue
The string value of the entry.
Definition mlFields.h:333
Entry(const char *sv, EnumType v)
Definition mlFields.h:327