cpp-common/bt2/trace-ir.hpp: adapt to latest libbabeltrace2 API
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 17 Apr 2024 19:35:04 +0000 (15:35 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 4 Sep 2024 19:05:14 +0000 (15:05 -0400)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: I0dd81df640da63f1e6a1bdac43d4b89e86f36c6b
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12730

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

index c04ebaa337f70ef81ad87fbca6bd1ac960cdd525..6677d7028aa464a973c58af39e2c133ab604f97e 100644 (file)
@@ -640,6 +640,23 @@ public:
 
     Class cls() const noexcept;
 
+    CommonTrace nameSpace(const bt2c::CStringView nameSpace) const
+    {
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
+
+        if (bt_trace_set_namespace(this->libObjPtr(), nameSpace) ==
+            BT_TRACE_SET_NAMESPACE_STATUS_MEMORY_ERROR) {
+            throw MemoryError {};
+        }
+
+        return *this;
+    }
+
+    bt2c::CStringView nameSpace() const noexcept
+    {
+        return bt_trace_get_namespace(this->libObjPtr());
+    }
+
     CommonTrace name(const bt2c::CStringView name) const
     {
         static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
@@ -658,6 +675,22 @@ public:
         return bt_trace_get_name(this->libObjPtr());
     }
 
+    CommonTrace uid(const bt2c::CStringView uid) const
+    {
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
+
+        if (bt_trace_set_uid(this->libObjPtr(), uid) == BT_TRACE_SET_UID_STATUS_MEMORY_ERROR) {
+            throw MemoryError {};
+        }
+
+        return *this;
+    }
+
+    bt2c::CStringView uid() const noexcept
+    {
+        return bt_trace_get_uid(this->libObjPtr());
+    }
+
     CommonTrace uuid(const bt2c::UuidView& uuid) const noexcept
     {
         bt_trace_set_uuid(this->libObjPtr(), uuid.begin());
@@ -675,16 +708,6 @@ public:
         return bt2s::nullopt;
     }
 
-    void uid(const bt2c::CStringView uid) const noexcept
-    {
-        bt_trace_set_uid(this->libObjPtr(), uid);
-    }
-
-    bt2c::CStringView uid() const noexcept
-    {
-        return bt_trace_get_uid(this->libObjPtr());
-    }
-
     std::uint64_t length() const noexcept
     {
         return bt_trace_get_stream_count(this->libObjPtr());
@@ -974,6 +997,23 @@ public:
         return bt_event_class_get_name(this->libObjPtr());
     }
 
+    CommonEventClass uid(const bt2c::CStringView uid) const
+    {
+        static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
+
+        if (bt_event_class_set_uid(this->libObjPtr(), uid) ==
+            BT_EVENT_CLASS_SET_UID_STATUS_MEMORY_ERROR) {
+            throw MemoryError {};
+        }
+
+        return *this;
+    }
+
+    bt2c::CStringView uid() const noexcept
+    {
+        return bt_event_class_get_uid(this->libObjPtr());
+    }
+
     CommonEventClass logLevel(const EventClassLogLevel logLevel) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
@@ -1336,6 +1376,24 @@ public:
         return bt_stream_class_get_name(this->libObjPtr());
     }
 
+    CommonStreamClass uid(const bt2c::CStringView uid) const
+    {
+        static_assert(!std::is_const<LibObjT>::value,
+                      "Not available with `bt2::ConstStreamClass`.");
+
+        if (bt_stream_class_set_uid(this->libObjPtr(), uid) ==
+            BT_STREAM_CLASS_SET_UID_STATUS_MEMORY_ERROR) {
+            throw MemoryError {};
+        }
+
+        return *this;
+    }
+
+    bt2c::CStringView uid() const noexcept
+    {
+        return bt_stream_class_get_uid(this->libObjPtr());
+    }
+
     CommonStreamClass assignsAutomaticEventClassId(const bool val) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value,
@@ -1685,6 +1743,11 @@ public:
         return Trace::Shared::createWithoutRef(libObjPtr);
     }
 
+    std::uint64_t graphMipVersion() const noexcept
+    {
+        return bt_trace_class_get_graph_mip_version(this->libObjPtr());
+    }
+
     ConstFieldLocation::Shared createFieldLocation(const ConstFieldLocation::Scope scope,
                                                    const bt2s::span<const char * const> items) const
     {
This page took 0.026898 seconds and 4 git commands to generate.