From 5c895f64223b174af848b766d3b76058fb0f542e Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 10 Nov 2023 22:36:09 -0500 Subject: [PATCH] cpp-common/bt2: use more specific static assertion messages MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The current `LibObjT` must NOT be `const`. static assertion message is pretty generic. For a typical `bt2::ConstXyz` user, `LibObjT` actually means nothing, because she's not using `bt2::CommonXyz` directly, only an alias. Make the message specific, for example: Not available with `bt2::ConstBoolValue`. For example, with: void lel(bt2::ConstBoolValue val) { val = false; } I get: cpp-common/bt2/value.hpp: In instantiation of ‘bt2::CommonBoolValue& bt2::CommonBoolValue::operator=(Value) const [with LibObjT = const bt_value; Value = bool]’: test.cpp:61:11: required from here cpp-common/bt2/value.hpp:349:48: error: static assertion failed: Not available with `bt2::ConstBoolValue`. Signed-off-by: Philippe Proulx Change-Id: I4e96d4dcd1cc345d8b393aea6bb78fbc0000e9ba Reviewed-on: https://review.lttng.org/c/babeltrace/+/11361 Reviewed-by: Simon Marchi --- src/cpp-common/bt2/clock-class.hpp | 14 +-- src/cpp-common/bt2/field-class.hpp | 24 +++-- src/cpp-common/bt2/field.hpp | 35 ++++--- src/cpp-common/bt2/integer-range-set.hpp | 4 +- src/cpp-common/bt2/message.hpp | 18 ++-- src/cpp-common/bt2/trace-ir.hpp | 116 +++++++++++++---------- src/cpp-common/bt2/value.hpp | 45 +++++---- 7 files changed, 150 insertions(+), 106 deletions(-) diff --git a/src/cpp-common/bt2/clock-class.hpp b/src/cpp-common/bt2/clock-class.hpp index b101ee66..589526ed 100644 --- a/src/cpp-common/bt2/clock-class.hpp +++ b/src/cpp-common/bt2/clock-class.hpp @@ -128,7 +128,7 @@ public: void frequency(const std::uint64_t frequency) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstClockClass`."); bt_clock_class_set_frequency(this->libObjPtr(), frequency); } @@ -140,7 +140,7 @@ public: void offset(const ClockClassOffset& offset) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstClockClass`."); bt_clock_class_set_offset(this->libObjPtr(), offset.seconds(), offset.cycles()); } @@ -156,7 +156,7 @@ public: void precision(const std::uint64_t precision) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstClockClass`."); bt_clock_class_set_precision(this->libObjPtr(), precision); } @@ -168,7 +168,7 @@ public: void originIsUnixEpoch(const bool originIsUnixEpoch) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstClockClass`."); bt_clock_class_set_origin_is_unix_epoch(this->libObjPtr(), static_cast(originIsUnixEpoch)); @@ -181,7 +181,7 @@ public: void name(const char * const name) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstClockClass`."); const auto status = bt_clock_class_set_name(this->libObjPtr(), name); @@ -208,7 +208,7 @@ public: void description(const char * const description) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstClockClass`."); const auto status = bt_clock_class_set_description(this->libObjPtr(), description); @@ -252,7 +252,7 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstClockClass`."); bt_clock_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); } diff --git a/src/cpp-common/bt2/field-class.hpp b/src/cpp-common/bt2/field-class.hpp index 5719c053..461321fb 100644 --- a/src/cpp-common/bt2/field-class.hpp +++ b/src/cpp-common/bt2/field-class.hpp @@ -405,7 +405,7 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstFieldClass`."); bt_field_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); } @@ -567,7 +567,8 @@ public: void fieldValueRange(const std::uint64_t n) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstIntegerFieldClass`."); bt_field_class_integer_set_field_value_range(this->libObjPtr(), n); } @@ -579,7 +580,8 @@ public: void preferredDisplayBase(const DisplayBase base) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstIntegerFieldClass`."); bt_field_class_integer_set_preferred_display_base( this->libObjPtr(), static_cast(base)); @@ -1043,7 +1045,8 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStructureFieldClassMember`."); bt_field_class_structure_member_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); @@ -1160,7 +1163,8 @@ public: void appendMember(const char * const name, const FieldClass fc) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStructureFieldClass`."); const auto status = bt_field_class_structure_append_member(this->libObjPtr(), name, fc.libObjPtr()); @@ -1957,7 +1961,8 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstVariantFieldClassOption`."); bt_field_class_variant_option_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); } @@ -2296,7 +2301,8 @@ public: void appendOption(const char * const name, const FieldClass fc) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstVariantWithoutSelectorFieldClass`."); const auto status = bt_field_class_variant_without_selector_append_option( this->libObjPtr(), name, fc.libObjPtr()); @@ -2528,7 +2534,9 @@ public: void appendOption(const char * const name, const FieldClass fc, const typename Option::RangeSet ranges) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert( + !std::is_const::value, + "Not available with `bt2::ConstVariantWithUnsignedIntegerSelectorFieldClass`."); const auto status = _Spec::appendOption(this->libObjPtr(), name, fc.libObjPtr(), ranges.libObjPtr()); diff --git a/src/cpp-common/bt2/field.hpp b/src/cpp-common/bt2/field.hpp index 4c270c2d..187d6a57 100644 --- a/src/cpp-common/bt2/field.hpp +++ b/src/cpp-common/bt2/field.hpp @@ -285,7 +285,7 @@ public: CommonBoolField operator=(const Value val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstBoolField`."); bt_field_bool_set_value(this->libObjPtr(), static_cast(val)); return *this; @@ -372,7 +372,8 @@ public: CommonBitArrayField operator=(const std::uint64_t bits) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstBitArrayField`."); bt_field_bit_array_set_value_as_integer(this->libObjPtr(), bits); return *this; @@ -461,7 +462,8 @@ public: CommonUnsignedIntegerField operator=(const Value val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstUnsignedIntegerField`."); bt_field_integer_unsigned_set_value(this->libObjPtr(), val); return *this; @@ -549,7 +551,8 @@ public: CommonSignedIntegerField operator=(const Value val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstSignedIntegerField`."); bt_field_integer_signed_set_value(this->libObjPtr(), val); return *this; @@ -823,7 +826,8 @@ public: CommonSinglePrecisionRealField operator=(const Value val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstSinglePrecisionRealField`."); bt_field_real_single_precision_set_value(this->libObjPtr(), val); return *this; @@ -901,7 +905,8 @@ public: CommonDoublePrecisionRealField operator=(const Value val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstDoublePrecisionRealField`."); bt_field_real_double_precision_set_value(this->libObjPtr(), val); return *this; @@ -973,7 +978,8 @@ public: CommonStringField operator=(const char * const val) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStringField`."); const auto status = bt_field_string_set_value(this->libObjPtr(), val); @@ -991,7 +997,8 @@ public: void append(const char * const begin, const std::uint64_t len) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStringField`."); const auto status = bt_field_string_append_with_length(this->libObjPtr(), begin, len); @@ -1007,7 +1014,8 @@ public: void clear() const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStringField`."); bt_field_string_clear(this->libObjPtr()); } @@ -1309,7 +1317,8 @@ public: void length(const std::uint64_t length) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstDynamicArrayField`."); const auto status = bt_field_array_dynamic_set_length(this->libObjPtr(), length); @@ -1406,7 +1415,8 @@ public: void hasField(const bool hasField) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstOptionField`."); bt_field_option_set_has_field(this->libObjPtr(), static_cast(hasField)); } @@ -1515,7 +1525,8 @@ public: void selectOption(const std::uint64_t index) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstVariantField`."); static_cast(bt_field_variant_select_option_by_index(this->libObjPtr(), index)); } diff --git a/src/cpp-common/bt2/integer-range-set.hpp b/src/cpp-common/bt2/integer-range-set.hpp index 27f5b003..be0d1b75 100644 --- a/src/cpp-common/bt2/integer-range-set.hpp +++ b/src/cpp-common/bt2/integer-range-set.hpp @@ -198,7 +198,9 @@ public: void addRange(const Value lower, const Value upper) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert( + !std::is_const::value, + "Not available with `bt2::ConstUnsignedIntegerRangeSet` or `bt2::ConstSignedIntegerRangeSet`."); const auto status = _Spec::addRange(this->libObjPtr(), lower, upper); diff --git a/src/cpp-common/bt2/message.hpp b/src/cpp-common/bt2/message.hpp index 2b210518..b3a6355b 100644 --- a/src/cpp-common/bt2/message.hpp +++ b/src/cpp-common/bt2/message.hpp @@ -271,7 +271,8 @@ public: void defaultClockSnapshot(const std::uint64_t val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamBeginningMessage`."); bt_message_stream_beginning_set_default_clock_snapshot(this->libObjPtr(), val); } @@ -387,7 +388,8 @@ public: void defaultClockSnapshot(const std::uint64_t val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamEndMessage`."); bt_message_stream_end_set_default_clock_snapshot(this->libObjPtr(), val); } @@ -504,7 +506,8 @@ public: void defaultClockSnapshot(const std::uint64_t val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstPacketBeginningMessage`."); bt_message_packet_beginning_set_default_clock_snapshot(this->libObjPtr(), val); } @@ -615,7 +618,8 @@ public: void defaultClockSnapshot(const std::uint64_t val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstPacketEndMessage`."); bt_message_packet_end_set_default_clock_snapshot(this->libObjPtr(), val); } @@ -847,7 +851,8 @@ public: void count(const std::uint64_t count) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstDiscardedEventsMessage`."); bt_message_discarded_events_set_count(this->libObjPtr(), count); } @@ -980,7 +985,8 @@ public: void count(const std::uint64_t count) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstDiscardedPacketsMessage`."); bt_message_discarded_packets_set_count(this->libObjPtr(), count); } diff --git a/src/cpp-common/bt2/trace-ir.hpp b/src/cpp-common/bt2/trace-ir.hpp index e0095081..0542cd95 100644 --- a/src/cpp-common/bt2/trace-ir.hpp +++ b/src/cpp-common/bt2/trace-ir.hpp @@ -476,7 +476,7 @@ public: Packet::Shared createPacket() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstStream`."); const auto libObjPtr = bt_packet_create(this->libObjPtr()); @@ -494,7 +494,7 @@ public: void name(const char * const name) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstStream`."); const auto status = bt_stream_set_name(this->libObjPtr(), name); @@ -522,7 +522,7 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstStream`."); bt_stream_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); } @@ -699,7 +699,7 @@ public: void name(const char * const name) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTrace`."); const auto status = bt_trace_set_name(this->libObjPtr(), name); @@ -763,7 +763,7 @@ public: void environmentEntry(const char * const name, const std::int64_t val) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTrace`."); const auto status = bt_trace_set_environment_entry_integer(this->libObjPtr(), name, val); @@ -779,7 +779,7 @@ public: void environmentEntry(const char * const name, const char * const val) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTrace`."); const auto status = bt_trace_set_environment_entry_string(this->libObjPtr(), name, val); @@ -838,7 +838,7 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTrace`."); bt_trace_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); } @@ -1027,7 +1027,7 @@ public: void name(const char * const name) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstEventClass`."); const auto status = bt_event_class_set_name(this->libObjPtr(), name); @@ -1054,7 +1054,7 @@ public: void logLevel(const LogLevel logLevel) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstEventClass`."); bt_event_class_set_log_level(this->libObjPtr(), static_cast(logLevel)); @@ -1074,7 +1074,7 @@ public: void emfUri(const char * const emfUri) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstEventClass`."); const auto status = bt_event_class_set_emf_uri(this->libObjPtr(), emfUri); @@ -1101,7 +1101,7 @@ public: void payloadFieldClass(const StructureFieldClass fc) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstEventClass`."); const auto status = bt_event_class_set_payload_field_class(this->libObjPtr(), fc.libObjPtr()); @@ -1124,7 +1124,7 @@ public: void specificContextFieldClass(const StructureFieldClass fc) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstEventClass`."); const auto status = bt_event_class_set_specific_context_field_class(this->libObjPtr(), fc.libObjPtr()); @@ -1148,7 +1148,7 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstEventClass`."); bt_event_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); } @@ -1354,7 +1354,8 @@ public: Stream::Shared instantiate(const Trace trace) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); const auto libObjPtr = bt_stream_create(this->libObjPtr(), trace.libObjPtr()); @@ -1364,7 +1365,8 @@ public: Stream::Shared instantiate(const Trace trace, const std::uint64_t id) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); const auto libObjPtr = bt_stream_create_with_id(this->libObjPtr(), trace.libObjPtr(), id); @@ -1374,7 +1376,8 @@ public: EventClass::Shared createEventClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); const auto libObjPtr = bt_event_class_create(this->libObjPtr()); @@ -1384,7 +1387,8 @@ public: EventClass::Shared createEventClass(const std::uint64_t id) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); const auto libObjPtr = bt_event_class_create_with_id(this->libObjPtr(), id); @@ -1401,7 +1405,8 @@ public: void name(const char * const name) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); const auto status = bt_stream_class_set_name(this->libObjPtr(), name); @@ -1428,7 +1433,8 @@ public: void assignsAutomaticEventClassId(const bool val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); bt_stream_class_set_assigns_automatic_event_class_id(this->libObjPtr(), static_cast(val)); @@ -1442,7 +1448,8 @@ public: void assignsAutomaticStreamId(const bool val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); bt_stream_class_set_assigns_automatic_stream_id(this->libObjPtr(), static_cast(val)); @@ -1456,7 +1463,8 @@ public: void supportsPackets(const bool supportsPackets, const bool withBeginningDefaultClkSnapshot, const bool withEndDefaultClkSnapshot) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); bt_stream_class_set_supports_packets(this->libObjPtr(), static_cast(supportsPackets), @@ -1484,7 +1492,8 @@ public: void supportsDiscardedEvents(const bool supportsDiscardedEvents, const bool withDefaultClkSnapshots) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); bt_stream_class_set_supports_discarded_events( this->libObjPtr(), static_cast(supportsDiscardedEvents), @@ -1505,7 +1514,8 @@ public: void supportsDiscardedPackets(const bool supportsDiscardedPackets, const bool withDefaultClkSnapshots) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); bt_stream_class_set_supports_discarded_packets( this->libObjPtr(), static_cast(supportsDiscardedPackets), @@ -1525,7 +1535,8 @@ public: void defaultClockClass(const ClockClass clkCls) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); const auto status = bt_stream_class_set_default_clock_class(this->libObjPtr(), clkCls.libObjPtr()); @@ -1567,7 +1578,8 @@ public: void packetContextFieldClass(const StructureFieldClass fc) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); const auto status = bt_stream_class_set_packet_context_field_class(this->libObjPtr(), fc.libObjPtr()); @@ -1590,7 +1602,8 @@ public: void eventCommonContextFieldClass(const StructureFieldClass fc) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); const auto status = bt_stream_class_set_event_common_context_field_class(this->libObjPtr(), fc.libObjPtr()); @@ -1614,7 +1627,8 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStreamClass`."); bt_stream_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); } @@ -1773,7 +1787,7 @@ public: Trace::Shared instantiate() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_trace_create(this->libObjPtr()); @@ -1783,7 +1797,7 @@ public: StreamClass::Shared createStreamClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_stream_class_create(this->libObjPtr()); @@ -1793,7 +1807,7 @@ public: StreamClass::Shared createStreamClass(const std::uint64_t id) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_stream_class_create_with_id(this->libObjPtr(), id); @@ -1803,7 +1817,7 @@ public: FieldClass::Shared createBoolFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_bool_create(this->libObjPtr()); @@ -1813,7 +1827,7 @@ public: BitArrayFieldClass::Shared createBitArrayFieldClass(const std::uint64_t length) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_bit_array_create(this->libObjPtr(), length); @@ -1823,7 +1837,7 @@ public: IntegerFieldClass::Shared createUnsignedIntegerFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_integer_unsigned_create(this->libObjPtr()); @@ -1833,7 +1847,7 @@ public: IntegerFieldClass::Shared createSignedIntegerFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_integer_signed_create(this->libObjPtr()); @@ -1843,7 +1857,7 @@ public: UnsignedEnumerationFieldClass::Shared createUnsignedEnumerationFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_enumeration_unsigned_create(this->libObjPtr()); @@ -1853,7 +1867,7 @@ public: SignedEnumerationFieldClass::Shared createSignedEnumerationFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_enumeration_signed_create(this->libObjPtr()); @@ -1863,7 +1877,7 @@ public: FieldClass::Shared createSinglePrecisionRealFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_real_single_precision_create(this->libObjPtr()); @@ -1873,7 +1887,7 @@ public: FieldClass::Shared createDoublePrecisionRealFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_real_double_precision_create(this->libObjPtr()); @@ -1883,7 +1897,7 @@ public: FieldClass::Shared createStringFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_string_create(this->libObjPtr()); @@ -1894,7 +1908,7 @@ public: StaticArrayFieldClass::Shared createStaticArrayFieldClass(const FieldClass elementFieldClass, const std::uint64_t length) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_array_static_create( this->libObjPtr(), elementFieldClass.libObjPtr(), length); @@ -1905,7 +1919,7 @@ public: ArrayFieldClass::Shared createDynamicArrayFieldClass(const FieldClass elementFieldClass) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_array_dynamic_create( this->libObjPtr(), elementFieldClass.libObjPtr(), nullptr); @@ -1918,7 +1932,7 @@ public: createDynamicArrayFieldClass(const FieldClass elementFieldClass, const IntegerFieldClass lengthFieldClass) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_array_dynamic_create( this->libObjPtr(), elementFieldClass.libObjPtr(), lengthFieldClass.libObjPtr()); @@ -1929,7 +1943,7 @@ public: StructureFieldClass::Shared createStructureFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_structure_create(this->libObjPtr()); @@ -1939,7 +1953,7 @@ public: OptionFieldClass::Shared createOptionFieldClass(const FieldClass optionalFieldClass) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_option_without_selector_create( this->libObjPtr(), optionalFieldClass.libObjPtr()); @@ -1952,7 +1966,7 @@ public: createOptionWithBoolSelectorFieldClass(const FieldClass optionalFieldClass, const FieldClass selectorFieldClass) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_option_with_selector_field_bool_create( this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr()); @@ -1966,7 +1980,7 @@ public: const FieldClass optionalFieldClass, const IntegerFieldClass selectorFieldClass, const ConstUnsignedIntegerRangeSet ranges) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_option_with_selector_field_integer_unsigned_create( this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr(), @@ -1981,7 +1995,7 @@ public: const IntegerFieldClass selectorFieldClass, const ConstSignedIntegerRangeSet ranges) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_option_with_selector_field_integer_signed_create( this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldClass.libObjPtr(), @@ -1993,7 +2007,7 @@ public: VariantWithoutSelectorFieldClass::Shared createVariantFieldClass() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_variant_create(this->libObjPtr(), nullptr); @@ -2019,7 +2033,7 @@ public: void assignsAutomaticStreamClassId(const bool val) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); bt_trace_class_set_assigns_automatic_stream_class_id(this->libObjPtr(), static_cast(val)); @@ -2055,7 +2069,7 @@ public: template void userAttributes(const CommonMapValue userAttrs) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); bt_trace_class_set_user_attributes(this->libObjPtr(), userAttrs.libObjPtr()); } @@ -2075,7 +2089,7 @@ private: typename ObjT::Shared _createVariantWithIntegerSelectorFieldClass(const IntegerFieldClass selectorFieldClass) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); const auto libObjPtr = bt_field_class_variant_create(this->libObjPtr(), selectorFieldClass.libObjPtr()); diff --git a/src/cpp-common/bt2/value.hpp b/src/cpp-common/bt2/value.hpp index 408710c0..c0a60fe2 100644 --- a/src/cpp-common/bt2/value.hpp +++ b/src/cpp-common/bt2/value.hpp @@ -329,7 +329,7 @@ public: CommonBoolValue operator=(const Value rawVal) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstBoolValue`."); bt_value_bool_set(this->libObjPtr(), static_cast(rawVal)); return *this; @@ -409,7 +409,8 @@ public: CommonUnsignedIntegerValue& operator=(const CommonUnsignedIntegerValue val) noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstUnsignedIntegerValue`."); _ThisCommonValue::operator=(val); return *this; @@ -511,7 +512,8 @@ public: CommonSignedIntegerValue operator=(const Value rawVal) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstSignedIntegerValue`."); bt_value_integer_signed_set(this->libObjPtr(), rawVal); return *this; @@ -599,7 +601,7 @@ public: CommonRealValue operator=(const Value rawVal) const noexcept { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstRealValue`."); bt_value_real_set(this->libObjPtr(), rawVal); return *this; @@ -691,7 +693,8 @@ public: CommonStringValue operator=(const char * const rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, + "Not available with `bt2::ConstStringValue`."); const auto status = bt_value_string_set(this->libObjPtr(), rawVal); @@ -834,7 +837,7 @@ public: void append(const Value val) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstArrayValue`."); const auto status = bt_value_array_append_element(this->libObjPtr(), val.libObjPtr()); @@ -843,7 +846,7 @@ public: void append(const bool rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstArrayValue`."); const auto status = bt_value_array_append_bool_element(this->libObjPtr(), static_cast(rawVal)); @@ -853,7 +856,7 @@ public: void append(const std::uint64_t rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstArrayValue`."); const auto status = bt_value_array_append_unsigned_integer_element(this->libObjPtr(), rawVal); @@ -863,7 +866,7 @@ public: void append(const std::int64_t rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstArrayValue`."); const auto status = bt_value_array_append_signed_integer_element(this->libObjPtr(), rawVal); @@ -872,7 +875,7 @@ public: void append(const double rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstArrayValue`."); const auto status = bt_value_array_append_real_element(this->libObjPtr(), rawVal); @@ -881,7 +884,7 @@ public: void append(const char * const rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstArrayValue`."); const auto status = bt_value_array_append_string_element(this->libObjPtr(), rawVal); @@ -1148,7 +1151,7 @@ public: void insert(const char * const key, const Value val) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); const auto status = bt_value_map_insert_entry(this->libObjPtr(), key, val.libObjPtr()); @@ -1162,7 +1165,7 @@ public: void insert(const char * const key, const bool rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); const auto status = bt_value_map_insert_bool_entry(this->libObjPtr(), key, static_cast(rawVal)); @@ -1177,7 +1180,7 @@ public: void insert(const char * const key, const std::uint64_t rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); const auto status = bt_value_map_insert_unsigned_integer_entry(this->libObjPtr(), key, rawVal); @@ -1192,7 +1195,7 @@ public: void insert(const char * const key, const std::int64_t rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); const auto status = bt_value_map_insert_signed_integer_entry(this->libObjPtr(), key, rawVal); @@ -1207,7 +1210,7 @@ public: void insert(const char * const key, const double rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); const auto status = bt_value_map_insert_real_entry(this->libObjPtr(), key, rawVal); @@ -1221,7 +1224,7 @@ public: void insert(const char * const key, const char * const rawVal) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); const auto status = bt_value_map_insert_string_entry(this->libObjPtr(), key, rawVal); @@ -1349,7 +1352,7 @@ CommonMapValue CommonValue::asMap() const noexcept template ArrayValue CommonArrayValue::appendEmptyArray() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstArrayValue`."); bt_value *libElemPtr; const auto status = bt_value_array_append_empty_array_element(this->libObjPtr(), &libElemPtr); @@ -1361,7 +1364,7 @@ ArrayValue CommonArrayValue::appendEmptyArray() const template MapValue CommonArrayValue::appendEmptyMap() const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstArrayValue`."); bt_value *libElemPtr; const auto status = bt_value_array_append_empty_map_element(this->libObjPtr(), &libElemPtr); @@ -1373,7 +1376,7 @@ MapValue CommonArrayValue::appendEmptyMap() const template ArrayValue CommonMapValue::insertEmptyArray(const char * const key) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); bt_value *libEntryPtr; const auto status = bt_value_map_insert_empty_array_entry(this->libObjPtr(), key, &libEntryPtr); @@ -1391,7 +1394,7 @@ ArrayValue CommonMapValue::insertEmptyArray(const std::string& key) con template MapValue CommonMapValue::insertEmptyMap(const char * const key) const { - static_assert(!std::is_const::value, "`LibObjT` must NOT be `const`."); + static_assert(!std::is_const::value, "Not available with `bt2::ConstMapValue`."); bt_value *libEntryPtr; const auto status = bt_value_map_insert_empty_map_entry(this->libObjPtr(), key, &libEntryPtr); -- 2.34.1