babeltrace(1): add help command
[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/component/component-class.h>
35 #include <glib.h>
36
37 struct bt_config_component {
38 struct bt_object base;
39 GString *plugin_name;
40 GString *component_name;
41 struct bt_value *params;
42 };
43
44 enum bt_config_command {
45 BT_CONFIG_COMMAND_CONVERT,
46 BT_CONFIG_COMMAND_LIST_PLUGINS,
47 BT_CONFIG_COMMAND_HELP,
48 };
49
50 struct bt_config {
51 struct bt_object base;
52 bool debug;
53 bool verbose;
54 const char *command_name;
55 enum bt_config_command command;
56 union {
57 /* BT_CONFIG_COMMAND_CONVERT */
58 struct {
59 struct bt_value *plugin_paths;
60
61 /* Array of pointers to struct bt_config_component */
62 GPtrArray *sources;
63
64 /* Array of pointers to struct bt_config_component */
65 GPtrArray *sinks;
66
67 bool force_correlate;
68 bool omit_system_plugin_path;
69 bool omit_home_plugin_path;
70 } convert;
71
72 /* BT_CONFIG_COMMAND_LIST_PLUGINS */
73 struct {
74 struct bt_value *plugin_paths;
75 bool omit_system_plugin_path;
76 bool omit_home_plugin_path;
77 } list_plugins;
78
79 /* BT_CONFIG_COMMAND_HELP */
80 struct {
81 struct bt_value *plugin_paths;
82 bool omit_system_plugin_path;
83 bool omit_home_plugin_path;
84 enum bt_component_class_type comp_cls_type;
85 GString *plugin_name;
86 GString *component_name;
87 } help;
88 } cmd_data;
89 };
90
91 static inline
92 struct bt_config_component *bt_config_get_component(GPtrArray *array,
93 size_t index)
94 {
95 return bt_get(g_ptr_array_index(array, index));
96 }
97
98 struct bt_config *bt_config_from_args(int argc, const char *argv[],
99 int *retcode, bool omit_system_plugin_path,
100 bool omit_home_plugin_path,
101 struct bt_value *initial_plugin_paths);
102
103 enum bt_value_status bt_config_append_plugin_paths(
104 struct bt_value *plugin_paths, const char *arg);
105
106 #endif /* BABELTRACE_CONVERTER_CFG_H */
This page took 0.032454 seconds and 4 git commands to generate.