cpp-common/bt2: add `streamClassDefaultClockClass()` methods
[babeltrace.git] / src / cpp-common / bt2 / message.hpp
index a0259c0edbc55dd7839fdada5c75d7ee48018484..be9be1184587d23bc5f1c4e117d3e16b7803170c 100644 (file)
@@ -268,12 +268,19 @@ public:
             internal::CommonStreamBeginningMessageSpec<LibObjT>::stream(this->libObjPtr())};
     }
 
-    void defaultClockSnapshot(const std::uint64_t val) const noexcept
+    OptionalBorrowedObject<ConstClockClass> streamClassDefaultClockClass() const noexcept
+    {
+        return bt_message_stream_beginning_borrow_stream_class_default_clock_class_const(
+            this->libObjPtr());
+    }
+
+    CommonStreamBeginningMessage defaultClockSnapshot(const std::uint64_t val) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value,
                       "Not available with `bt2::ConstStreamBeginningMessage`.");
 
         bt_message_stream_beginning_set_default_clock_snapshot(this->libObjPtr(), val);
+        return *this;
     }
 
     OptionalBorrowedObject<ConstClockSnapshot> defaultClockSnapshot() const noexcept
@@ -382,12 +389,19 @@ public:
         return _Stream {internal::CommonStreamEndMessageSpec<LibObjT>::stream(this->libObjPtr())};
     }
 
-    void defaultClockSnapshot(const std::uint64_t val) const noexcept
+    OptionalBorrowedObject<ConstClockClass> streamClassDefaultClockClass() const noexcept
+    {
+        return bt_message_stream_end_borrow_stream_class_default_clock_class_const(
+            this->libObjPtr());
+    }
+
+    CommonStreamEndMessage defaultClockSnapshot(const std::uint64_t val) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value,
                       "Not available with `bt2::ConstStreamEndMessage`.");
 
         bt_message_stream_end_set_default_clock_snapshot(this->libObjPtr(), val);
+        return *this;
     }
 
     OptionalBorrowedObject<ConstClockSnapshot> defaultClockSnapshot() const noexcept
@@ -497,12 +511,19 @@ public:
             internal::CommonPacketBeginningMessageSpec<LibObjT>::packet(this->libObjPtr())};
     }
 
-    void defaultClockSnapshot(const std::uint64_t val) const noexcept
+    OptionalBorrowedObject<ConstClockClass> streamClassDefaultClockClass() const noexcept
+    {
+        return bt_message_packet_beginning_borrow_stream_class_default_clock_class_const(
+            this->libObjPtr());
+    }
+
+    CommonPacketBeginningMessage defaultClockSnapshot(const std::uint64_t val) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value,
                       "Not available with `bt2::ConstPacketBeginningMessage`.");
 
         bt_message_packet_beginning_set_default_clock_snapshot(this->libObjPtr(), val);
+        return *this;
     }
 
     ConstClockSnapshot defaultClockSnapshot() const noexcept
@@ -606,12 +627,19 @@ public:
         return _Packet {internal::CommonPacketEndMessageSpec<LibObjT>::packet(this->libObjPtr())};
     }
 
-    void defaultClockSnapshot(const std::uint64_t val) const noexcept
+    OptionalBorrowedObject<ConstClockClass> streamClassDefaultClockClass() const noexcept
+    {
+        return bt_message_packet_end_borrow_stream_class_default_clock_class_const(
+            this->libObjPtr());
+    }
+
+    CommonPacketEndMessage defaultClockSnapshot(const std::uint64_t val) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value,
                       "Not available with `bt2::ConstPacketEndMessage`.");
 
         bt_message_packet_end_set_default_clock_snapshot(this->libObjPtr(), val);
+        return *this;
     }
 
     ConstClockSnapshot defaultClockSnapshot() const noexcept
@@ -820,6 +848,12 @@ public:
             internal::CommonDiscardedEventsMessageSpec<LibObjT>::stream(this->libObjPtr())};
     }
 
