From 142c561085c255bfe1466d298e77f84338ebc874 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 19 Mar 2015 22:12:06 -0400 Subject: [PATCH] ir: add trace accessor to bt_ctf_stream_class MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- formats/ctf/ir/stream-class.c | 17 +++++++++++++++++ include/babeltrace/ctf-ir/stream-class.h | 10 ++++++++++ 2 files changed, 27 insertions(+) diff --git a/formats/ctf/ir/stream-class.c b/formats/ctf/ir/stream-class.c index 22ea8a5d..572d7424 100644 --- a/formats/ctf/ir/stream-class.c +++ b/formats/ctf/ir/stream-class.c @@ -87,6 +87,23 @@ error: return stream_class; } +struct bt_ctf_trace *bt_ctf_stream_class_get_trace( + struct bt_ctf_stream_class *stream_class) +{ + struct bt_ctf_trace *trace = NULL; + + if (!stream_class) { + goto end; + } + + trace = stream_class->trace; + if (trace) { + bt_ctf_trace_get(trace); + } +end: + return trace; +} + const char *bt_ctf_stream_class_get_name( struct bt_ctf_stream_class *stream_class) { diff --git a/include/babeltrace/ctf-ir/stream-class.h b/include/babeltrace/ctf-ir/stream-class.h index a78437b2..200a1fd1 100644 --- a/include/babeltrace/ctf-ir/stream-class.h +++ b/include/babeltrace/ctf-ir/stream-class.h @@ -65,6 +65,16 @@ struct bt_ctf_clock; */ extern struct bt_ctf_stream_class *bt_ctf_stream_class_create(const char *name); +/* + * bt_ctf_stream_class_get_trace: Get a stream class' associated trace. + * + * @param stream_class Stream class. + * + * Returns the stream class' associated trace, NULL on error. + */ +extern struct bt_ctf_trace *bt_ctf_stream_class_get_trace( + struct bt_ctf_stream_class *stream_class); + /* * bt_ctf_stream_class_get_name: Get a stream class' name. * -- 2.34.1