.clang-tidy: enable cppcoreguidelines-avoid-const-or-ref-data-members
[babeltrace.git] / src / plugins / ctf / fs-sink / fs-sink-trace.hpp
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2019 Philippe Proulx <pproulx@efficios.com>
5 */
6
7 #ifndef BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H
8 #define BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H
9
10 #include <glib.h>
11
12 #include <babeltrace2/babeltrace.h>
13
14 struct fs_sink_trace
15 {
16 bt_logging_level log_level;
17 struct fs_sink_comp *fs_sink;
18
19 /* Owned by this */
20 struct fs_sink_ctf_trace *trace;
21
22 /*
23 * Weak reference: this object does not own it, and `trace`
24 * above does not own its trace IR trace and trace class either.
25 * Instead, we add a "trace destruction" listener (in
26 * create_trace()) so that this object gets destroyed when the
27 * trace object is destroyed.
28 *
29 * Otherwise (with a strong reference), we would keep this trace
30 * object alive until the upstream message iterator ends. This
31 * could "leak" resources (memory, file descriptors) associated
32 * to traces and streams which otherwise would not exist.
33 */
34 const bt_trace *ir_trace;
35
36 bt_listener_id ir_trace_destruction_listener_id;
37
38 /* Trace's directory */
39 GString *path;
40
41 /* `metadata` file path */
42 GString *metadata_path;
43
44 /*
45 * Hash table of `const bt_stream *` (weak) to
46 * `struct fs_sink_stream *` (owned by hash table).
47 */
48 GHashTable *streams;
49 };
50
51 struct fs_sink_trace *fs_sink_trace_create(struct fs_sink_comp *fs_sink, const bt_trace *ir_trace);
52
53 void fs_sink_trace_destroy(struct fs_sink_trace *trace);
54
55 #endif /* BABELTRACE_PLUGIN_CTF_FS_SINK_FS_SINK_TRACE_H */
This page took 0.031761 seconds and 4 git commands to generate.