From: Philippe Proulx Date: Tue, 26 Mar 2024 20:04:49 +0000 (-0400) Subject: src/cpp-common/bt2: wrap variant with selector field loc. FC API X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=24f38be42faca902745fb710cc65390417ceddad;p=babeltrace.git src/cpp-common/bt2: wrap variant with selector field loc. FC API This patch adds what's needed to the C++ libbabeltrace2 wrappers to wrap: * bt_field_class_variant_with_selector_field_borrow_selector_field_location_const() * bt_field_class_variant_with_selector_field_location_integer_unsigned_create() * bt_field_class_variant_with_selector_field_location_integer_signed_create() Signed-off-by: Philippe Proulx Change-Id: Id644771aa9537be21d73ba6cfe97a287c19f7240 Reviewed-on: https://review.lttng.org/c/babeltrace/+/8019 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12702 Tested-by: jenkins CI-Build: Simon Marchi --- diff --git a/src/cpp-common/bt2/field-class.hpp b/src/cpp-common/bt2/field-class.hpp index 2487577b..29d4a384 100644 --- a/src/cpp-common/bt2/field-class.hpp +++ b/src/cpp-common/bt2/field-class.hpp @@ -2426,6 +2426,13 @@ public: this->libObjPtr())}; } + ConstFieldLocation selectorFieldLocation() const noexcept + { + return ConstFieldLocation { + bt_field_class_variant_with_selector_field_borrow_selector_field_location_const( + this->libObjPtr())}; + } + Shared shared() const noexcept { return Shared::createWithRef(*this); diff --git a/src/cpp-common/bt2/trace-ir.hpp b/src/cpp-common/bt2/trace-ir.hpp index 51ad3f8c..5f0d87e1 100644 --- a/src/cpp-common/bt2/trace-ir.hpp +++ b/src/cpp-common/bt2/trace-ir.hpp @@ -2006,6 +2006,18 @@ public: return VariantWithoutSelectorFieldClass::Shared::createWithoutRef(libObjPtr); } + VariantWithoutSelectorFieldClass::Shared + createVariantWithoutSelectorFieldLocationFieldClass() const + { + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); + + const auto libObjPtr = + bt_field_class_variant_without_selector_field_location_create(this->libObjPtr()); + + internal::validateCreatedObjPtr(libObjPtr); + return VariantWithoutSelectorFieldClass::Shared::createWithoutRef(libObjPtr); + } + VariantWithUnsignedIntegerSelectorFieldClass::Shared createVariantWithUnsignedIntegerSelectorFieldClass( const IntegerFieldClass selectorFieldClass) const @@ -2014,6 +2026,20 @@ public: VariantWithUnsignedIntegerSelectorFieldClass>(selectorFieldClass); } + VariantWithUnsignedIntegerSelectorFieldClass::Shared + createVariantWithUnsignedIntegerSelectorFieldLocationFieldClass( + const ConstFieldLocation selectorFieldLocation) const + { + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); + + const auto libObjPtr = + bt_field_class_variant_with_selector_field_location_integer_unsigned_create( + this->libObjPtr(), selectorFieldLocation.libObjPtr()); + + internal::validateCreatedObjPtr(libObjPtr); + return VariantWithUnsignedIntegerSelectorFieldClass::Shared::createWithoutRef(libObjPtr); + } + VariantWithSignedIntegerSelectorFieldClass::Shared createVariantWithSignedIntegerSelectorFieldClass( const IntegerFieldClass selectorFieldClass) const @@ -2022,6 +2048,20 @@ public: VariantWithSignedIntegerSelectorFieldClass>(selectorFieldClass); } + VariantWithSignedIntegerSelectorFieldClass::Shared + createVariantWithSignedIntegerSelectorFieldLocationFieldClass( + const ConstFieldLocation selectorFieldLocation) const + { + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); + + const auto libObjPtr = + bt_field_class_variant_with_selector_field_location_integer_signed_create( + this->libObjPtr(), selectorFieldLocation.libObjPtr()); + + internal::validateCreatedObjPtr(libObjPtr); + return VariantWithSignedIntegerSelectorFieldClass::Shared::createWithoutRef(libObjPtr); + } + CommonTraceClass assignsAutomaticStreamClassId(const bool val) const noexcept { static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`.");