Commit | Line | Data |
---|---|---|
335a2da5 | 1 | /* |
0235b0db | 2 | * SPDX-License-Identifier: MIT |
335a2da5 | 3 | * |
0235b0db | 4 | * Copyright 2019 Philippe Proulx <pproulx@efficios.com> |
335a2da5 PP |
5 | */ |
6 | ||
7 | #include <babeltrace2/babeltrace.h> | |
8 | ||
6954b97e | 9 | #include "cpp-common/bt2c/uuid.hpp" |
c7e1be4b | 10 | |
087cd0f5 | 11 | #include "ctf-meta-configure-ir-trace.hpp" |
5656cea5 | 12 | #include "plugins/ctf/common/src/metadata/tsdl/ctf-meta.hpp" |
335a2da5 | 13 | |
6954b97e | 14 | void ctf_trace_class_configure_ir_trace(struct ctf_trace_class *tc, const bt2::Trace ir_trace) |
335a2da5 | 15 | { |
4164020e SM |
16 | uint64_t i; |
17 | ||
18 | BT_ASSERT(tc); | |
4164020e SM |
19 | |
20 | if (tc->is_uuid_set) { | |
6954b97e | 21 | ir_trace.uuid(bt2c::Uuid {tc->uuid}); |
4164020e SM |
22 | } |
23 | ||
24 | for (i = 0; i < tc->env_entries->len; i++) { | |
25 | struct ctf_trace_class_env_entry *env_entry = | |
26 | ctf_trace_class_borrow_env_entry_by_index(tc, i); | |
27 | ||
28 | switch (env_entry->type) { | |
29 | case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_INT: | |
6954b97e | 30 | ir_trace.environmentEntry(env_entry->name->str, env_entry->value.i); |
4164020e SM |
31 | break; |
32 | case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_STR: | |
6954b97e | 33 | ir_trace.environmentEntry(env_entry->name->str, env_entry->value.str->str); |
4164020e SM |
34 | break; |
35 | default: | |
36 | bt_common_abort(); | |
37 | } | |
4164020e | 38 | } |
335a2da5 | 39 | } |