X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Fcpp-common%2Fbt2%2Fmessage.hpp;h=0abd3c5403e0fc69ef539c1df9b63f9e6ea68b3e;hb=2a24eba8b45ab4bd62dfb2cd95f31e4c2a7a91a8;hp=30cf5b31174c3ff9a7cf2f6afd04a91726826166;hpb=ca61ecbc0d9d2d64cc3b6a02d118e4ee87477cf6;p=babeltrace.git diff --git a/src/cpp-common/bt2/message.hpp b/src/cpp-common/bt2/message.hpp index 30cf5b31..0abd3c54 100644 --- a/src/cpp-common/bt2/message.hpp +++ b/src/cpp-common/bt2/message.hpp @@ -21,6 +21,7 @@ #include "internal/utils.hpp" #include "optional-borrowed-object.hpp" #include "shared-object.hpp" +#include "trace-ir.hpp" namespace bt2 { namespace internal { @@ -267,12 +268,13 @@ public: internal::CommonStreamBeginningMessageSpec::stream(this->libObjPtr())}; } - void defaultClockSnapshot(const std::uint64_t val) const noexcept + CommonStreamBeginningMessage defaultClockSnapshot(const std::uint64_t val) const noexcept { static_assert(!std::is_const::value, "Not available with `bt2::ConstStreamBeginningMessage`."); bt_message_stream_beginning_set_default_clock_snapshot(this->libObjPtr(), val); + return *this; } OptionalBorrowedObject defaultClockSnapshot() const noexcept @@ -381,12 +383,13 @@ public: return _Stream {internal::CommonStreamEndMessageSpec::stream(this->libObjPtr())}; } - void defaultClockSnapshot(const std::uint64_t val) const noexcept + CommonStreamEndMessage defaultClockSnapshot(const std::uint64_t val) const noexcept { static_assert(!std::is_const::value, "Not available with `bt2::ConstStreamEndMessage`."); bt_message_stream_end_set_default_clock_snapshot(this->libObjPtr(), val); + return *this; } OptionalBorrowedObject defaultClockSnapshot() const noexcept @@ -496,12 +499,13 @@ public: internal::CommonPacketBeginningMessageSpec::packet(this->libObjPtr())}; } - void defaultClockSnapshot(const std::uint64_t val) const noexcept + CommonPacketBeginningMessage defaultClockSnapshot(const std::uint64_t val) const noexcept { static_assert(!std::is_const::value, "Not available with `bt2::ConstPacketBeginningMessage`."); bt_message_packet_beginning_set_default_clock_snapshot(this->libObjPtr(), val); + return *this; } ConstClockSnapshot defaultClockSnapshot() const noexcept @@ -605,12 +609,13 @@ public: return _Packet {internal::CommonPacketEndMessageSpec::packet(this->libObjPtr())}; } - void defaultClockSnapshot(const std::uint64_t val) const noexcept + CommonPacketEndMessage defaultClockSnapshot(const std::uint64_t val) const noexcept { static_assert(!std::is_const::value, "Not available with `bt2::ConstPacketEndMessage`."); bt_message_packet_end_set_default_clock_snapshot(this->libObjPtr(), val); + return *this; } ConstClockSnapshot defaultClockSnapshot() const noexcept @@ -836,20 +841,20 @@ 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::value, "Not available with `bt2::ConstDiscardedEventsMessage`."); bt_message_discarded_events_set_count(this->libObjPtr(), count); + return *this; } bt2s::optional count() const noexcept { std::uint64_t count; - const auto avail = bt_message_discarded_events_get_count(this->libObjPtr(), &count); - if (avail) { + if (bt_message_discarded_events_get_count(this->libObjPtr(), &count)) { return count; } @@ -967,20 +972,20 @@ 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::value, "Not available with `bt2::ConstDiscardedPacketsMessage`."); bt_message_discarded_packets_set_count(this->libObjPtr(), count); + return *this; } bt2s::optional count() const noexcept { std::uint64_t count; - const auto avail = bt_message_discarded_packets_get_count(this->libObjPtr(), &count); - if (avail) { + if (bt_message_discarded_packets_get_count(this->libObjPtr(), &count)) { return count; } @@ -1095,49 +1100,42 @@ struct TypeDescr : template CommonStreamBeginningMessage CommonMessage::asStreamBeginning() const noexcept { - BT_ASSERT_DBG(this->isStreamBeginning()); return CommonStreamBeginningMessage {this->libObjPtr()}; } template CommonStreamEndMessage CommonMessage::asStreamEnd() const noexcept { - BT_ASSERT_DBG(this->isStreamEnd()); return CommonStreamEndMessage {this->libObjPtr()}; } template CommonPacketBeginningMessage CommonMessage::asPacketBeginning() const noexcept { - BT_ASSERT_DBG(this->isPacketBeginning()); return CommonPacketBeginningMessage {this->libObjPtr()}; } template CommonPacketEndMessage CommonMessage::asPacketEnd() const noexcept { - BT_ASSERT_DBG(this->isPacketEnd()); return CommonPacketEndMessage {this->libObjPtr()}; } template CommonEventMessage CommonMessage::asEvent() const noexcept { - BT_ASSERT_DBG(this->isEvent()); return CommonEventMessage {this->libObjPtr()}; } template CommonDiscardedEventsMessage CommonMessage::asDiscardedEvents() const noexcept { - BT_ASSERT_DBG(this->isDiscardedEvents()); return CommonDiscardedEventsMessage {this->libObjPtr()}; } template CommonDiscardedPacketsMessage CommonMessage::asDiscardedPackets() const noexcept { - BT_ASSERT_DBG(this->isDiscardedPackets()); return CommonDiscardedPacketsMessage {this->libObjPtr()}; } @@ -1145,7 +1143,6 @@ template CommonMessageIteratorInactivityMessage CommonMessage::asMessageIteratorInactivity() const noexcept { - BT_ASSERT_DBG(this->isMessageIteratorInactivity()); return CommonMessageIteratorInactivityMessage {this->libObjPtr()}; }