src.ctf.lttng-live: make lttng_live_stream_iterator::current_msg a bt2::Message:...
[babeltrace.git] / src / plugins / ctf / lttng-live / lttng-live.hpp
index a528f94ce397d59135bb983baeecc967e4d78ee1..56c86d39a679cadbe995e585800588c5ea1efa0e 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <babeltrace2/babeltrace.h>
 
+#include "cpp-common/bt2/message.hpp"
 #include "cpp-common/vendor/fmt/format.h" /* IWYU pragma: keep */
 
 #include "../common/src/metadata/tsdl/decoder.hpp"
@@ -74,8 +75,7 @@ struct lttng_live_stream_iterator
 
     bt2c::Logger logger;
 
-    /* Owned by this. */
-    bt_stream *stream = nullptr;
+    bt2::Stream::Shared stream;
 
     /* Weak reference. */
     struct lttng_live_trace *trace = nullptr;
@@ -84,7 +84,7 @@ struct lttng_live_stream_iterator
      * Since only a single iterator per viewer connection, we have
      * only a single message iterator per stream.
      */
-    struct ctf_msg_iter *msg_iter = nullptr;
+    ctf_msg_iter_up msg_iter;
 
     uint64_t viewer_stream_id = 0;
 
@@ -119,27 +119,23 @@ struct lttng_live_stream_iterator
 
     enum lttng_live_stream_state state = LTTNG_LIVE_STREAM_QUIESCENT;
 
-    /*
-     * The current message produced by this live stream iterator. Owned by
-     * this.
-     */
-    const bt_message *current_msg = nullptr;
+    /* The current message produced by this live stream iterator. */
+    bt2::ConstMessage::Shared current_msg;
 
     /* Timestamp in nanoseconds of the current message (current_msg). */
     int64_t current_msg_ts_ns = 0;
 
-    /* Owned by this. */
-    uint8_t *buf = nullptr;
-    size_t buflen = 0;
+    std::vector<uint8_t> buf;
 
-    /* Owned by this. */
-    GString *name = nullptr;
+    std::string name;
 
     bool has_stream_hung_up = false;
 };
 
 struct lttng_live_metadata
 {
+    using UP = std::unique_ptr<lttng_live_metadata>;
+
     explicit lttng_live_metadata(const bt2c::Logger& parentLogger) :
         logger {parentLogger, "PLUGIN/SRC.CTF.LTTNG-LIVE/METADATA"}
     {
@@ -194,7 +190,7 @@ struct lttng_live_trace
 
     bt2::TraceClass::Shared trace_class;
 
-    struct lttng_live_metadata *metadata = nullptr;
+    lttng_live_metadata::UP metadata;
 
     const bt_clock_class *clock_class = nullptr;
 
@@ -249,6 +245,8 @@ enum session_not_found_action
  */
 struct lttng_live_component
 {
+    using UP = std::unique_ptr<lttng_live_component>;
+
     explicit lttng_live_component(bt2c::Logger loggerParam) noexcept :
         logger {std::move(loggerParam)}
     {
This page took 0.024192 seconds and 4 git commands to generate.