2 * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com>
4 * SPDX-License-Identifier: MIT
7 #ifndef BABELTRACE_CPP_COMMON_BT2_WRAP_HPP
8 #define BABELTRACE_CPP_COMMON_BT2_WRAP_HPP
10 #include <babeltrace2/babeltrace.h>
12 #include "clock-class.hpp"
13 #include "clock-snapshot.hpp"
14 #include "component-port.hpp"
15 #include "field-class.hpp"
18 #include "integer-range-set.hpp"
19 #include "integer-range.hpp"
20 #include "message-iterator.hpp"
21 #include "message.hpp"
22 #include "optional-borrowed-object.hpp"
23 #include "private-query-executor.hpp"
24 #include "self-component-class.hpp"
25 #include "self-component-port.hpp"
26 #include "self-message-iterator-configuration.hpp"
27 #include "self-message-iterator.hpp"
28 #include "trace-ir.hpp"
33 inline Graph wrap(bt_graph * const libObjPtr) noexcept
35 return Graph {libObjPtr};
38 inline ClockClass wrap(bt_clock_class * const libObjPtr) noexcept
40 return ClockClass {libObjPtr};
43 inline ConstClockClass wrap(const bt_clock_class * const libObjPtr) noexcept
45 return ConstClockClass {libObjPtr};
48 inline ConstClockSnapshot wrap(const bt_clock_snapshot * const libObjPtr) noexcept
50 return ConstClockSnapshot {libObjPtr};
53 inline ConstComponent wrap(const bt_component * const libObjPtr) noexcept
55 return ConstComponent {libObjPtr};
58 inline ConstSourceComponent wrap(const bt_component_source * const libObjPtr) noexcept
60 return ConstSourceComponent {libObjPtr};
63 inline ConstFilterComponent wrap(const bt_component_filter * const libObjPtr) noexcept
65 return ConstFilterComponent {libObjPtr};
68 inline ConstSinkComponent wrap(const bt_component_sink * const libObjPtr) noexcept
70 return ConstSinkComponent {libObjPtr};
73 inline ConstInputPort wrap(const bt_port_input * const libObjPtr) noexcept
75 return ConstInputPort {libObjPtr};
78 inline ConstOutputPort wrap(const bt_port_output * const libObjPtr) noexcept
80 return ConstOutputPort {libObjPtr};
83 inline ConstUnsignedEnumerationFieldClassMapping
84 wrap(const bt_field_class_enumeration_unsigned_mapping * const libObjPtr) noexcept
86 return ConstUnsignedEnumerationFieldClassMapping {libObjPtr};
89 inline ConstSignedEnumerationFieldClassMapping
90 wrap(const bt_field_class_enumeration_signed_mapping * const libObjPtr) noexcept
92 return ConstSignedEnumerationFieldClassMapping {libObjPtr};
95 inline VariantFieldClassOption wrap(bt_field_class_variant_option * const libObjPtr) noexcept
97 return VariantFieldClassOption {libObjPtr};
100 inline ConstVariantFieldClassOption
101 wrap(const bt_field_class_variant_option * const libObjPtr) noexcept
103 return ConstVariantFieldClassOption {libObjPtr};
106 inline ConstVariantWithUnsignedIntegerSelectorFieldClassOption
107 wrap(const bt_field_class_variant_with_selector_field_integer_unsigned_option
108 * const libObjPtr) noexcept
110 return ConstVariantWithUnsignedIntegerSelectorFieldClassOption {libObjPtr};
113 inline ConstVariantWithSignedIntegerSelectorFieldClassOption
114 wrap(const bt_field_class_variant_with_selector_field_integer_signed_option
115 * const libObjPtr) noexcept
117 return ConstVariantWithSignedIntegerSelectorFieldClassOption {libObjPtr};
120 inline FieldClass wrap(bt_field_class * const libObjPtr) noexcept
122 return FieldClass {libObjPtr};
125 inline ConstFieldClass wrap(const bt_field_class * const libObjPtr) noexcept
127 return ConstFieldClass {libObjPtr};
130 inline ConstFieldPathItem wrap(const bt_field_path_item * const libObjPtr) noexcept
132 return ConstFieldPathItem {libObjPtr};
135 inline ConstFieldPath wrap(const bt_field_path * const libObjPtr) noexcept
137 return ConstFieldPath {libObjPtr};
140 inline Field wrap(bt_field * const libObjPtr) noexcept
142 return Field {libObjPtr};
145 inline ConstField wrap(const bt_field * const libObjPtr) noexcept
147 return ConstField {libObjPtr};
150 inline UnsignedIntegerRangeSet wrap(bt_integer_range_set_unsigned * const libObjPtr) noexcept
152 return UnsignedIntegerRangeSet {libObjPtr};
155 inline ConstUnsignedIntegerRangeSet
156 wrap(const bt_integer_range_set_unsigned * const libObjPtr) noexcept
158 return ConstUnsignedIntegerRangeSet {libObjPtr};
161 inline SignedIntegerRangeSet wrap(bt_integer_range_set_signed * const libObjPtr) noexcept
163 return SignedIntegerRangeSet {libObjPtr};
166 inline ConstSignedIntegerRangeSet wrap(const bt_integer_range_set_signed * const libObjPtr) noexcept
168 return ConstSignedIntegerRangeSet {libObjPtr};
171 inline ConstUnsignedIntegerRange wrap(const bt_integer_range_unsigned * const libObjPtr) noexcept
173 return ConstUnsignedIntegerRange {libObjPtr};
176 inline ConstSignedIntegerRange wrap(const bt_integer_range_signed * const libObjPtr) noexcept
178 return ConstSignedIntegerRange {libObjPtr};
181 inline MessageIterator wrap(bt_message_iterator * const libObjPtr) noexcept
183 return MessageIterator {libObjPtr};
186 inline Message wrap(bt_message * const libObjPtr) noexcept
188 return Message {libObjPtr};
191 inline ConstMessage wrap(const bt_message * const libObjPtr) noexcept
193 return ConstMessage {libObjPtr};
196 inline PrivateQueryExecutor wrap(bt_private_query_executor * const libObjPtr) noexcept
198 return PrivateQueryExecutor {libObjPtr};
201 inline SelfComponentClass wrap(bt_self_component_class * const libObjPtr) noexcept
203 return SelfComponentClass {libObjPtr};
206 inline SelfComponentClass wrap(bt_self_component_class_source * const libObjPtr) noexcept
208 return SelfComponentClass {libObjPtr};
211 inline SelfComponentClass wrap(bt_self_component_class_filter * const libObjPtr) noexcept
213 return SelfComponentClass {libObjPtr};
216 inline SelfComponentClass wrap(bt_self_component_class_sink * const libObjPtr) noexcept
218 return SelfComponentClass {libObjPtr};
221 inline SelfComponent wrap(bt_self_component * const libObjPtr) noexcept
223 return SelfComponent {libObjPtr};
226 inline SelfSourceComponent wrap(bt_self_component_source * const libObjPtr) noexcept
228 return SelfSourceComponent {libObjPtr};
231 inline SelfFilterComponent wrap(bt_self_component_filter * const libObjPtr) noexcept
233 return SelfFilterComponent {libObjPtr};
236 inline SelfSinkComponent wrap(bt_self_component_sink * const libObjPtr) noexcept
238 return SelfSinkComponent {libObjPtr};
241 inline SelfComponentInputPort wrap(bt_self_component_port_input * const libObjPtr) noexcept
243 return SelfComponentInputPort {libObjPtr};
246 inline SelfComponentOutputPort wrap(bt_self_component_port_output * const libObjPtr) noexcept
248 return SelfComponentOutputPort {libObjPtr};
251 inline SelfMessageIterator wrap(bt_self_message_iterator * const libObjPtr) noexcept
253 return SelfMessageIterator {libObjPtr};
256 inline SelfMessageIteratorConfiguration
257 wrap(bt_self_message_iterator_configuration * const libObjPtr) noexcept
259 return SelfMessageIteratorConfiguration {libObjPtr};
262 inline Event wrap(bt_event * const libObjPtr) noexcept
264 return Event {libObjPtr};
267 inline ConstEvent wrap(const bt_event * const libObjPtr) noexcept
269 return ConstEvent {libObjPtr};
272 inline Packet wrap(bt_packet * const libObjPtr) noexcept
274 return Packet {libObjPtr};
277 inline ConstPacket wrap(const bt_packet * const libObjPtr) noexcept
279 return ConstPacket {libObjPtr};
282 inline Stream wrap(bt_stream * const libObjPtr) noexcept
284 return Stream {libObjPtr};
287 inline ConstStream wrap(const bt_stream * const libObjPtr) noexcept
289 return ConstStream {libObjPtr};
292 inline Trace wrap(bt_trace * const libObjPtr) noexcept
294 return Trace {libObjPtr};
297 inline ConstTrace wrap(const bt_trace * const libObjPtr) noexcept
299 return ConstTrace {libObjPtr};
302 inline EventClass wrap(bt_event_class * const libObjPtr) noexcept
304 return EventClass {libObjPtr};
307 inline ConstEventClass wrap(const bt_event_class * const libObjPtr) noexcept
309 return ConstEventClass {libObjPtr};
312 inline StreamClass wrap(bt_stream_class * const libObjPtr) noexcept
314 return StreamClass {libObjPtr};
317 inline ConstStreamClass wrap(const bt_stream_class * const libObjPtr) noexcept
319 return ConstStreamClass {libObjPtr};
322 inline TraceClass wrap(bt_trace_class * const libObjPtr) noexcept
324 return TraceClass {libObjPtr};
327 inline ConstTraceClass wrap(const bt_trace_class * const libObjPtr) noexcept
329 return ConstTraceClass {libObjPtr};
332 inline Value wrap(bt_value * const libObjPtr) noexcept
334 return Value {libObjPtr};
337 inline ConstValue wrap(const bt_value * const libObjPtr) noexcept
339 return ConstValue {libObjPtr};
342 inline OptionalBorrowedObject<ClockClass> wrapOptional(bt_clock_class * const libObjPtr) noexcept
347 inline OptionalBorrowedObject<ConstClockClass>
348 wrapOptional(const bt_clock_class * const libObjPtr) noexcept
353 inline OptionalBorrowedObject<ConstClockSnapshot>
354 wrapOptional(const bt_clock_snapshot * const libObjPtr) noexcept
359 inline OptionalBorrowedObject<ConstComponent>
360 wrapOptional(const bt_component * const libObjPtr) noexcept
365 inline OptionalBorrowedObject<ConstSourceComponent>
366 wrapOptional(const bt_component_source * const libObjPtr) noexcept
371 inline OptionalBorrowedObject<ConstFilterComponent>
372 wrapOptional(const bt_component_filter * const libObjPtr) noexcept
377 inline OptionalBorrowedObject<ConstSinkComponent>
378 wrapOptional(const bt_component_sink * const libObjPtr) noexcept
383 inline OptionalBorrowedObject<ConstInputPort>
384 wrapOptional(const bt_port_input * const libObjPtr) noexcept
389 inline OptionalBorrowedObject<ConstOutputPort>
390 wrapOptional(const bt_port_output * const libObjPtr) noexcept
395 inline OptionalBorrowedObject<FieldClass> wrapOptional(bt_field_class * const libObjPtr) noexcept
400 inline OptionalBorrowedObject<ConstFieldClass>
401 wrapOptional(const bt_field_class * const libObjPtr) noexcept
406 inline OptionalBorrowedObject<ConstFieldPathItem>
407 wrapOptional(const bt_field_path_item * const libObjPtr) noexcept
412 inline OptionalBorrowedObject<ConstFieldPath>
413 wrapOptional(const bt_field_path * const libObjPtr) noexcept
418 inline OptionalBorrowedObject<Field> wrapOptional(bt_field * const libObjPtr) noexcept
423 inline OptionalBorrowedObject<ConstField> wrapOptional(const bt_field * const libObjPtr) noexcept
428 inline OptionalBorrowedObject<UnsignedIntegerRangeSet>
429 wrapOptional(bt_integer_range_set_unsigned * const libObjPtr) noexcept
434 inline OptionalBorrowedObject<ConstUnsignedIntegerRangeSet>
435 wrapOptional(const bt_integer_range_set_unsigned * const libObjPtr) noexcept
440 inline OptionalBorrowedObject<SignedIntegerRangeSet>
441 wrapOptional(bt_integer_range_set_signed * const libObjPtr) noexcept
446 inline OptionalBorrowedObject<ConstSignedIntegerRangeSet>
447 wrapOptional(const bt_integer_range_set_signed * const libObjPtr) noexcept
452 inline OptionalBorrowedObject<ConstUnsignedIntegerRange>
453 wrapOptional(const bt_integer_range_unsigned * const libObjPtr) noexcept
458 inline OptionalBorrowedObject<ConstSignedIntegerRange>
459 wrapOptional(const bt_integer_range_signed * const libObjPtr) noexcept
464 inline OptionalBorrowedObject<MessageIterator>
465 wrapOptional(bt_message_iterator * const libObjPtr) noexcept
470 inline OptionalBorrowedObject<Message> wrapOptional(bt_message * const libObjPtr) noexcept
475 inline OptionalBorrowedObject<ConstMessage>
476 wrapOptional(const bt_message * const libObjPtr) noexcept
481 inline OptionalBorrowedObject<PrivateQueryExecutor>
482 wrapOptional(bt_private_query_executor * const libObjPtr) noexcept
487 inline OptionalBorrowedObject<SelfComponentClass>
488 wrapOptional(bt_self_component_class * const libObjPtr) noexcept
493 inline OptionalBorrowedObject<SelfComponentClass>
494 wrapOptional(bt_self_component_class_source * const libObjPtr) noexcept
496 return bt_self_component_class_source_as_self_component_class(libObjPtr);
499 inline OptionalBorrowedObject<SelfComponentClass>
500 wrapOptional(bt_self_component_class_filter * const libObjPtr) noexcept
502 return bt_self_component_class_filter_as_self_component_class(libObjPtr);
505 inline OptionalBorrowedObject<SelfComponentClass>
506 wrapOptional(bt_self_component_class_sink * const libObjPtr) noexcept
508 return bt_self_component_class_sink_as_self_component_class(libObjPtr);
511 inline OptionalBorrowedObject<SelfComponent>
512 wrapOptional(bt_self_component * const libObjPtr) noexcept
517 inline OptionalBorrowedObject<SelfSourceComponent>
518 wrapOptional(bt_self_component_source * const libObjPtr) noexcept
523 inline OptionalBorrowedObject<SelfFilterComponent>
524 wrapOptional(bt_self_component_filter * const libObjPtr) noexcept
529 inline OptionalBorrowedObject<SelfSinkComponent>
530 wrapOptional(bt_self_component_sink * const libObjPtr) noexcept
535 inline OptionalBorrowedObject<SelfComponentInputPort>
536 wrapOptional(bt_self_component_port_input * const libObjPtr) noexcept
541 inline OptionalBorrowedObject<SelfComponentOutputPort>
542 wrapOptional(bt_self_component_port_output * const libObjPtr) noexcept
547 inline OptionalBorrowedObject<SelfMessageIterator>
548 wrapOptional(bt_self_message_iterator * const libObjPtr) noexcept
553 inline OptionalBorrowedObject<SelfMessageIteratorConfiguration>
554 wrapOptional(bt_self_message_iterator_configuration * const libObjPtr) noexcept
559 inline OptionalBorrowedObject<Event> wrapOptional(bt_event * const libObjPtr) noexcept
564 inline OptionalBorrowedObject<ConstEvent> wrapOptional(const bt_event * const libObjPtr) noexcept
569 inline OptionalBorrowedObject<Packet> wrapOptional(bt_packet * const libObjPtr) noexcept
574 inline OptionalBorrowedObject<ConstPacket> wrapOptional(const bt_packet * const libObjPtr) noexcept
579 inline OptionalBorrowedObject<Stream> wrapOptional(bt_stream * const libObjPtr) noexcept
584 inline OptionalBorrowedObject<ConstStream> wrapOptional(const bt_stream * const libObjPtr) noexcept
589 inline OptionalBorrowedObject<Trace> wrapOptional(bt_trace * const libObjPtr) noexcept
594 inline OptionalBorrowedObject<ConstTrace> wrapOptional(const bt_trace * const libObjPtr) noexcept
599 inline OptionalBorrowedObject<EventClass> wrapOptional(bt_event_class * const libObjPtr) noexcept
604 inline OptionalBorrowedObject<ConstEventClass>
605 wrapOptional(const bt_event_class * const libObjPtr) noexcept
610 inline OptionalBorrowedObject<StreamClass> wrapOptional(bt_stream_class * const libObjPtr) noexcept
615 inline OptionalBorrowedObject<ConstStreamClass>
616 wrapOptional(const bt_stream_class * const libObjPtr) noexcept
621 inline OptionalBorrowedObject<TraceClass> wrapOptional(bt_trace_class * const libObjPtr) noexcept
626 inline OptionalBorrowedObject<ConstTraceClass>
627 wrapOptional(const bt_trace_class * const libObjPtr) noexcept
632 inline OptionalBorrowedObject<Value> wrapOptional(bt_value * const libObjPtr) noexcept
637 inline OptionalBorrowedObject<ConstValue> wrapOptional(const bt_value * const libObjPtr) noexcept
642 } /* namespace bt2 */
644 #endif /* BABELTRACE_CPP_COMMON_BT2_WRAP_HPP */