diff options
author | David Crocker <dcrocker@eschertech.com> | 2018-10-30 01:29:15 +0300 |
---|---|---|
committer | David Crocker <dcrocker@eschertech.com> | 2018-10-30 01:29:15 +0300 |
commit | 891a7ff5fb578a82d3ae43f1748be7a347634bee (patch) | |
tree | 8d435289a7fdf8c9c29fbc5d03b0bcc7ca4845df /src/ObjectModel/ObjectModel.h | |
parent | 5b53947769cc67b79e0c9f316311e43665638c0f (diff) |
2.02RC4 provisional (second attempt)
Allow I2C addresses to be given in hex format
Allow axes to be mapped ot nin-existant driver numbers
More work on object model variable substitution in GCode commands
Added a possible fix for coast-to-end
Diffstat (limited to 'src/ObjectModel/ObjectModel.h')
-rw-r--r-- | src/ObjectModel/ObjectModel.h | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/ObjectModel/ObjectModel.h b/src/ObjectModel/ObjectModel.h index e0e69f4c..a3ad2d17 100644 --- a/src/ObjectModel/ObjectModel.h +++ b/src/ObjectModel/ObjectModel.h @@ -24,6 +24,7 @@ class ObjectModel; union ExpressionValue { + bool bVal; float fVal; int32_t iVal; uint32_t uVal; @@ -32,8 +33,10 @@ union ExpressionValue }; // Dummy types, used to define type codes -class Bitmap32 { }; -class Enum32 { }; +class Bitmap32; +class Enum32; +class Float2; // float printed to 2 decimal places instead of 1 +class Float3; // float printed to 3 decimal places instead of 1 class ObjectModel { @@ -87,11 +90,13 @@ template<> constexpr TypeCode TypeOf<bool> () { return 1; } template<> constexpr TypeCode TypeOf<uint32_t> () { return 2; } template<> constexpr TypeCode TypeOf<int32_t>() { return 3; } template<> constexpr TypeCode TypeOf<float>() { return 4; } -template<> constexpr TypeCode TypeOf<Bitmap32>() { return 5; } -template<> constexpr TypeCode TypeOf<Enum32>() { return 6; } -template<> constexpr TypeCode TypeOf<ObjectModel>() { return 7; } -template<> constexpr TypeCode TypeOf<const char *>() { return 8; } -template<> constexpr TypeCode TypeOf<IPAddress>() { return 9; } +template<> constexpr TypeCode TypeOf<Float2>() { return 5; } +template<> constexpr TypeCode TypeOf<Float3>() { return 6; } +template<> constexpr TypeCode TypeOf<Bitmap32>() { return 7; } +template<> constexpr TypeCode TypeOf<Enum32>() { return 8; } +template<> constexpr TypeCode TypeOf<ObjectModel>() { return 9; } +template<> constexpr TypeCode TypeOf<const char *>() { return 10; } +template<> constexpr TypeCode TypeOf<IPAddress>() { return 11; } #define TYPE_OF(_t) (TypeOf<_t>()) @@ -141,15 +146,6 @@ public: // Compare the name of this field with the filter string that we are trying to match int IdCompare(const char *id) const; - // Return true if this field is an object, not a primitive type - bool IsObject() const { return type == TYPE_OF(ObjectModel); } - - // Follow the path specified by the ifString until we reach the end of it - const ObjectModelTableEntry *FindLeafEntry(ObjectModel *self, const char *idString) const; - - // Check the type is correct, call the function and return the pointer - void* GetValuePointer(ObjectModel *self, TypeCode t) const; - // Private function to report a value of primitive type static void ReportItemAsJson(OutputBuffer *buf, const char *filter, ObjectModel::ReportFlags flags, void *nParam, TypeCode type); }; |