Rename <babeltrace/component/...> -> <babeltrace/graph/...>
[babeltrace.git] / converter / babeltrace-cfg.h
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>
29 #include <stdint.h>
30 #include <babeltrace/values.h>
31 #include <babeltrace/ref.h>
32 #include <babeltrace/object-internal.h>
33 #include <babeltrace/compiler.h>
34 #include <babeltrace/graph/component-class.h>
35 #include <glib.h>
36
37 struct bt_config_component {
38 struct bt_object base;
39 enum bt_component_class_type type;
40 GString *plugin_name;
41 GString *comp_cls_name;
42 struct bt_value *params;
43 GString *instance_name;
44 };
45
46 enum bt_config_command {
47 BT_CONFIG_COMMAND_RUN,
48 BT_CONFIG_COMMAND_PRINT_CTF_METADATA,
49 BT_CONFIG_COMMAND_PRINT_LTTNG_LIVE_SESSIONS,
50 BT_CONFIG_COMMAND_LIST_PLUGINS,
51 BT_CONFIG_COMMAND_HELP,
52 BT_CONFIG_COMMAND_QUERY,
53 };
54
55 struct bt_config {
56 struct bt_object base;
57 bool debug;
58 bool verbose;
59 struct bt_value *plugin_paths;
60 bool omit_system_plugin_path;
61 bool omit_home_plugin_path;
62 bool command_needs_plugins;
63 const char *command_name;
64 enum bt_config_command command;
65 union {
66 /* BT_CONFIG_COMMAND_RUN */
67 struct {
68 /* Array of pointers to struct bt_config_component */
69 GPtrArray *sources;
70
71 /* Array of pointers to struct bt_config_component */
72 GPtrArray *filters;
73
74 /* Array of pointers to struct bt_config_component */
75 GPtrArray *sinks;
76
77 /* Array of pointers to struct bt_config_connection */
78 GPtrArray *connections;
79 } run;
80
81 /* BT_CONFIG_COMMAND_HELP */
82 struct {
83 struct bt_config_component *cfg_component;
84 } help;
85
86 /* BT_CONFIG_COMMAND_QUERY */
87 struct {
88 GString *object;
89 struct bt_config_component *cfg_component;
90 } query;
91
92 /* BT_CONFIG_COMMAND_PRINT_CTF_METADATA */
93 struct {
94 GString *path;
95 } print_ctf_metadata;
96
97 /* BT_CONFIG_COMMAND_PRINT_LTTNG_LIVE_SESSIONS */
98 struct {
99 GString *url;
100 } print_lttng_live_sessions;
101 } cmd_data;
102 };
103
104 static inline
105 struct bt_config_component *bt_config_get_component(GPtrArray *array,
106 size_t index)
107 {
108 return bt_get(g_ptr_array_index(array, index));
109 }
110
111 struct bt_config *bt_config_from_args(int argc, const char *argv[],
112 int *retcode, bool omit_system_plugin_path,
113 bool omit_home_plugin_path,
114 struct bt_value *initial_plugin_paths);
115
116 struct bt_config_component *bt_config_component_from_arg(
117 enum bt_component_class_type type, const char *arg);
118
119 enum bt_value_status bt_config_append_plugin_paths(
120 struct bt_value *plugin_paths, const char *arg);
121
122 #endif /* BABELTRACE_CONVERTER_CFG_H */
This page took 0.04678 seconds and 5 git commands to generate.