From 49b6aa6e5e9caf52305cb1cec8b8dc9aa7273b78 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 11 May 2022 12:21:15 -0400 Subject: [PATCH] src/cpp-common/bt2: wrap option with selector field loc. FC API This patch adds what's needed to the C++ libbabeltrace2 wrappers to wrap: * bt_field_class_option_with_selector_field_borrow_selector_field_location_const() * bt_field_class_option_without_selector_field_location_create() * bt_field_class_option_with_selector_field_location_bool_create() * bt_field_class_option_with_selector_field_location_integer_unsigned_create() * bt_field_class_option_with_selector_field_location_integer_signed_create() Signed-off-by: Philippe Proulx Change-Id: Iaf20856ee2533a061560abf79c91a69b2dab20b5 Reviewed-on: https://review.lttng.org/c/babeltrace/+/8018 Reviewed-on: https://review.lttng.org/c/babeltrace/+/12701 CI-Build: Simon Marchi Tested-by: jenkins --- src/cpp-common/bt2/field-class.hpp | 7 ++++ src/cpp-common/bt2/trace-ir.hpp | 56 ++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) diff --git a/src/cpp-common/bt2/field-class.hpp b/src/cpp-common/bt2/field-class.hpp index a60b1332..2487577b 100644 --- a/src/cpp-common/bt2/field-class.hpp +++ b/src/cpp-common/bt2/field-class.hpp @@ -1608,6 +1608,13 @@ public: this->libObjPtr())}; } + ConstFieldLocation selectorFieldLocation() const noexcept + { + return ConstFieldLocation { + bt_field_class_option_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 67b381c4..51ad3f8c 100644 --- a/src/cpp-common/bt2/trace-ir.hpp +++ b/src/cpp-common/bt2/trace-ir.hpp @@ -1897,6 +1897,18 @@ public: return OptionFieldClass::Shared::createWithoutRef(libObjPtr); } + OptionFieldClass::Shared + createOptionWithoutSelectorFieldLocationFieldClass(const FieldClass optionalFieldClass) const + { + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); + + const auto libObjPtr = bt_field_class_option_without_selector_field_location_create( + this->libObjPtr(), optionalFieldClass.libObjPtr()); + + internal::validateCreatedObjPtr(libObjPtr); + return OptionFieldClass::Shared::createWithoutRef(libObjPtr); + } + OptionWithBoolSelectorFieldClass::Shared createOptionWithBoolSelectorFieldClass(const FieldClass optionalFieldClass, const FieldClass selectorFieldClass) const @@ -1910,6 +1922,18 @@ public: return OptionWithBoolSelectorFieldClass::Shared::createWithoutRef(libObjPtr); } + OptionWithBoolSelectorFieldClass::Shared createOptionWithBoolSelectorFieldLocationFieldClass( + const FieldClass optionalFieldClass, const ConstFieldLocation selectorFieldLocation) const + { + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); + + const auto libObjPtr = bt_field_class_option_with_selector_field_location_bool_create( + this->libObjPtr(), optionalFieldClass.libObjPtr(), selectorFieldLocation.libObjPtr()); + + internal::validateCreatedObjPtr(libObjPtr); + return OptionWithBoolSelectorFieldClass::Shared::createWithoutRef(libObjPtr); + } + OptionWithUnsignedIntegerSelectorFieldClass::Shared createOptionWithUnsignedIntegerSelectorFieldClass( const FieldClass optionalFieldClass, const IntegerFieldClass selectorFieldClass, @@ -1925,6 +1949,22 @@ public: return OptionWithUnsignedIntegerSelectorFieldClass::Shared::createWithoutRef(libObjPtr); } + OptionWithUnsignedIntegerSelectorFieldClass::Shared + createOptionWithUnsignedIntegerSelectorFieldLocationFieldClass( + const FieldClass optionalFieldClass, const ConstFieldLocation selectorFieldLocation, + const ConstUnsignedIntegerRangeSet ranges) const + { + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); + + const auto libObjPtr = + bt_field_class_option_with_selector_field_location_integer_unsigned_create( + this->libObjPtr(), optionalFieldClass.libObjPtr(), + selectorFieldLocation.libObjPtr(), ranges.libObjPtr()); + + internal::validateCreatedObjPtr(libObjPtr); + return OptionWithUnsignedIntegerSelectorFieldClass::Shared::createWithoutRef(libObjPtr); + } + OptionWithSignedIntegerSelectorFieldClass::Shared createOptionWithSignedIntegerSelectorFieldClass(const FieldClass optionalFieldClass, const IntegerFieldClass selectorFieldClass, @@ -1940,6 +1980,22 @@ public: return OptionWithSignedIntegerSelectorFieldClass::Shared::createWithoutRef(libObjPtr); } + OptionWithSignedIntegerSelectorFieldClass::Shared + createOptionWithSignedIntegerSelectorFieldLocationFieldClass( + const FieldClass optionalFieldClass, const ConstFieldLocation selectorFieldLocation, + const ConstSignedIntegerRangeSet ranges) const + { + static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); + + const auto libObjPtr = + bt_field_class_option_with_selector_field_location_integer_signed_create( + this->libObjPtr(), optionalFieldClass.libObjPtr(), + selectorFieldLocation.libObjPtr(), ranges.libObjPtr()); + + internal::validateCreatedObjPtr(libObjPtr); + return OptionWithSignedIntegerSelectorFieldClass::Shared::createWithoutRef(libObjPtr); + } + VariantWithoutSelectorFieldClass::Shared createVariantFieldClass() const { static_assert(!std::is_const::value, "Not available with `bt2::ConstTraceClass`."); -- 2.34.1