diff --git a/include/dbcppp/CApi.h b/include/dbcppp/CApi.h index 7203b061..24c22a0b 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 { + uint64_t from; + uint64_t to; + } dbcppp_ValueRange; typedef struct {} dbcppp_ValueEncodingDescription; DBCPPP_API const dbcppp_Attribute* dbcppp_AttributeCreate( @@ -235,6 +240,11 @@ extern "C" DBCPPP_API const char* dbcppp_SignalName(const dbcppp_Signal* sig); DBCPPP_API dbcppp_ESignalMultiplexer dbcppp_SignalMultiplexerIndicator(const dbcppp_Signal* sig); DBCPPP_API uint64_t dbcppp_SignalMultiplexerSwitchValue(const dbcppp_Signal* sig); + DBCPPP_API uint64_t dbcppp_SignalMultiplexerValues_Size(const dbcppp_Signal* sig); + DBCPPP_API const dbcppp_SignalMultiplexerValue* dbcppp_SignalMultiplexerValues_Get(const dbcppp_Signal* sig, uint64_t i); + DBCPPP_API const char* dbcppp_SignalMultiplexerValue_SwitchName(const dbcppp_SignalMultiplexerValue* mux_val); + DBCPPP_API uint64_t dbcppp_SignalMultiplexerValue_ValueRanges_Size(const dbcppp_SignalMultiplexerValue* mux_val); + DBCPPP_API const dbcppp_ValueRange* dbcppp_SignalMultiplexerValue_ValueRanges_Get(const dbcppp_SignalMultiplexerValue* mux_val, uint64_t i); DBCPPP_API uint64_t dbcppp_SignalStartBit(const dbcppp_Signal* sig); DBCPPP_API uint64_t dbcppp_SignalBitSize(const dbcppp_Signal* sig); DBCPPP_API dbcppp_ESignalByteOrder dbcppp_SignalByteOrder(const dbcppp_Signal* sig); diff --git a/include/dbcppp/SignalMultiplexerValue.h b/include/dbcppp/SignalMultiplexerValue.h index a76e9580..5c69fa95 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 const 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..2cf8a1bb 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) + { + auto sigi = reinterpret_cast(mux_val); + return sigi->SwitchName().c_str(); + } + DBCPPP_API uint64_t dbcppp_SignalMultiplexerValue_ValueRanges_Size(const dbcppp_SignalMultiplexerValue* mux_val) + { + auto sigi = reinterpret_cast(mux_val); + return sigi->ValueRanges_Size(); + } + DBCPPP_API const dbcppp_ValueRange* dbcppp_SignalMultiplexerValue_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..9c9a6013 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 +const std::string& SignalMultiplexerValueImpl::SwitchName() const { return _switch_name; } diff --git a/src/libdbcppp/SignalMultiplexerValueImpl.h b/src/libdbcppp/SignalMultiplexerValueImpl.h index e4e609f6..3ba9342b 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 const 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..50ef7abf 100644 --- a/tests/Catch2.cpp +++ b/tests/Catch2.cpp @@ -3742,6 +3742,10 @@ PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr; #elif defined( CATCH_CONFIG_POSIX_SIGNALS ) +// https://stackoverflow.com/questions/71454588/minsigstksz-error-after-update-in-my-manjaro-linux +#undef MINSIGSTKSZ +#define MINSIGSTKSZ 65536 + namespace Catch { struct SignalDefs {