cpp-common/bt2c/fmt.hpp: use `wise_enum::string_type` in `EnableIfIsWiseEnum` definition
[babeltrace.git] / src / plugins / ctf / fs-sink / fs-sink-trace.hpp
CommitLineData
15fe47e0 1/*
0235b0db 2 * SPDX-License-Identifier: MIT
15fe47e0 3 *
0235b0db 4 * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
15fe47e0
PP
5 */
6
0235b0db
MJ
7#ifndef BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H
8#define BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H
9
15fe47e0 10#include <glib.h>
15fe47e0 11
c802cacb
SM
12#include <babeltrace2/babeltrace.h>
13
3c20ac12
SM
14#include "cpp-common/bt2c/logging.hpp"
15
150640e8
SM
16struct fs_sink_comp;
17struct fs_sink_ctf_trace;
18
4164020e
SM
19struct fs_sink_trace
20{
3c20ac12
SM
21 explicit fs_sink_trace(const bt2c::Logger& parentLogger) :
22 logger {parentLogger, "PLUGIN/SINK.CTF.FS/TRACE"}
23 {
24 }
25
26 bt2c::Logger logger;
150640e8 27 fs_sink_comp *fs_sink = nullptr;
4164020e
SM
28
29 /* Owned by this */
150640e8 30 fs_sink_ctf_trace *trace = nullptr;
4164020e
SM
31
32 /*
33 * Weak reference: this object does not own it, and `trace`
34 * above does not own its trace IR trace and trace class either.
35 * Instead, we add a "trace destruction" listener (in
36 * create_trace()) so that this object gets destroyed when the
37 * trace object is destroyed.
38 *
39 * Otherwise (with a strong reference), we would keep this trace
40 * object alive until the upstream message iterator ends. This
41 * could "leak" resources (memory, file descriptors) associated
42 * to traces and streams which otherwise would not exist.
43 */
150640e8 44 const bt_trace *ir_trace = nullptr;
4164020e 45
150640e8 46 bt_listener_id ir_trace_destruction_listener_id = 0;
4164020e
SM
47
48 /* Trace's directory */
150640e8 49 GString *path = nullptr;
4164020e
SM
50
51 /* `metadata` file path */
150640e8 52 GString *metadata_path = nullptr;
4164020e
SM
53
54 /*
55 * Hash table of `const bt_stream *` (weak) to
56 * `struct fs_sink_stream *` (owned by hash table).
57 */
150640e8 58 GHashTable *streams = nullptr;
15fe47e0
PP
59};
60
4164020e 61struct fs_sink_trace *fs_sink_trace_create(struct fs_sink_comp *fs_sink, const bt_trace *ir_trace);
15fe47e0 62
15fe47e0
PP
63void fs_sink_trace_destroy(struct fs_sink_trace *trace);
64
65#endif /* BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H */
This page took 0.079322 seconds and 4 git commands to generate.