1 #ifndef BABELTRACE2_GRAPH_SELF_COMPONENT_CLASS_H
2 #define BABELTRACE2_GRAPH_SELF_COMPONENT_CLASS_H
5 * Copyright (c) 2010-2019 EfficiOS Inc. and Linux Foundation
7 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal
9 * in the Software without restriction, including without limitation the rights
10 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 * copies of the Software, and to permit persons to whom the Software is
12 * furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included in
15 * all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26 #ifndef __BT_IN_BABELTRACE_H
27 # error "Please include <babeltrace2/babeltrace.h> instead."
30 #include <babeltrace2/types.h>
37 @defgroup api-self-comp-cls Self component classes
38 @ingroup api-comp-cls-dev
41 Private views of \bt_p_comp_cls for class methods.
43 The #bt_self_component_class, #bt_self_component_class_source,
44 #bt_self_component_class_filter, #bt_self_component_class_sink types are
45 private views of a \bt_comp_cls from within a component class
46 \ref api-comp-cls-dev-class-meth "class method".
48 As of \bt_name_version_min_maj, this module only contains functions
49 to \ref api-fund-c-typing "upcast" the "self" (private) types to their
50 public #bt_component_class, #bt_component_class_source,
51 #bt_component_class_filter, and #bt_component_class_sink counterparts.
60 @typedef struct bt_self_component_class bt_self_component_class;
65 @typedef struct bt_self_component_class_source bt_self_component_class_source;
68 Self \bt_src_comp_cls.
70 @typedef struct bt_self_component_class_filter bt_self_component_class_filter;
73 Self \bt_flt_comp_cls.
75 @typedef struct bt_self_component_class_sink bt_self_component_class_sink;
78 Self \bt_sink_comp_cls.
84 @name Self to public upcast
90 \ref api-fund-c-typing "Upcasts" the self \bt_comp_cls
91 \bt_p{self_component_class} to the public #bt_component_class type.
93 @param[in] self_component_class
95 Component class to upcast.
101 \bt_p{self_component_class} as a public component class.
104 const bt_component_class
*bt_self_component_class_as_component_class(
105 bt_self_component_class
*self_component_class
)
107 return __BT_UPCAST(bt_component_class
, self_component_class
);
112 \ref api-fund-c-typing "Upcasts" the self \bt_src_comp_cls
113 \bt_p{self_component_class} to the public #bt_component_class_source
116 @param[in] self_component_class
118 Source component class to upcast.
124 \bt_p{self_component_class} as a public source component class.
127 const bt_component_class_source
*
128 bt_self_component_class_source_as_component_class_source(
129 bt_self_component_class_source
*self_component_class
)
131 return __BT_UPCAST_CONST(bt_component_class_source
,
132 self_component_class
);
137 \ref api-fund-c-typing "Upcasts" the self \bt_flt_comp_cls
138 \bt_p{self_component_class} to the public #bt_component_class_filter
141 @param[in] self_component_class
143 Filter component class to upcast.
149 \bt_p{self_component_class} as a public filter component class.
152 const bt_component_class_filter
*
153 bt_self_component_class_filter_as_component_class_filter(
154 bt_self_component_class_filter
*self_component_class
)
156 return __BT_UPCAST_CONST(bt_component_class_filter
,
157 self_component_class
);
162 \ref api-fund-c-typing "Upcasts" the self \bt_sink_comp_cls
163 \bt_p{self_component_class} to the public #bt_component_class_sink
166 @param[in] self_component_class
168 Sink component class to upcast.
174 \bt_p{self_component_class} as a public sink component class.
177 const bt_component_class_sink
*
178 bt_self_component_class_sink_as_component_class_sink(
179 bt_self_component_class_sink
*self_component_class
)
181 return __BT_UPCAST_CONST(bt_component_class_sink
, self_component_class
);
187 @name Self to common self upcast
193 \ref api-fund-c-typing "Upcasts" the self \bt_src_comp_cls
194 \bt_p{self_component_class} to the common #bt_self_component_class
197 @param[in] self_component_class
199 Source component class to upcast.
205 \bt_p{self_component_class} as a common self component class.
208 bt_self_component_class
*
209 bt_self_component_class_source_as_self_component_class(
210 bt_self_component_class_source
*self_component_class
)
212 return __BT_UPCAST(bt_self_component_class
, self_component_class
);
217 \ref api-fund-c-typing "Upcasts" the self \bt_flt_comp_cls
218 \bt_p{self_component_class} to the common #bt_self_component_class
221 @param[in] self_component_class
223 Filter component class to upcast.
229 \bt_p{self_component_class} as a common self component class.
232 bt_self_component_class
*
233 bt_self_component_class_filter_as_self_component_class(
234 bt_self_component_class_filter
*self_component_class
)
236 return __BT_UPCAST(bt_self_component_class
, self_component_class
);
241 \ref api-fund-c-typing "Upcasts" the self \bt_sink_comp_cls
242 \bt_p{self_component_class} to the common #bt_self_component_class
245 @param[in] self_component_class
247 Sink component class to upcast.
253 \bt_p{self_component_class} as a common self component class.
256 bt_self_component_class
*
257 bt_self_component_class_sink_as_self_component_class(
258 bt_self_component_class_sink
*self_component_class
)
260 return __BT_UPCAST(bt_self_component_class
, self_component_class
);
271 #endif /* BABELTRACE2_GRAPH_SELF_COMPONENT_CLASS_H */