babeltrace convert: add --name option
[babeltrace.git] / converter / babeltrace-cfg.h
CommitLineData
c42c79ea
PP
1#ifndef BABELTRACE_CONVERTER_CFG_H
2#define BABELTRACE_CONVERTER_CFG_H
3
4/*
5 * Babeltrace trace converter - configuration
6 *
7 * Copyright 2016 Philippe Proulx <pproulx@efficios.com>
8 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal
11 * in the Software without restriction, including without limitation the rights
12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 * copies of the Software, and to permit persons to whom the Software is
14 * furnished to do so, subject to the following conditions:
15 *
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
18 *
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25 * SOFTWARE.
26 */
27
28#include <stdlib.h>
015cee23 29#include <stdint.h>
c42c79ea
PP
30#include <babeltrace/values.h>
31#include <babeltrace/ref.h>
32#include <babeltrace/object-internal.h>
33#include <babeltrace/compiler.h>
22e22462 34#include <babeltrace/component/component-class.h>
c42c79ea
PP
35#include <glib.h>
36
37struct bt_config_component {
38 struct bt_object base;
39 GString *plugin_name;
40 GString *component_name;
41 struct bt_value *params;
3b6cfcc5 42 GString *instance_name;
c42c79ea
PP
43};
44
290725f7
PP
45enum bt_config_command {
46 BT_CONFIG_COMMAND_CONVERT,
47 BT_CONFIG_COMMAND_LIST_PLUGINS,
22e22462 48 BT_CONFIG_COMMAND_HELP,
290725f7
PP
49};
50
c42c79ea
PP
51struct bt_config {
52 struct bt_object base;
290725f7
PP
53 bool debug;
54 bool verbose;
55 const char *command_name;
56 enum bt_config_command command;
57 union {
58 /* BT_CONFIG_COMMAND_CONVERT */
59 struct {
60 struct bt_value *plugin_paths;
c42c79ea 61
290725f7
PP
62 /* Array of pointers to struct bt_config_component */
63 GPtrArray *sources;
c42c79ea 64
290725f7
PP
65 /* Array of pointers to struct bt_config_component */
66 GPtrArray *sinks;
c42c79ea 67
290725f7
PP
68 bool force_correlate;
69 bool omit_system_plugin_path;
70 bool omit_home_plugin_path;
71 } convert;
72
73 /* BT_CONFIG_COMMAND_LIST_PLUGINS */
74 struct {
75 struct bt_value *plugin_paths;
76 bool omit_system_plugin_path;
77 bool omit_home_plugin_path;
78 } list_plugins;
22e22462
PP
79
80 /* BT_CONFIG_COMMAND_HELP */
81 struct {
82 struct bt_value *plugin_paths;
83 bool omit_system_plugin_path;
84 bool omit_home_plugin_path;
85 enum bt_component_class_type comp_cls_type;
86 GString *plugin_name;
87 GString *component_name;
88 } help;
290725f7 89 } cmd_data;
c42c79ea
PP
90};
91
92static inline
93struct bt_config_component *bt_config_get_component(GPtrArray *array,
94 size_t index)
95{
96 return bt_get(g_ptr_array_index(array, index));
97}
98
290725f7
PP
99struct bt_config *bt_config_from_args(int argc, const char *argv[],
100 int *retcode, bool omit_system_plugin_path,
101 bool omit_home_plugin_path,
102 struct bt_value *initial_plugin_paths);
c42c79ea 103
5a3ee633
PP
104enum bt_value_status bt_config_append_plugin_paths(
105 struct bt_value *plugin_paths, const char *arg);
106
c42c79ea 107#endif /* BABELTRACE_CONVERTER_CFG_H */
This page took 0.027841 seconds and 4 git commands to generate.