diff --git a/include/dbcppp/CApi.h b/include/dbcppp/CApi.h index 7203b061..827021b3 100644 --- a/include/dbcppp/CApi.h +++ b/include/dbcppp/CApi.h @@ -77,6 +77,11 @@ extern "C" typedef struct {} dbcppp_Attribute; typedef struct {} dbcppp_SignalType; typedef struct {} dbcppp_Signal; + typedef struct {} dbcppp_SignalMultiplexerValue; + typedef struct { + size_t from; + size_t to; + } dbcppp_ValueRange; typedef struct {} dbcppp_ValueEncodingDescription; DBCPPP_API const dbcppp_Attribute* dbcppp_AttributeCreate( diff --git a/include/dbcppp/SignalMultiplexerValue.h b/include/dbcppp/SignalMultiplexerValue.h index a76e9580..93687d90 100644 --- a/include/dbcppp/SignalMultiplexerValue.h +++ b/include/dbcppp/SignalMultiplexerValue.h @@ -27,7 +27,7 @@ namespace dbcppp virtual std::unique_ptr Clone() const = 0; virtual ~ISignalMultiplexerValue() = default; - virtual std::string SwitchName() const = 0; + virtual std::string& SwitchName() const = 0; virtual const Range& ValueRanges_Get(std::size_t i) const = 0; virtual uint64_t ValueRanges_Size() const = 0; diff --git a/src/libdbcppp/CApi.cpp b/src/libdbcppp/CApi.cpp index fccf68d7..c464ba14 100644 --- a/src/libdbcppp/CApi.cpp +++ b/src/libdbcppp/CApi.cpp @@ -54,7 +54,7 @@ extern "C" case IAttributeDefinition::EObjectType::Node: return dbcppp_EObjectType::dbcppp_ObjectType_Node; case IAttributeDefinition::EObjectType::Message: return dbcppp_EObjectType::dbcppp_ObjectType_Message; case IAttributeDefinition::EObjectType::Signal: return dbcppp_EObjectType::dbcppp_ObjectType_Signal; - default: return dbcppp_EObjectType::dbcppp_ObjectType_EnvironmentVariable; + default: return dbcppp_EObjectType::dbcppp_ObjectType_EnvironmentVariable; } } DBCPPP_API dbcppp_EAttributeValueType dbcppp_AttributeValueType(const dbcppp_Attribute* attribute) @@ -88,7 +88,7 @@ extern "C" auto ai = reinterpret_cast(attribute); return std::get(ai->Value()).c_str(); } - + DBCPPP_API dbcppp_AttributeDefinition* dbcppp_AttributeDefinitionCreate( const char* name , dbcppp_EObjectType object_type @@ -879,6 +879,31 @@ extern "C" auto sigi = reinterpret_cast(sig); return sigi->MultiplexerSwitchValue(); } + DBCPPP_API uint64_t dbcppp_SignalMultiplexerValues_Size(const dbcppp_Signal* sig) + { + auto sigi = reinterpret_cast(sig); + return sigi->SignalMultiplexerValues_Size(); + } + DBCPPP_API const dbcppp_SignalMultiplexerValue* dbcppp_SignalMultiplexerValues_Get(const dbcppp_Signal* sig, uint64_t i) + { + auto sigi = reinterpret_cast(sig); + return reinterpret_cast(&sigi->SignalMultiplexerValues_Get(i)); + } + DBCPPP_API const char* dbcppp_SignalMultiplexerValue_SwitchName(const dbcppp_SignalMultiplexerValue* mux_val, uint64_t i) + { + auto sigi = reinterpret_cast(mux_val); + return sigi->SwitchName().c_str(); + } + DBCPPP_API uint64_t dbcppp_ValueRanges_Size(const dbcppp_SignalMultiplexerValue* mux_val) + { + auto sigi = reinterpret_cast(mux_val); + return sigi->ValueRanges_Size(); + } + DBCPPP_API const dbcppp_ValueRange* dbcppp_ValueRanges_Get(const dbcppp_SignalMultiplexerValue* mux_val, uint64_t i) + { + auto sigi = reinterpret_cast(mux_val); + return reinterpret_cast(&sigi->ValueRanges_Get(i)); + } DBCPPP_API uint64_t dbcppp_SignalStartBit(const dbcppp_Signal* sig) { auto sigi = reinterpret_cast(sig); diff --git a/src/libdbcppp/SignalMultiplexerValueImpl.cpp b/src/libdbcppp/SignalMultiplexerValueImpl.cpp index 7e4f07f1..e0178522 100644 --- a/src/libdbcppp/SignalMultiplexerValueImpl.cpp +++ b/src/libdbcppp/SignalMultiplexerValueImpl.cpp @@ -25,7 +25,7 @@ std::unique_ptr SignalMultiplexerValueImpl::Clone() con return std::make_unique(*this); } -std::string SignalMultiplexerValueImpl::SwitchName() const +std::string& SignalMultiplexerValueImpl::SwitchName() const { return _switch_name; } diff --git a/src/libdbcppp/SignalMultiplexerValueImpl.h b/src/libdbcppp/SignalMultiplexerValueImpl.h index e4e609f6..3bc0de67 100644 --- a/src/libdbcppp/SignalMultiplexerValueImpl.h +++ b/src/libdbcppp/SignalMultiplexerValueImpl.h @@ -15,7 +15,7 @@ namespace dbcppp virtual std::unique_ptr Clone() const override; - virtual std::string SwitchName() const override; + virtual std::string& SwitchName() const override; virtual const Range& ValueRanges_Get(std::size_t i) const override; virtual uint64_t ValueRanges_Size() const override; diff --git a/tests/Catch2.cpp b/tests/Catch2.cpp index 7791d9b7..9aeea2cd 100644 --- a/tests/Catch2.cpp +++ b/tests/Catch2.cpp @@ -3751,7 +3751,7 @@ namespace Catch { // 32kb for the alternate stack seems to be sufficient. However, this value // is experimentally determined, so that's not guaranteed. - static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; + static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; static SignalDefs signalDefs[] = { { SIGINT, "SIGINT - Terminal interrupt signal" }, @@ -3807,7 +3807,7 @@ namespace Catch { bool FatalConditionHandler::isSet = false; struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; stack_t FatalConditionHandler::oldSigStack = {}; - char FatalConditionHandler::altStackMem[sigStackSize] = {}; + char FatalConditionHandler::altStackMem[65536] = {}; } // namespace Catch