#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"
/* Iterator over a live stream. */
struct lttng_live_stream_iterator
{
+ using UP = std::unique_ptr<lttng_live_stream_iterator>;
+
explicit lttng_live_stream_iterator(const bt2c::Logger& parentLogger) :
logger {parentLogger, "PLUGIN/SRC.CTF.LTTNG-LIVE/STREAM-ITER"}
{
}
+ ~lttng_live_stream_iterator();
+
bt2c::Logger logger;
bt2::Stream::Shared stream;
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;
struct lttng_live_trace
{
+ using UP = std::unique_ptr<lttng_live_trace>;
+
explicit lttng_live_trace(const bt2c::Logger& parentLogger) :
logger {parentLogger, "PLUGIN/SRC.CTF.LTTNG-LIVE/TRACE"}
{
const bt_clock_class *clock_class = nullptr;
- /* Array of pointers to struct lttng_live_stream_iterator. */
- /* Owned by this. */
- GPtrArray *stream_iterators = nullptr;
+ std::vector<lttng_live_stream_iterator::UP> stream_iterators;
enum lttng_live_metadata_stream_state metadata_stream_state =
LTTNG_LIVE_METADATA_STREAM_STATE_NEEDED;
struct lttng_live_session
{
+ using UP = std::unique_ptr<lttng_live_session>;
+
explicit lttng_live_session(const bt2c::Logger& parentLogger) :
logger {parentLogger, "PLUGIN/SRC.CTF.LTTNG-LIVE/SESSION"}
{
}
+ ~lttng_live_session();
+
bt2c::Logger logger;
bt_self_component *self_comp = nullptr;
/* Weak reference. */
struct lttng_live_msg_iter *lttng_live_msg_iter = nullptr;
- /* Owned by this. */
- GString *hostname = nullptr;
+ std::string hostname;
- /* Owned by this. */
- GString *session_name = nullptr;
+ std::string session_name;
uint64_t id = 0;
- /* Array of pointers to struct lttng_live_trace. */
- GPtrArray *traces = nullptr;
+ std::vector<lttng_live_trace::UP> traces;
bool attached = false;
bool new_streams_needed = false;