From 42cf696e44e17698018ba974bbd0281c54a11d12 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Sat, 24 Aug 2019 16:31:28 +1000 Subject: [PATCH 01/13] Updating next version to be 2.4 --- lib/include/commsdsl/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/include/commsdsl/version.h b/lib/include/commsdsl/version.h index 7dd84b92..757dc783 100644 --- a/lib/include/commsdsl/version.h +++ b/lib/include/commsdsl/version.h @@ -23,7 +23,7 @@ #define COMMSDSL_MAJOR_VERSION 2U /// @brief Minor verion of the library -#define COMMSDSL_MINOR_VERSION 3U +#define COMMSDSL_MINOR_VERSION 4U /// @brief Patch level of the library #define COMMSDSL_PATCH_VERSION 0U From d76849b4deecf484d09e174d88d691fbd265bf2e Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 4 Sep 2019 08:06:58 +1000 Subject: [PATCH 02/13] Added test38. --- app/commsdsl2comms/test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/commsdsl2comms/test/CMakeLists.txt b/app/commsdsl2comms/test/CMakeLists.txt index 3089bdeb..3397e785 100644 --- a/app/commsdsl2comms/test/CMakeLists.txt +++ b/app/commsdsl2comms/test/CMakeLists.txt @@ -250,6 +250,6 @@ test_func (test34) test_func (test35) test_func (test36) test_func (test37) -#test_func (test38) +test_func (test38) From 86013f511376dcb403e093e68d698106373df516 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 4 Sep 2019 08:07:14 +1000 Subject: [PATCH 03/13] Requesting append of element index for list members. --- app/commsdsl2comms/src/ListField.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/commsdsl2comms/src/ListField.cpp b/app/commsdsl2comms/src/ListField.cpp index 7da712d6..0f1abe25 100644 --- a/app/commsdsl2comms/src/ListField.cpp +++ b/app/commsdsl2comms/src/ListField.cpp @@ -529,6 +529,8 @@ std::string ListField::getPluginPropertiesImpl(bool serHiddenParam) const props.push_back(".prefixName(\"" + getPrefixName() + "\")"); props.push_back(".showPrefix()"); } while (false); + + props.push_back(".appendIndexToElementName()"); return common::listToString(props, "\n", common::emptyString()); } From 0182761796b167b49f11b877d83abe475b7e5a08 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 4 Sep 2019 08:10:28 +1000 Subject: [PATCH 04/13] Requiring minimal version of comms library to be v2.1. --- app/commsdsl2comms/src/Generator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/commsdsl2comms/src/Generator.cpp b/app/commsdsl2comms/src/Generator.cpp index 04674439..8c77059f 100644 --- a/app/commsdsl2comms/src/Generator.cpp +++ b/app/commsdsl2comms/src/Generator.cpp @@ -45,7 +45,7 @@ namespace { const unsigned MaxDslVersion = 2U; -const std::string MinCommsVersionStr("2, 0, 2"); +const std::string MinCommsVersionStr("2, 1, 0"); const std::string ScopeSep("::"); const std::string ReplaceSuffix(".replace"); const std::string ExtendSuffix(".extend"); From 8e53f3ab60ce74dc19532b0b16ae0d2e37230b8b Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 4 Sep 2019 08:11:20 +1000 Subject: [PATCH 05/13] Using develop branch of comms_champion. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 766b3188..1670a3e0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,7 @@ endwhile () include(GNUInstallDirs) if ("${CC_TAG}" STREQUAL "") - set (CC_TAG "v2.0.2") + set (CC_TAG "develop") endif() add_subdirectory(lib) From f5103169755d26c529b99f1b212b17281ed7e3b2 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 4 Sep 2019 16:14:35 +1000 Subject: [PATCH 06/13] Minor fix to hex message id display in cc_view. --- app/commsdsl2comms/src/Interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/commsdsl2comms/src/Interface.cpp b/app/commsdsl2comms/src/Interface.cpp index 931f8256..3e597496 100644 --- a/app/commsdsl2comms/src/Interface.cpp +++ b/app/commsdsl2comms/src/Interface.cpp @@ -424,7 +424,7 @@ bool Interface::writePluginSrc() auto func = "QString " + className + "::idAsStringImpl() const\n" "{\n" - " return QString(\"0x%1\").arg(static_cast(getId()), " + + " return \"0x\" + QString(\"%1\").arg(static_cast(getId()), " + std::to_string(hexWidth) + ", 16, QChar('0')).toUpper();\n" "}\n"; replacements.insert(std::make_pair("ID_FUNC", std::move(func))); From ba4271d63929fc9e50af7c14a0bfc10811fc90e9 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 10 Sep 2019 08:00:16 +1000 Subject: [PATCH 07/13] Introducing check for non-repeating special values. --- lib/src/FloatFieldImpl.cpp | 46 ++++++++++++++++++++++++++++++++++++- lib/src/FloatFieldImpl.h | 2 ++ lib/src/IntFieldImpl.cpp | 26 +++++++++++++++++++++ lib/src/IntFieldImpl.h | 2 ++ lib/src/ProtocolImpl.cpp | 5 ++++ lib/src/ProtocolImpl.h | 1 + lib/src/common.cpp | 6 +++++ lib/src/common.h | 1 + lib/test/float/Schema22.xml | 13 +++++++++++ lib/test/float/Schema23.xml | 14 +++++++++++ lib/test/float/Schema24.xml | 14 +++++++++++ lib/test/float/floatTest.th | 43 ++++++++++++++++++++++++++++++++++ lib/test/int/Schema11.xml | 2 +- lib/test/int/Schema12.xml | 2 +- lib/test/int/Schema41.xml | 9 ++++++++ lib/test/int/intTest.th | 9 ++++++++ 16 files changed, 192 insertions(+), 3 deletions(-) create mode 100644 lib/test/float/Schema22.xml create mode 100644 lib/test/float/Schema23.xml create mode 100644 lib/test/float/Schema24.xml create mode 100644 lib/test/int/Schema41.xml diff --git a/lib/src/FloatFieldImpl.cpp b/lib/src/FloatFieldImpl.cpp index 36834106..780c2c88 100644 --- a/lib/src/FloatFieldImpl.cpp +++ b/lib/src/FloatFieldImpl.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "common.h" #include "util.h" @@ -105,6 +106,7 @@ double maxValueForType(FloatFieldImpl::Type value) FloatFieldImpl::FloatFieldImpl(xmlNodePtr node, ProtocolImpl& protocol) : Base(node, protocol) { + m_state.m_nonUniqueSpecialsAllowed = !protocol.isNonUniqueSpecialsAllowedSupported(); } FieldImpl::Kind FloatFieldImpl::kindImpl() const @@ -132,7 +134,8 @@ const XmlWrap::NamesList&FloatFieldImpl::extraPropsNamesImpl() const common::validMaxStr(), common::validCheckVersionStr(), common::unitsStr(), - common::displayDesimalsStr() + common::displayDesimalsStr(), + common::nonUniqueSpecialsAllowedStr(), }; return List; @@ -162,6 +165,7 @@ bool FloatFieldImpl::parseImpl() updateEndian() && updateLength() && updateMinMaxValues() && + updateNonUniqueSpecialsAllowed() && updateSpecials() && updateDefaultValue() && updateValidCheckVersion() && @@ -445,10 +449,19 @@ bool FloatFieldImpl::updateValidRanges() return true; } +bool FloatFieldImpl::updateNonUniqueSpecialsAllowed() +{ + return validateAndUpdateBoolPropValue(common::nonUniqueSpecialsAllowedStr(), m_state.m_nonUniqueSpecialsAllowed); +} + bool FloatFieldImpl::updateSpecials() { auto specials = XmlWrap::getChildren(getNode(), common::specialStr()); + using RecSpecials = std::multimap; + RecSpecials recSpecials; + std::string prevNanSpecial; + for (auto* s : specials) { static const XmlWrap::NamesList PropNames = { common::nameStr(), @@ -510,6 +523,37 @@ bool FloatFieldImpl::updateSpecials() return false; } + if (!m_state.m_nonUniqueSpecialsAllowed) { + bool reportError = false; + const std::string* prevDefName = nullptr; + do { + if (std::isnan(val)) { + reportError = !prevNanSpecial.empty(); + prevNanSpecial = nameIter->second; + prevDefName = &prevNanSpecial; + break; + } + + auto recIter = recSpecials.find(val); + if (recIter != recSpecials.end()) { + reportError = true; + prevDefName = &(recIter->second); + } + else { + recSpecials.insert(std::make_pair(val, nameIter->second)); + } + } while (false); + + if (reportError) { + assert(prevDefName != nullptr); + logError() << XmlWrap::logPrefix(s) << + "Value of special \"" << nameIter->second << + "\" (" << valIter->second << ") has already been defined as \"" << + *prevDefName << "\"."; + return false; + } + } + bool isSpecial = std::isnan(val) || std::isinf(val); if ((!isSpecial) && ((val < m_state.m_typeAllowedMinValue) || (m_state.m_typeAllowedMaxValue < val))) { diff --git a/lib/src/FloatFieldImpl.h b/lib/src/FloatFieldImpl.h index 82bc512e..4ca70794 100644 --- a/lib/src/FloatFieldImpl.h +++ b/lib/src/FloatFieldImpl.h @@ -100,6 +100,7 @@ class FloatFieldImpl : public FieldImpl bool updateDefaultValue(); bool updateValidCheckVersion(); bool updateValidRanges(); + bool updateNonUniqueSpecialsAllowed(); bool updateSpecials(); bool updateUnits(); bool updateDisplayDecimals(); @@ -139,6 +140,7 @@ class FloatFieldImpl : public FieldImpl Units m_units = Units::Unknown; unsigned m_displayDecimals = 0U; bool m_validCheckVersion = false; + bool m_nonUniqueSpecialsAllowed = false; }; State m_state; diff --git a/lib/src/IntFieldImpl.cpp b/lib/src/IntFieldImpl.cpp index 07464a16..2908365f 100644 --- a/lib/src/IntFieldImpl.cpp +++ b/lib/src/IntFieldImpl.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include "common.h" #include "ProtocolImpl.h" @@ -136,6 +137,7 @@ std::uintmax_t calcMaxUnsignedValue(IntFieldImpl::Type t, std::size_t bitsLen) IntFieldImpl::IntFieldImpl(::xmlNodePtr node, ProtocolImpl& protocol) : Base(node, protocol) { + m_state.m_nonUniqueSpecialsAllowed = !protocol.isNonUniqueSpecialsAllowedSupported(); } IntFieldImpl::Type IntFieldImpl::parseTypeValue(const std::string& value) @@ -329,6 +331,7 @@ const XmlWrap::NamesList& IntFieldImpl::extraPropsNamesImpl() const common::validMinStr(), common::validMaxStr(), common::validCheckVersionStr(), + common::nonUniqueSpecialsAllowedStr(), common::displayDesimalsStr(), common::displayOffsetStr(), common::signExtStr() @@ -364,6 +367,7 @@ bool IntFieldImpl::parseImpl() updateScaling() && updateSerOffset() && updateMinMaxValues() && + updateNonUniqueSpecialsAllowed() && updateSpecials() && updateDefaultValue() && updateValidCheckVersion() && @@ -987,10 +991,19 @@ bool IntFieldImpl::updateValidRanges() return true; } +bool IntFieldImpl::updateNonUniqueSpecialsAllowed() +{ + return validateAndUpdateBoolPropValue(common::nonUniqueSpecialsAllowedStr(), m_state.m_nonUniqueSpecialsAllowed); +} + bool IntFieldImpl::updateSpecials() { bool bigUnsignedType = isBigUnsigned(m_state.m_type); auto specials = XmlWrap::getChildren(getNode(), common::specialStr()); + + using RecSpecials = std::multimap; + RecSpecials recSpecials; + for (auto* s : specials) { static const XmlWrap::NamesList PropNames = { common::nameStr(), @@ -1053,6 +1066,19 @@ bool IntFieldImpl::updateSpecials() return false; } + if (!m_state.m_nonUniqueSpecialsAllowed) { + auto recIter = recSpecials.find(val); + if (recIter != recSpecials.end()) { + logError() << XmlWrap::logPrefix(s) << + "Value of special \"" << nameIter->second << + "\" (" << valIter->second << ") has already been defined as \"" << + recIter->second << "\"."; + return false; + } + + recSpecials.insert(std::make_pair(val, nameIter->second)); + } + auto checkSpecialInRangeFunc = [this, s, &nameIter](auto v) -> bool { diff --git a/lib/src/IntFieldImpl.h b/lib/src/IntFieldImpl.h index 3165d721..10c2d510 100644 --- a/lib/src/IntFieldImpl.h +++ b/lib/src/IntFieldImpl.h @@ -154,6 +154,7 @@ class IntFieldImpl : public FieldImpl bool updateScaling(); bool updateValidCheckVersion(); bool updateValidRanges(); + bool updateNonUniqueSpecialsAllowed(); bool updateSpecials(); bool updateUnits(); bool updateDisplayDecimals(); @@ -195,6 +196,7 @@ class IntFieldImpl : public FieldImpl std::intmax_t m_displayOffset = 0U; bool m_validCheckVersion = false; bool m_signExt = true; + bool m_nonUniqueSpecialsAllowed = false; }; State m_state; diff --git a/lib/src/ProtocolImpl.cpp b/lib/src/ProtocolImpl.cpp index 882ab762..6674c785 100644 --- a/lib/src/ProtocolImpl.cpp +++ b/lib/src/ProtocolImpl.cpp @@ -338,6 +338,11 @@ bool ProtocolImpl::isSemanticTypeRefInheritanceSupported() const return isFeatureSupported(2U); } +bool ProtocolImpl::isNonUniqueSpecialsAllowedSupported() const +{ + return isFeatureSupported(2U); +} + void ProtocolImpl::cbXmlErrorFunc(void* userData, xmlErrorPtr err) { reinterpret_cast(userData)->handleXmlError(err); diff --git a/lib/src/ProtocolImpl.h b/lib/src/ProtocolImpl.h index 949dc097..f54abc18 100644 --- a/lib/src/ProtocolImpl.h +++ b/lib/src/ProtocolImpl.h @@ -107,6 +107,7 @@ class ProtocolImpl bool isFieldValueReferenceSupported() const; bool isSemanticTypeLengthSupported() const; bool isSemanticTypeRefInheritanceSupported() const; + bool isNonUniqueSpecialsAllowedSupported() const; private: struct XmlDocFree diff --git a/lib/src/common.cpp b/lib/src/common.cpp index 73af1102..b77dcea0 100644 --- a/lib/src/common.cpp +++ b/lib/src/common.cpp @@ -309,6 +309,12 @@ const std::string& nonUniqueAllowedStr() return Str; } +const std::string& nonUniqueSpecialsAllowedStr() +{ + static const std::string Str("nonUniqueSpecialsAllowed"); + return Str; +} + const std::string& nonUniqueMsgIdAllowedStr() { static const std::string Str("nonUniqueMsgIdAllowed"); diff --git a/lib/src/common.h b/lib/src/common.h index be685cbf..584b01bf 100644 --- a/lib/src/common.h +++ b/lib/src/common.h @@ -78,6 +78,7 @@ const std::string& fieldStr(); const std::string& nsStr(); const std::string& enumStr(); const std::string& nonUniqueAllowedStr(); +const std::string& nonUniqueSpecialsAllowedStr(); const std::string& nonUniqueMsgIdAllowedStr(); const std::string& reservedValueStr(); const std::string& reservedStr(); diff --git a/lib/test/float/Schema22.xml b/lib/test/float/Schema22.xml new file mode 100644 index 00000000..9730ad50 --- /dev/null +++ b/lib/test/float/Schema22.xml @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/lib/test/float/Schema23.xml b/lib/test/float/Schema23.xml new file mode 100644 index 00000000..6365db4e --- /dev/null +++ b/lib/test/float/Schema23.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/lib/test/float/Schema24.xml b/lib/test/float/Schema24.xml new file mode 100644 index 00000000..717477ae --- /dev/null +++ b/lib/test/float/Schema24.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/lib/test/float/floatTest.th b/lib/test/float/floatTest.th index 877c75aa..b034cf57 100644 --- a/lib/test/float/floatTest.th +++ b/lib/test/float/floatTest.th @@ -29,6 +29,9 @@ public: void test19(); void test20(); void test21(); + void test22(); + void test23(); + void test24(); private: static const double Epsilon; @@ -750,3 +753,43 @@ void FloatTestSuite::test21() TS_ASSERT(std::isinf(s2.m_value)); } while (false); } + +void FloatTestSuite::test22() +{ + m_status.m_expErrors.push_back(commsdsl::ErrorLevel_Error); + m_status.m_expValidateResult = false; + auto protocol = prepareProtocol(SCHEMAS_DIR "/Schema22.xml"); + TS_ASSERT(protocol); +} + +void FloatTestSuite::test23() +{ + m_status.m_expErrors.push_back(commsdsl::ErrorLevel_Error); + m_status.m_expValidateResult = false; + auto protocol = prepareProtocol(SCHEMAS_DIR "/Schema23.xml"); + TS_ASSERT(protocol); +} + +void FloatTestSuite::test24() +{ + auto protocol = prepareProtocol(SCHEMAS_DIR "/Schema24.xml"); + TS_ASSERT(protocol); + auto namespaces = protocol->namespaces(); + TS_ASSERT_EQUALS(namespaces.size(), 1U); + + do { + auto& ns = namespaces.front(); + TS_ASSERT(ns.name().empty()); + + auto fields = ns.fields(); + TS_ASSERT_EQUALS(fields.size(), 1U); + + auto& field = fields[0]; + TS_ASSERT_EQUALS(field.name(), "F1"); + TS_ASSERT_EQUALS(field.kind(), commsdsl::Field::Kind::Float); + + commsdsl::FloatField floatField(field); + auto& specialValues = floatField.specialValues(); + TS_ASSERT_EQUALS(specialValues.size(), 3U); + } while (false); +} diff --git a/lib/test/int/Schema11.xml b/lib/test/int/Schema11.xml index 635f316b..ed07c148 100644 --- a/lib/test/int/Schema11.xml +++ b/lib/test/int/Schema11.xml @@ -4,7 +4,7 @@ endian="little"> - + diff --git a/lib/test/int/Schema12.xml b/lib/test/int/Schema12.xml index 0dd4fd5f..c5210935 100644 --- a/lib/test/int/Schema12.xml +++ b/lib/test/int/Schema12.xml @@ -7,7 +7,7 @@ - + diff --git a/lib/test/int/Schema41.xml b/lib/test/int/Schema41.xml new file mode 100644 index 00000000..edc4862e --- /dev/null +++ b/lib/test/int/Schema41.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/lib/test/int/intTest.th b/lib/test/int/intTest.th index d82db365..89530da5 100644 --- a/lib/test/int/intTest.th +++ b/lib/test/int/intTest.th @@ -47,6 +47,7 @@ public: void test38(); void test39(); void test40(); + void test41(); }; void IntTestSuite::setUp() @@ -1818,3 +1819,11 @@ void IntTestSuite::test40() TS_ASSERT_EQUALS(specialValues.find("S1")->second.m_value, 10); } +void IntTestSuite::test41() +{ + m_status.m_expErrors.push_back(commsdsl::ErrorLevel_Error); + m_status.m_expValidateResult = false; + + auto protocol = prepareProtocol(SCHEMAS_DIR "/Schema41.xml"); + TS_ASSERT(protocol); +} From ac8ca104c5abb5194dda1a99b318ee18741880a8 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Tue, 10 Sep 2019 16:22:36 +1000 Subject: [PATCH 08/13] Added "displayName" property support for int and float special values. --- lib/include/commsdsl/FloatField.h | 1 + lib/include/commsdsl/IntField.h | 1 + lib/src/FloatFieldImpl.cpp | 12 +++++++++++- lib/src/IntFieldImpl.cpp | 12 +++++++++++- lib/test/float/Schema24.xml | 2 +- lib/test/float/floatTest.th | 7 +++++++ lib/test/int/Schema11.xml | 2 +- lib/test/int/intTest.th | 2 ++ 8 files changed, 35 insertions(+), 4 deletions(-) diff --git a/lib/include/commsdsl/FloatField.h b/lib/include/commsdsl/FloatField.h index d7e6221e..359805b1 100644 --- a/lib/include/commsdsl/FloatField.h +++ b/lib/include/commsdsl/FloatField.h @@ -55,6 +55,7 @@ class COMMSDSL_API FloatField : public Field unsigned m_sinceVersion = 0; unsigned m_deprecatedSince = Protocol::notYetDeprecated(); std::string m_description; + std::string m_displayName; }; using SpecialValues = std::map; diff --git a/lib/include/commsdsl/IntField.h b/lib/include/commsdsl/IntField.h index d46ac34a..c480eeec 100644 --- a/lib/include/commsdsl/IntField.h +++ b/lib/include/commsdsl/IntField.h @@ -67,6 +67,7 @@ class COMMSDSL_API IntField : public Field unsigned m_sinceVersion = 0; unsigned m_deprecatedSince = Protocol::notYetDeprecated(); std::string m_description; + std::string m_displayName; }; using SpecialValues = std::map; diff --git a/lib/src/FloatFieldImpl.cpp b/lib/src/FloatFieldImpl.cpp index 780c2c88..543b0666 100644 --- a/lib/src/FloatFieldImpl.cpp +++ b/lib/src/FloatFieldImpl.cpp @@ -468,7 +468,8 @@ bool FloatFieldImpl::updateSpecials() common::valStr(), common::sinceVersionStr(), common::deprecatedStr(), - common::descriptionStr() + common::descriptionStr(), + common::displayNameStr() }; auto props = XmlWrap::parseNodeProps(s); @@ -496,6 +497,10 @@ bool FloatFieldImpl::updateSpecials() return false; } + if (!XmlWrap::validateSinglePropInstance(s, props, common::displayNameStr(), protocol().logger())) { + return false; + } + auto nameIter = props.find(common::nameStr()); assert(nameIter != props.end()); @@ -577,6 +582,11 @@ bool FloatFieldImpl::updateSpecials() info.m_description = descIter->second; } + auto displayNameIter = props.find(common::displayNameStr()); + if (displayNameIter != props.end()) { + info.m_displayName = displayNameIter->second; + } + m_state.m_specials.emplace(nameIter->second, info); } diff --git a/lib/src/IntFieldImpl.cpp b/lib/src/IntFieldImpl.cpp index 2908365f..6713d180 100644 --- a/lib/src/IntFieldImpl.cpp +++ b/lib/src/IntFieldImpl.cpp @@ -1010,7 +1010,8 @@ bool IntFieldImpl::updateSpecials() common::valStr(), common::sinceVersionStr(), common::deprecatedStr(), - common::descriptionStr() + common::descriptionStr(), + common::displayNameStr(), }; auto props = XmlWrap::parseNodeProps(s); @@ -1038,6 +1039,10 @@ bool IntFieldImpl::updateSpecials() return false; } + if (!XmlWrap::validateSinglePropInstance(s, props, common::displayNameStr(), protocol().logger())) { + return false; + } + auto nameIter = props.find(common::nameStr()); assert(nameIter != props.end()); @@ -1123,6 +1128,11 @@ bool IntFieldImpl::updateSpecials() info.m_description = descIter->second; } + auto displayNameIter = props.find(common::displayNameStr()); + if (displayNameIter != props.end()) { + info.m_displayName = displayNameIter->second; + } + m_state.m_specials.emplace(nameIter->second, info); } diff --git a/lib/test/float/Schema24.xml b/lib/test/float/Schema24.xml index 717477ae..eb38a39f 100644 --- a/lib/test/float/Schema24.xml +++ b/lib/test/float/Schema24.xml @@ -6,7 +6,7 @@ dslVersion="2"> - + diff --git a/lib/test/float/floatTest.th b/lib/test/float/floatTest.th index b034cf57..1b029d65 100644 --- a/lib/test/float/floatTest.th +++ b/lib/test/float/floatTest.th @@ -791,5 +791,12 @@ void FloatTestSuite::test24() commsdsl::FloatField floatField(field); auto& specialValues = floatField.specialValues(); TS_ASSERT_EQUALS(specialValues.size(), 3U); + auto s1 = specialValues.find("S1"); + auto s2 = specialValues.find("S2"); + auto s3 = specialValues.find("S3"); + + TS_ASSERT_EQUALS(s1->second.m_displayName, "Special 1"); + TS_ASSERT(s2->second.m_displayName.empty()); + TS_ASSERT(s3->second.m_displayName.empty()); } while (false); } diff --git a/lib/test/int/Schema11.xml b/lib/test/int/Schema11.xml index ed07c148..16ee19eb 100644 --- a/lib/test/int/Schema11.xml +++ b/lib/test/int/Schema11.xml @@ -5,7 +5,7 @@ - + diff --git a/lib/test/int/intTest.th b/lib/test/int/intTest.th index 89530da5..42831c79 100644 --- a/lib/test/int/intTest.th +++ b/lib/test/int/intTest.th @@ -1047,7 +1047,9 @@ void IntTestSuite::test11() auto s2 = specialValues.find("val2"); auto s3 = specialValues.find("otherVal2"); TS_ASSERT_EQUALS(s1->second.m_value, 100); + TS_ASSERT_EQUALS(s1->second.m_displayName, "Value 1"); TS_ASSERT_EQUALS(s2->second.m_value, 101); + TS_ASSERT(s2->second.m_displayName.empty()); TS_ASSERT_EQUALS(s3->second.m_value, 101); } From 35ec7f83f4ec8731e8b9f32f08c5de334bf89e57 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Thu, 12 Sep 2019 08:02:42 +1000 Subject: [PATCH 09/13] Finalising support for extra special values properties in the library. --- lib/include/commsdsl/FloatField.h | 2 ++ lib/include/commsdsl/IntField.h | 1 + lib/src/FloatField.cpp | 10 +++++++ lib/src/FloatFieldImpl.cpp | 46 ++++++++++++++++++++++++++++++- lib/src/FloatFieldImpl.h | 9 ++++++ lib/src/IntField.cpp | 5 ++++ lib/src/IntFieldImpl.cpp | 12 ++++++-- lib/src/IntFieldImpl.h | 7 +++++ lib/src/common.cpp | 6 ++++ lib/src/common.h | 1 + lib/test/float/Schema21.xml | 2 +- lib/test/float/floatTest.th | 2 ++ lib/test/int/Schema11.xml | 2 +- lib/test/int/intTest.th | 2 ++ 14 files changed, 102 insertions(+), 5 deletions(-) diff --git a/lib/include/commsdsl/FloatField.h b/lib/include/commsdsl/FloatField.h index 359805b1..9666fb69 100644 --- a/lib/include/commsdsl/FloatField.h +++ b/lib/include/commsdsl/FloatField.h @@ -70,6 +70,8 @@ class COMMSDSL_API FloatField : public Field bool validCheckVersion() const; Units units() const; unsigned displayDecimals() const; + bool displaySpecials() const; + bool hasNonUniqueSpecials() const; }; inline diff --git a/lib/include/commsdsl/IntField.h b/lib/include/commsdsl/IntField.h index c480eeec..a70dcbb0 100644 --- a/lib/include/commsdsl/IntField.h +++ b/lib/include/commsdsl/IntField.h @@ -89,6 +89,7 @@ class COMMSDSL_API IntField : public Field unsigned displayDecimals() const; std::intmax_t displayOffset() const; bool signExt() const; + bool displaySpecials() const; }; inline diff --git a/lib/src/FloatField.cpp b/lib/src/FloatField.cpp index 0b656785..557da2d8 100644 --- a/lib/src/FloatField.cpp +++ b/lib/src/FloatField.cpp @@ -84,4 +84,14 @@ unsigned FloatField::displayDecimals() const return cast(m_pImpl)->displayDecimals(); } +bool FloatField::displaySpecials() const +{ + return cast(m_pImpl)->displaySpecials(); +} + +bool FloatField::hasNonUniqueSpecials() const +{ + return cast(m_pImpl)->hasNonUniqueSpecials(); +} + } // namespace commsdsl diff --git a/lib/src/FloatFieldImpl.cpp b/lib/src/FloatFieldImpl.cpp index 543b0666..94dfb42e 100644 --- a/lib/src/FloatFieldImpl.cpp +++ b/lib/src/FloatFieldImpl.cpp @@ -109,6 +109,43 @@ FloatFieldImpl::FloatFieldImpl(xmlNodePtr node, ProtocolImpl& protocol) m_state.m_nonUniqueSpecialsAllowed = !protocol.isNonUniqueSpecialsAllowedSupported(); } +bool FloatFieldImpl::hasNonUniqueSpecials() const +{ + if (!m_state.m_nonUniqueSpecialsAllowed) { + return false; + } + + + std::vector specValues; + specValues.reserve(m_state.m_specials.size()); + + for (auto& s : m_state.m_specials) { + if (std::isnan(s.second.m_value)) { + continue; + } + + specValues.push_back(s.second.m_value); + } + + if ((specValues.size() + 1U) < m_state.m_specials.size()) { + // More than one NaN inside + return true; + } + + std::sort(specValues.begin(), specValues.end()); + + bool firstValue = true; + double prevValue = 0.0; + for (auto s : specValues) { + if ((!firstValue) && (prevValue == s)) { + return true; + } + firstValue = false; + prevValue = s; + } + return false; +} + FieldImpl::Kind FloatFieldImpl::kindImpl() const { return Kind::Float; @@ -136,6 +173,7 @@ const XmlWrap::NamesList&FloatFieldImpl::extraPropsNamesImpl() const common::unitsStr(), common::displayDesimalsStr(), common::nonUniqueSpecialsAllowedStr(), + common::displaySpecialsStr(), }; return List; @@ -171,7 +209,8 @@ bool FloatFieldImpl::parseImpl() updateValidCheckVersion() && updateValidRanges() && updateUnits() && - updateDisplayDecimals(); + updateDisplayDecimals() && + updateDisplaySpecials(); } std::size_t FloatFieldImpl::minLengthImpl() const @@ -635,6 +674,11 @@ bool FloatFieldImpl::updateDisplayDecimals() return true; } +bool FloatFieldImpl::updateDisplaySpecials() +{ + return validateAndUpdateBoolPropValue(common::displaySpecialsStr(), m_state.m_displaySpecials); +} + bool FloatFieldImpl::checkFullRangeAsAttr(const FieldImpl::PropsMap& xmlAttrs) { auto iter = xmlAttrs.find(common::validFullRangeStr()); diff --git a/lib/src/FloatFieldImpl.h b/lib/src/FloatFieldImpl.h index 4ca70794..e2f6b74a 100644 --- a/lib/src/FloatFieldImpl.h +++ b/lib/src/FloatFieldImpl.h @@ -81,6 +81,13 @@ class FloatFieldImpl : public FieldImpl return m_state.m_displayDecimals; } + unsigned displaySpecials() const + { + return m_state.m_displaySpecials; + } + + bool hasNonUniqueSpecials() const; + protected: virtual Kind kindImpl() const override final; virtual Ptr cloneImpl() const override final; @@ -104,6 +111,7 @@ class FloatFieldImpl : public FieldImpl bool updateSpecials(); bool updateUnits(); bool updateDisplayDecimals(); + bool updateDisplaySpecials(); bool checkFullRangeAsAttr(const PropsMap& xmlAttrs); bool checkFullRangeAsChild(::xmlNodePtr child); bool checkFullRangeProps(const PropsMap& xmlAttrs); @@ -141,6 +149,7 @@ class FloatFieldImpl : public FieldImpl unsigned m_displayDecimals = 0U; bool m_validCheckVersion = false; bool m_nonUniqueSpecialsAllowed = false; + bool m_displaySpecials = true; }; State m_state; diff --git a/lib/src/IntField.cpp b/lib/src/IntField.cpp index e4b84977..e8270806 100644 --- a/lib/src/IntField.cpp +++ b/lib/src/IntField.cpp @@ -114,4 +114,9 @@ bool IntField::signExt() const return cast(m_pImpl)->signExt(); } +bool IntField::displaySpecials() const +{ + return cast(m_pImpl)->displaySpecials(); +} + } // namespace commsdsl diff --git a/lib/src/IntFieldImpl.cpp b/lib/src/IntFieldImpl.cpp index 6713d180..710a5939 100644 --- a/lib/src/IntFieldImpl.cpp +++ b/lib/src/IntFieldImpl.cpp @@ -334,7 +334,8 @@ const XmlWrap::NamesList& IntFieldImpl::extraPropsNamesImpl() const common::nonUniqueSpecialsAllowedStr(), common::displayDesimalsStr(), common::displayOffsetStr(), - common::signExtStr() + common::signExtStr(), + common::displaySpecialsStr(), }; return List; @@ -375,7 +376,8 @@ bool IntFieldImpl::parseImpl() updateUnits() && updateDisplayDecimals() && updateDisplayOffset() && - updateSignExt(); + updateSignExt() && + updateDisplaySpecials(); } std::size_t IntFieldImpl::minLengthImpl() const @@ -1222,6 +1224,12 @@ bool IntFieldImpl::updateSignExt() return true; } +bool IntFieldImpl::updateDisplaySpecials() +{ + return validateAndUpdateBoolPropValue(common::displaySpecialsStr(), m_state.m_displaySpecials); +} + + bool IntFieldImpl::checkValidRangeAsAttr(const FieldImpl::PropsMap& xmlAttrs) { auto iter = xmlAttrs.find(common::validRangeStr()); diff --git a/lib/src/IntFieldImpl.h b/lib/src/IntFieldImpl.h index 10c2d510..ad3f50a5 100644 --- a/lib/src/IntFieldImpl.h +++ b/lib/src/IntFieldImpl.h @@ -112,6 +112,11 @@ class IntFieldImpl : public FieldImpl return m_state.m_signExt; } + bool displaySpecials() const + { + return m_state.m_displaySpecials; + } + static Type parseTypeValue(const std::string& value); static std::size_t maxTypeLength(Type t); @@ -160,6 +165,7 @@ class IntFieldImpl : public FieldImpl bool updateDisplayDecimals(); bool updateDisplayOffset(); bool updateSignExt(); + bool updateDisplaySpecials(); bool checkValidRangeAsAttr(const PropsMap& xmlAttrs); bool checkValidRangeAsChild(::xmlNodePtr child); bool checkValidRangeProps(const PropsMap& xmlAttrs); @@ -197,6 +203,7 @@ class IntFieldImpl : public FieldImpl bool m_validCheckVersion = false; bool m_signExt = true; bool m_nonUniqueSpecialsAllowed = false; + bool m_displaySpecials = true; }; State m_state; diff --git a/lib/src/common.cpp b/lib/src/common.cpp index b77dcea0..de467781 100644 --- a/lib/src/common.cpp +++ b/lib/src/common.cpp @@ -693,6 +693,12 @@ const std::string& displayIdxReadOnlyHiddenStr() return Str; } +const std::string& displaySpecialsStr() +{ + static const std::string Str("displaySpecials"); + return Str; +} + unsigned strToUnsigned(const std::string& str, bool* ok, int base) { unsigned result = 0U; diff --git a/lib/src/common.h b/lib/src/common.h index 584b01bf..7862dadf 100644 --- a/lib/src/common.h +++ b/lib/src/common.h @@ -142,6 +142,7 @@ const std::string& serverStr(); const std::string& bothStr(); const std::string& defaultMemberStr(); const std::string& displayIdxReadOnlyHiddenStr(); +const std::string& displaySpecialsStr(); unsigned strToUnsigned(const std::string& str, bool* ok = nullptr, int base = 0); std::intmax_t strToIntMax(const std::string& str, bool* ok = nullptr, int base = 0); diff --git a/lib/test/float/Schema21.xml b/lib/test/float/Schema21.xml index 0e600f3c..54e873da 100644 --- a/lib/test/float/Schema21.xml +++ b/lib/test/float/Schema21.xml @@ -18,7 +18,7 @@ - + diff --git a/lib/test/float/floatTest.th b/lib/test/float/floatTest.th index 1b029d65..4ab254fc 100644 --- a/lib/test/float/floatTest.th +++ b/lib/test/float/floatTest.th @@ -743,6 +743,7 @@ void FloatTestSuite::test21() TS_ASSERT_EQUALS(field.kind(), commsdsl::Field::Kind::Float); commsdsl::FloatField floatField(field); + TS_ASSERT(!floatField.displaySpecials()); TS_ASSERT(std::isnan(floatField.defaultValue())); auto& specialValues = floatField.specialValues(); @@ -789,6 +790,7 @@ void FloatTestSuite::test24() TS_ASSERT_EQUALS(field.kind(), commsdsl::Field::Kind::Float); commsdsl::FloatField floatField(field); + TS_ASSERT(floatField.displaySpecials()); auto& specialValues = floatField.specialValues(); TS_ASSERT_EQUALS(specialValues.size(), 3U); auto s1 = specialValues.find("S1"); diff --git a/lib/test/int/Schema11.xml b/lib/test/int/Schema11.xml index 16ee19eb..c359b9fc 100644 --- a/lib/test/int/Schema11.xml +++ b/lib/test/int/Schema11.xml @@ -4,7 +4,7 @@ endian="little"> - + diff --git a/lib/test/int/intTest.th b/lib/test/int/intTest.th index 42831c79..420b124f 100644 --- a/lib/test/int/intTest.th +++ b/lib/test/int/intTest.th @@ -1023,6 +1023,7 @@ void IntTestSuite::test11() TS_ASSERT_EQUALS(field.kind(), commsdsl::Field::Kind::Int); commsdsl::IntField intField(field); + TS_ASSERT(!intField.displaySpecials()); auto scaling = intField.scaling(); auto& validRanges = intField.validRanges(); auto& specialValues = intField.specialValues(); @@ -1819,6 +1820,7 @@ void IntTestSuite::test40() TS_ASSERT_EQUALS(intField.defaultValue(), 1); auto& specialValues = intField.specialValues(); TS_ASSERT_EQUALS(specialValues.find("S1")->second.m_value, 10); + TS_ASSERT(intField.displaySpecials()); } void IntTestSuite::test41() From c6c0a63f9974f5a258159d8265d053d59a60ba0b Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Fri, 13 Sep 2019 07:57:26 +1000 Subject: [PATCH 10/13] Introducing support for special values print in generated code. --- app/commsdsl2comms/src/FloatField.cpp | 109 ++++++++++++++++++++++- app/commsdsl2comms/src/IntField.cpp | 28 ++++++ app/commsdsl2comms/test/test4/Schema.xml | 1 + app/commsdsl2comms/test/test9/Schema.xml | 2 +- lib/src/FloatFieldImpl.h | 2 +- 5 files changed, 138 insertions(+), 4 deletions(-) diff --git a/app/commsdsl2comms/src/FloatField.cpp b/app/commsdsl2comms/src/FloatField.cpp index 66c3d805..fbe9d642 100644 --- a/app/commsdsl2comms/src/FloatField.cpp +++ b/app/commsdsl2comms/src/FloatField.cpp @@ -18,6 +18,8 @@ #include #include #include +#include +#include #include @@ -332,13 +334,116 @@ std::string FloatField::getClassDefinitionImpl( std::string FloatField::getPluginPropertiesImpl(bool serHiddenParam) const { static_cast(serHiddenParam); + common::StringsList props; auto obj = floatFieldDslObj(); auto decimals = obj.displayDecimals(); - if (decimals == 0U) { + if (decimals != 0U) { + props.push_back(".decimals(" + common::numToString(decimals) + ")"); + } + + do { + if (!obj.displaySpecials()) { + break; + } + + auto& specials = obj.specialValues(); + if (specials.empty()) { + break; + } + + auto addSpecDisplayNameFunc = + [&props](double val, const std::string& name, const std::string& displayName) + { + std::string valStr = std::to_string(val); + if (std::isnan(val)) { + valStr = "std::numeric_limits::quiet_NaN()"; + } + else if (std::isinf(val)) { + valStr = "std::numeric_limits::infinity()"; + if (val < 0.0) { + valStr = '-' + valStr; + } + } + + auto* nameToAdd = &displayName; + if (nameToAdd->empty()) { + nameToAdd = &name; + } + + props.push_back(".addSpecial(\"" + *nameToAdd + "\", " + valStr + ")"); + }; + + for (auto& s : specials) { + addSpecDisplayNameFunc(s.second.m_value, s.first, s.second.m_displayName); + } + break; + + // The code below removes duplicates, but probably not needed. +// if (!obj.hasNonUniqueSpecials()) { +// for (auto& s : specials) { +// addSpecDisplayNameFunc(s.second.m_value, s.first, s.second.m_displayName); +// } +// break; +// } + +// using SpecialsDisplayMap = std::multimap >; +// using SpecialsValuesSet = std::set; +// using SpecialsNanList = std::vector >; + +// SpecialsDisplayMap displayMap; +// SpecialsValuesSet specialsSet; +// SpecialsNanList specialNans; +// for (auto& s : specials) { +// if (std::isnan(s.second.m_value)) { +// specialNans.push_back(std::make_pair(&s.first, &s.second.m_displayName)); +// continue; +// } + +// specialsSet.insert(s.second.m_value); +// displayMap.insert(std::make_pair(s.second.m_value, std::make_pair(&s.first, &s.second.m_displayName))); +// } + +// if (!specialNans.empty()) { +// auto nanIter = +// std::find_if( +// specialNans.begin(), specialNans.end(), +// [](auto& elem) +// { +// return !elem.second->empty(); +// }); + +// if (nanIter == specialNans.end()) { +// nanIter = specialNans.begin(); +// } + +// assert(nanIter != specialNans.end()); +// addSpecDisplayNameFunc(std::numeric_limits::quiet_NaN(), *nanIter->first, *nanIter->second); +// } + +// for (auto val : specialsSet) { +// auto mapIter = displayMap.equal_range(val); +// assert(mapIter.first != mapIter.second); +// auto iter = +// std::find_if( +// mapIter.first, mapIter.second, +// [](auto& elem) +// { +// return !elem.second.second->empty(); // displayName is not empty +// }); +// if (iter == mapIter.second) { +// iter = mapIter.first; +// } + +// addSpecDisplayNameFunc(val, *(iter->second.first), *(iter->second.second)); +// } + + } while (false); + + if (props.empty()) { return common::emptyString(); } + return common::listToString(props, "\n", common::emptyString()); - return ".decimals(" + common::numToString(decimals) + ")"; } std::string FloatField::getFieldBaseParams() const diff --git a/app/commsdsl2comms/src/IntField.cpp b/app/commsdsl2comms/src/IntField.cpp index d687cfdf..bca732ba 100644 --- a/app/commsdsl2comms/src/IntField.cpp +++ b/app/commsdsl2comms/src/IntField.cpp @@ -401,6 +401,34 @@ std::string IntField::getPluginPropertiesImpl(bool serHiddenParam) const props.push_back(".displayOffset(" + common::numToString(offset) + ')'); } + auto& specials = obj.specialValues(); + if (!specials.empty() && (obj.displaySpecials())) { + auto type = obj.type(); + bool bigUnsigned = + (type == commsdsl::IntField::Type::Uint64) || + (type == commsdsl::IntField::Type::Uintvar); + + auto addSpecDisplayNameFunc = + [&props, bigUnsigned](std::intmax_t val, const std::string& name, const std::string& displayName) + { + auto valStr = common::numToString(val); + if (bigUnsigned) { + valStr = "static_cast(" + common::numToString(static_cast(val)) + ")"; + } + + auto* nameToAdd = &displayName; + if (nameToAdd->empty()) { + nameToAdd = &name; + } + + props.push_back(".addSpecial(\"" + *nameToAdd + "\", " + valStr + ")"); + }; + + for (auto& s : specials) { + addSpecDisplayNameFunc(s.second.m_value, s.first, s.second.m_displayName); + } + } + if (props.empty()) { return common::emptyString(); } diff --git a/app/commsdsl2comms/test/test4/Schema.xml b/app/commsdsl2comms/test/test4/Schema.xml index 39d7f850..a2a17216 100644 --- a/app/commsdsl2comms/test/test4/Schema.xml +++ b/app/commsdsl2comms/test/test4/Schema.xml @@ -15,6 +15,7 @@ + diff --git a/app/commsdsl2comms/test/test9/Schema.xml b/app/commsdsl2comms/test/test9/Schema.xml index 73033776..af9da22b 100644 --- a/app/commsdsl2comms/test/test9/Schema.xml +++ b/app/commsdsl2comms/test/test9/Schema.xml @@ -11,7 +11,7 @@ - + diff --git a/lib/src/FloatFieldImpl.h b/lib/src/FloatFieldImpl.h index e2f6b74a..eb54a30a 100644 --- a/lib/src/FloatFieldImpl.h +++ b/lib/src/FloatFieldImpl.h @@ -81,7 +81,7 @@ class FloatFieldImpl : public FieldImpl return m_state.m_displayDecimals; } - unsigned displaySpecials() const + bool displaySpecials() const { return m_state.m_displaySpecials; } From 52418f7beddf704e1cd58adb5901a21e8f09dae8 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Fri, 13 Sep 2019 16:29:52 +1000 Subject: [PATCH 11/13] Fixing gcc-7 release build. --- app/commsdsl2comms/src/FloatField.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/commsdsl2comms/src/FloatField.cpp b/app/commsdsl2comms/src/FloatField.cpp index fbe9d642..ea51dba5 100644 --- a/app/commsdsl2comms/src/FloatField.cpp +++ b/app/commsdsl2comms/src/FloatField.cpp @@ -354,7 +354,7 @@ std::string FloatField::getPluginPropertiesImpl(bool serHiddenParam) const auto addSpecDisplayNameFunc = [&props](double val, const std::string& name, const std::string& displayName) { - std::string valStr = std::to_string(val); + std::string valStr; if (std::isnan(val)) { valStr = "std::numeric_limits::quiet_NaN()"; } @@ -364,6 +364,9 @@ std::string FloatField::getPluginPropertiesImpl(bool serHiddenParam) const valStr = '-' + valStr; } } + else { + valStr = std::to_string(val); + } auto* nameToAdd = &displayName; if (nameToAdd->empty()) { From e11bd6ad5a268e8348a67a00dfe6cfd7f7d359a6 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Mon, 16 Sep 2019 07:55:38 +1000 Subject: [PATCH 12/13] Introducing usage of "comms::option::HasCustomWrite" option. --- app/commsdsl2comms/src/Field.cpp | 9 +++++++-- app/commsdsl2comms/src/Field.h | 3 ++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/commsdsl2comms/src/Field.cpp b/app/commsdsl2comms/src/Field.cpp index 08530c8e..a76583a0 100644 --- a/app/commsdsl2comms/src/Field.cpp +++ b/app/commsdsl2comms/src/Field.cpp @@ -102,6 +102,7 @@ bool Field::prepare(unsigned parentVersion) m_parentVersion = parentVersion; m_customRead = m_generator.getCustomReadForField(m_externalRef); m_customRefresh = m_generator.getCustomRefreshForField(m_externalRef); + m_customWrite = m_generator.getCustomWriteForField(m_externalRef); return prepareImpl(); } @@ -1073,6 +1074,10 @@ void Field::updateExtraOptions( common::addToList("comms::option::def::HasCustomRefresh", options); } + if (!m_customWrite.empty()) { + common::addToList("comms::option::def::HasCustomWrite", options); + } + if (m_forcedPseudo || m_dslObj.isPseudo()) { common::addToList("comms::option::def::EmptySerialization", options); } @@ -1085,9 +1090,9 @@ const std::string& Field::getCustomRead() const return m_customRead; } -std::string Field::getCustomWrite() const +const std::string& Field::getCustomWrite() const { - return m_generator.getCustomWriteForField(m_externalRef); + return m_customWrite; } std::string Field::getCustomLength() const diff --git a/app/commsdsl2comms/src/Field.h b/app/commsdsl2comms/src/Field.h index ff4bbf69..7cd3c677 100644 --- a/app/commsdsl2comms/src/Field.h +++ b/app/commsdsl2comms/src/Field.h @@ -270,7 +270,7 @@ class Field bool ignoreFailOnInvalid = false) const; const std::string& getCustomRead() const; - std::string getCustomWrite() const; + const std::string& getCustomWrite() const; std::string getCustomLength() const; std::string getCustomValid() const; const std::string& getCustomRefresh() const; @@ -301,6 +301,7 @@ class Field unsigned m_parentVersion = 0U; std::string m_customRead; std::string m_customRefresh; + std::string m_customWrite; bool m_focedFailOnInvalid = false; bool m_forcedPseudo = false; bool m_forcedNoOptionsConfig = false; From 3950e233e8d4495d58e8f1c873de33dee5815db9 Mon Sep 17 00:00:00 2001 From: Alex Robenko Date: Wed, 18 Sep 2019 07:59:15 +1000 Subject: [PATCH 13/13] Using v2.1 of comms_champion by default. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1670a3e0..97b53f2c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -142,7 +142,7 @@ endwhile () include(GNUInstallDirs) if ("${CC_TAG}" STREQUAL "") - set (CC_TAG "develop") + set (CC_TAG "v2.1") endif() add_subdirectory(lib)