25
25
#include " flxCoreTypes.h"
26
26
#include " flxUtils.h"
27
27
28
+ // Define a type used to enumerate parameter value types (not data types, but values, like temp, accel)
29
+
30
+ typedef uint16_t flxParamValueType_t;
31
+
32
+ const flxParamValueType_t kParamValueNone = 0 ;
33
+
28
34
// ----------------------------------------------------------------------------------------
29
35
// flxParameter
30
36
//
31
37
// Base/Core Parameter Class
32
38
//
33
39
// From an abstract sense, a basic parameter - nothing more
34
-
40
+ //
35
41
class flxParameter : public flxDescriptor
36
42
{
37
43
bool _isEnabled;
44
+ flxParamValueType_t _valueType;
38
45
39
46
public:
40
- flxParameter () : _isEnabled{true } {};
47
+ flxParameter () : _isEnabled{true }, _valueType{kParamValueNone }
48
+ {
49
+ }
41
50
42
51
bool enabled (void )
43
52
{
44
53
return _isEnabled;
45
54
}
46
55
56
+ flxParamValueType_t valueType (void )
57
+ {
58
+ return _valueType;
59
+ }
60
+ void setValueType (flxParamValueType_t type)
61
+ {
62
+ _valueType = type;
63
+ }
64
+
47
65
virtual void setEnabled (bool enabled)
48
66
{
49
67
_isEnabled = enabled;
@@ -292,6 +310,14 @@ class _flxParameterOut : public _flxDataOut<T>, public flxParameterOutScalar
292
310
(*this )(obj, name);
293
311
}
294
312
313
+ void operator ()(Object *obj, const char *name, const char *desc, flxParamValueType_t vtype)
314
+ {
315
+ // Value type
316
+ setValueType (vtype);
317
+
318
+ // cascade to other version of method
319
+ (*this )(obj, name, desc);
320
+ }
295
321
// override to deal with dirty status of object.
296
322
void setEnabled (bool bEnabled)
297
323
{
@@ -488,6 +514,14 @@ class flxParameterOutString : public flxParameterOutScalar, public _flxDataOutSt
488
514
(*this )(obj, name);
489
515
}
490
516
517
+ void operator ()(Object *obj, const char *name, const char *desc, flxParamValueType_t vtype)
518
+ {
519
+ // Value type
520
+ setValueType (vtype);
521
+
522
+ // cascade to other version of method
523
+ (*this )(obj, name, desc);
524
+ }
491
525
// override to deal with dirty status of object.
492
526
void setEnabled (bool bEnabled)
493
527
{
@@ -641,6 +675,14 @@ class flxParameterOutArrayType : public flxParameterOutArray
641
675
(*this )(obj, name);
642
676
}
643
677
678
+ void operator ()(Object *obj, const char *name, const char *desc, flxParamValueType_t vtype)
679
+ {
680
+ // Value type
681
+ setValueType (vtype);
682
+
683
+ // cascade to other version of method
684
+ (*this )(obj, name, desc);
685
+ }
644
686
// override to deal with dirty status of object.
645
687
void setEnabled (bool bEnabled)
646
688
{
@@ -805,7 +847,14 @@ class flxParameterOutArrayString : public flxParameterOutArray
805
847
// cascade to other version of method
806
848
(*this )(obj, name);
807
849
}
850
+ void operator ()(Object *obj, const char *name, const char *desc, flxParamValueType_t vtype)
851
+ {
852
+ // Value type
853
+ setValueType (vtype);
808
854
855
+ // cascade to other version of method
856
+ (*this )(obj, name, desc);
857
+ }
809
858
// override to deal with dirty status of object.
810
859
void setEnabled (bool bEnabled)
811
860
{
@@ -913,6 +962,14 @@ class _flxParameterIn : public flxParameterIn, public _flxDataIn<T>
913
962
(*this )(obj, name);
914
963
}
915
964
965
+ void operator ()(Object *obj, const char *name, const char *desc, flxParamValueType_t vtype)
966
+ {
967
+ // Value type
968
+ setValueType (vtype);
969
+
970
+ // cascade to other version of method
971
+ (*this )(obj, name, desc);
972
+ }
916
973
// ---------------------------------------------------------------------------------
917
974
void set (T const &value)
918
975
{
@@ -1063,6 +1120,14 @@ class flxParameterInString : public flxParameterIn, _flxDataInString
1063
1120
(*this )(obj, name);
1064
1121
}
1065
1122
1123
+ void operator ()(Object *obj, const char *name, const char *desc, flxParamValueType_t vtype)
1124
+ {
1125
+ // Value type
1126
+ setValueType (vtype);
1127
+
1128
+ // cascade to other version of method
1129
+ (*this )(obj, name, desc);
1130
+ }
1066
1131
// ---------------------------------------------------------------------------------
1067
1132
void set (std::string const &value)
1068
1133
{
@@ -1188,6 +1253,15 @@ template <class Object, void (Object::*_setter)()> class flxParameterInVoid : pu
1188
1253
(*this )(obj, name);
1189
1254
}
1190
1255
1256
+ void operator ()(Object *obj, const char *name, const char *desc, flxParamValueType_t vtype)
1257
+ {
1258
+ // Value type
1259
+ setValueType (vtype);
1260
+
1261
+ // cascade to other version of method
1262
+ (*this )(obj, name, desc);
1263
+ }
1264
+
1191
1265
// ---------------------------------------------------------------------------------
1192
1266
void set ()
1193
1267
{
@@ -1229,9 +1303,10 @@ template <class Object, void (Object::*_setter)()> class flxParameterInVoid : pu
1229
1303
1230
1304
// Use some macro magic to determine which actual call to make based on the number of passed in
1231
1305
// parameters..
1232
- #define _spGetRegAttributeMacro (_1, _2, _3, _NAME_, ...) _NAME_
1306
+ #define _spGetRegAttributeMacro (_1, _2, _3, _4, _NAME_, ...) _NAME_
1233
1307
#define flxRegister (...) \
1234
- _spGetRegAttributeMacro (__VA_ARGS__, flxRegisterDesc, flxRegisterName, flxRegisterObj)(__VA_ARGS__)
1308
+ _spGetRegAttributeMacro (__VA_ARGS__, flxRegisterValueType, flxRegisterDesc, flxRegisterName, \
1309
+ flxRegisterObj)(__VA_ARGS__)
1235
1310
1236
1311
#define flxRegisterObj (_obj_name_ ) _obj_name_(this , #_obj_name_)
1237
1312
@@ -1241,6 +1316,9 @@ template <class Object, void (Object::*_setter)()> class flxParameterInVoid : pu
1241
1316
// User provided Name and description
1242
1317
#define flxRegisterDesc (_obj_name_, _name_, _desc_ ) _obj_name_(this , _name_, _desc_)
1243
1318
1319
+ // For parameters - user provided value type
1320
+ #define flxRegisterValueType (_obj_name_, _name_, _desc_, _type_ ) _obj_name_(this , _name_, _desc_, _type_)
1321
+
1244
1322
// Define a object type that supports parameter lists (input and output)
1245
1323
class flxOperation : public flxObject , public _flxParameterContainer
1246
1324
{
0 commit comments