+    OptionalBorrowedObject<ConstClockClass> streamClassDefaultClockClass() const noexcept
+    {
+        return bt_message_discarded_events_borrow_stream_class_default_clock_class_const(
+            this->libObjPtr());
+    }
+
     ConstClockSnapshot beginningDefaultClockSnapshot() const noexcept
     {
         const auto libObjPtr =
@@ -837,12 +871,13 @@ public:
         return ConstClockSnapshot {libObjPtr};
     }
 
-    void count(const std::uint64_t count) const noexcept
+    CommonDiscardedEventsMessage count(const std::uint64_t count) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value,
                       "Not available with `bt2::ConstDiscardedEventsMessage`.");
 
         bt_message_discarded_events_set_count(this->libObjPtr(), count);
+        return *this;
     }
 
     bt2s::optional<std::uint64_t> count() const noexcept
@@ -950,6 +985,12 @@ public:
             internal::CommonDiscardedPacketsMessageSpec<LibObjT>::stream(this->libObjPtr())};
     }
 
+    OptionalBorrowedObject<ConstClockClass> streamClassDefaultClockClass() const noexcept
+    {
+        return bt_message_discarded_packets_borrow_stream_class_default_clock_class_const(
+            this->libObjPtr());
+    }
+
     ConstClockSnapshot beginningDefaultClockSnapshot() const noexcept
     {
         const auto libObjPtr =
@@ -967,12 +1008,13 @@ public:
         return ConstClockSnapshot {libObjPtr};
     }
 
-    void count(const std::uint64_t count) const noexcept
+    CommonDiscardedPacketsMessage count(const std::uint64_t count) const noexcept
     {
         static_assert(!std::is_const<LibObjT>::value,
                       "Not available with `bt2::ConstDiscardedPacketsMessage`.");
 
         bt_message_discarded_packets_set_count(this->libObjPtr(), count);
+        return *this;
     }
 
     bt2s::optional<std::uint64_t> count() const noexcept
@@ -1094,49 +1136,42 @@ struct TypeDescr<ConstMessageIteratorInactivityMessage> :
 template <typename LibObjT>
 CommonStreamBeginningMessage<LibObjT> CommonMessage<LibObjT>::asStreamBeginning() const noexcept
 {
-    BT_ASSERT_DBG(this->isStreamBeginning());
     return CommonStreamBeginningMessage<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonStreamEndMessage<LibObjT> CommonMessage<LibObjT>::asStreamEnd() const noexcept
 {
-    BT_ASSERT_DBG(this->isStreamEnd());
     return CommonStreamEndMessage<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonPacketBeginningMessage<LibObjT> CommonMessage<LibObjT>::asPacketBeginning() const noexcept
 {
-    BT_ASSERT_DBG(this->isPacketBeginning());
     return CommonPacketBeginningMessage<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonPacketEndMessage<LibObjT> CommonMessage<LibObjT>::asPacketEnd() const noexcept
 {
-    BT_ASSERT_DBG(this->isPacketEnd());
     return CommonPacketEndMessage<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonEventMessage<LibObjT> CommonMessage<LibObjT>::asEvent() const noexcept
 {
-    BT_ASSERT_DBG(this->isEvent());
     return CommonEventMessage<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonDiscardedEventsMessage<LibObjT> CommonMessage<LibObjT>::asDiscardedEvents() const noexcept
 {
-    BT_ASSERT_DBG(this->isDiscardedEvents());
     return CommonDiscardedEventsMessage<LibObjT> {this->libObjPtr()};
 }
 
 template <typename LibObjT>
 CommonDiscardedPacketsMessage<LibObjT> CommonMessage<LibObjT>::asDiscardedPackets() const noexcept
 {
-    BT_ASSERT_DBG(this->isDiscardedPackets());
     return CommonDiscardedPacketsMessage<LibObjT> {this->libObjPtr()};
 }
 
@@ -1144,7 +1179,6 @@ template <typename LibObjT>
 CommonMessageIteratorInactivityMessage<LibObjT>
 CommonMessage<LibObjT>::asMessageIteratorInactivity() const noexcept
 {
-    BT_ASSERT_DBG(this->isMessageIteratorInactivity());
     return CommonMessageIteratorInactivityMessage<LibObjT> {this->libObjPtr()};
 }
 
This page took 0.02456 seconds and 4 git commands to generate.