cpp-common/bt2: add asConst() methods
[babeltrace.git] / src / cpp-common / bt2 / trace-ir.hpp
index 5ee989601764d34fcea234c7eb46148e857cfa03..e00950818afb8863d62866f6a7748802403ebad7 100644 (file)
@@ -163,6 +163,11 @@ public:
         return *this;
     }
 
+    CommonEvent<const bt_event> asConst() const noexcept
+    {
+        return CommonEvent<const bt_event> {*this};
+    }
+
     Class cls() const noexcept;
     _Stream stream() const noexcept;
     nonstd::optional<_Packet> packet() const noexcept;
@@ -305,6 +310,11 @@ public:
         return *this;
     }
 
+    CommonPacket<const bt_packet> asConst() const noexcept
+    {
+        return CommonPacket<const bt_packet> {*this};
+    }
+
     _Stream stream() const noexcept;
 
     nonstd::optional<_StructureField> contextField() const noexcept
@@ -459,6 +469,11 @@ public:
         return *this;
     }
 
+    CommonStream<const bt_stream> asConst() const noexcept
+    {
+        return CommonStream<const bt_stream> {*this};
+    }
+
     Packet::Shared createPacket() const
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
@@ -675,6 +690,11 @@ public:
         return *this;
     }
 
+    CommonTrace<const bt_trace> asConst() const noexcept
+    {
+        return CommonTrace<const bt_trace> {*this};
+    }
+
     Class cls() const noexcept;
 
     void name(const char * const name) const
@@ -993,6 +1013,11 @@ public:
         return *this;
     }
 
+    CommonEventClass<const bt_event_class> asConst() const noexcept
+    {
+        return CommonEventClass<const bt_event_class> {*this};
+    }
+
     _StreamClass streamClass() const noexcept;
 
     std::uint64_t id() const noexcept
@@ -1322,6 +1347,11 @@ public:
         return *this;
     }
 
+    CommonStreamClass<const bt_stream_class> asConst() const noexcept
+    {
+        return CommonStreamClass<const bt_stream_class> {*this};
+    }
+
     Stream::Shared instantiate(const Trace trace) const
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
@@ -1736,6 +1766,11 @@ public:
         return *this;
     }
 
+    CommonTraceClass<const bt_trace_class> asConst() const noexcept
+    {
+        return CommonTraceClass<const bt_trace_class> {*this};
+    }
+
     Trace::Shared instantiate() const
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
This page took 0.023061 seconds and 4 git commands to generate.