src/cpp-common/bt2: wrap dynamic array with length field loc. FC API
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 7 Dec 2023 20:26:27 +0000 (20:26 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
This patch adds what's needed to the C++ libbabeltrace2 wrappers to
wrap:

* bt_field_class_array_dynamic_with_length_field_borrow_length_field_location_const()
* bt_field_class_array_dynamic_without_length_field_location_create()
* bt_field_class_array_dynamic_with_length_field_location_create()

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I7d731807165e22de9ec97d9cd83ec75e02c759b1
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8017
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12700
Tested-by: jenkins <jenkins@lttng.org>
CI-Build: Simon Marchi <simon.marchi@efficios.com>

src/cpp-common/bt2/field-class.hpp
src/cpp-common/bt2/trace-ir.hpp

index 71e32e411d2d43cb5d19ed411b41383aa82488bc..a60b1332acaf1852b151b1187f4f9c8c3038a0ca 100644 (file)
@@ -19,6 +19,7 @@
 #include "borrowed-object-iterator.hpp"
 #include "borrowed-object.hpp"
 #include "exc.hpp"
+#include "field-location.hpp"
 #include "field-path.hpp"
 #include "integer-range-set.hpp"
 #include "internal/utils.hpp"
@@ -1425,6 +1426,13 @@ public:
                 this->libObjPtr())};
     }
 
+    ConstFieldLocation lengthFieldLocation() const noexcept
+    {
+        return ConstFieldLocation {
+            bt_field_class_array_dynamic_with_length_field_borrow_length_field_location_const(
+                this->libObjPtr())};
+    }
+
     Shared shared() const noexcept
     {
         return Shared::createWithRef(*this);
index 8972bd2247068e70a6fcda2cd7c1e9e378db263e..67b381c4b3368ee77dd4d13fe5695fff56679d13 100644 (file)
@@ -1852,6 +1852,30 @@ public:
         return DynamicArrayWithLengthFieldClass::Shared::createWithoutRef(libObjPtr);
     }
 
+    ArrayFieldClass::Shared
+    createDynamicArrayWithoutLengthFieldLocationFieldClass(const FieldClass elementFieldClass) const
+    {
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
+
+        const auto libObjPtr = bt_field_class_array_dynamic_without_length_field_location_create(
+            this->libObjPtr(), elementFieldClass.libObjPtr());
+
+        internal::validateCreatedObjPtr(libObjPtr);
+        return ArrayFieldClass::Shared::createWithoutRef(libObjPtr);
+    }
+
+    DynamicArrayWithLengthFieldClass::Shared createDynamicArrayWithLengthFieldLocationFieldClass(
+        const FieldClass elementFieldClass, const ConstFieldLocation lengthFieldLocation) const
+    {
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
+
+        const auto libObjPtr = bt_field_class_array_dynamic_with_length_field_location_create(
+            this->libObjPtr(), elementFieldClass.libObjPtr(), lengthFieldLocation.libObjPtr());
+
+        internal::validateCreatedObjPtr(libObjPtr);
+        return DynamicArrayWithLengthFieldClass::Shared::createWithoutRef(libObjPtr);
+    }
+
     StructureFieldClass::Shared createStructureFieldClass() const
     {
         static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTraceClass`.");
This page took 0.026253 seconds and 4 git commands to generate.