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"
17 #include "integer-range-set.hpp"
18 #include "integer-range.hpp"
19 #include "message-iterator.hpp"
20 #include "message.hpp"
21 #include "optional-borrowed-object.hpp"
22 #include "private-query-executor.hpp"
23 #include "self-component-class.hpp"
24 #include "self-component-port.hpp"
25 #include "self-message-iterator-configuration.hpp"
26 #include "self-message-iterator.hpp"
27 #include "trace-ir.hpp"
32 inline ClockClass wrap(bt_clock_class * const libObjPtr) noexcept
34 return ClockClass {libObjPtr};
37 inline ConstClockClass wrap(const bt_clock_class * const libObjPtr) noexcept
39 return ConstClockClass {libObjPtr};
42 inline ConstClockSnapshot wrap(const bt_clock_snapshot * const libObjPtr) noexcept
44 return ConstClockSnapshot {libObjPtr};
47 inline ConstComponent wrap(const bt_component * const libObjPtr) noexcept
49 return ConstComponent {libObjPtr};
52 inline ConstSourceComponent wrap(const bt_component_source * const libObjPtr) noexcept
54 return ConstSourceComponent {libObjPtr};
57 inline ConstFilterComponent wrap(const bt_component_filter * const libObjPtr) noexcept
59 return ConstFilterComponent {libObjPtr};
62 inline ConstSinkComponent wrap(const bt_component_sink * const libObjPtr) noexcept
64 return ConstSinkComponent {libObjPtr};
67 inline ConstInputPort wrap(const bt_port_input * const libObjPtr) noexcept
69 return ConstInputPort {libObjPtr};
72 inline ConstOutputPort wrap(const bt_port_output * const libObjPtr) noexcept
74 return ConstOutputPort {libObjPtr};
77 inline ConstUnsignedEnumerationFieldClassMapping
78 wrap(const bt_field_class_enumeration_unsigned_mapping * const libObjPtr) noexcept
80 return ConstUnsignedEnumerationFieldClassMapping {libObjPtr};
83 inline ConstSignedEnumerationFieldClassMapping
84 wrap(const bt_field_class_enumeration_signed_mapping * const libObjPtr) noexcept
86 return ConstSignedEnumerationFieldClassMapping {libObjPtr};
89 inline VariantFieldClassOption wrap(bt_field_class_variant_option * const libObjPtr) noexcept
91 return VariantFieldClassOption {libObjPtr};
94 inline ConstVariantFieldClassOption
95 wrap(const bt_field_class_variant_option * const libObjPtr) noexcept
97 return ConstVariantFieldClassOption {libObjPtr};
100 inline ConstVariantWithUnsignedIntegerSelectorFieldClassOption
101 wrap(const bt_field_class_variant_with_selector_field_integer_unsigned_option
102 * const libObjPtr) noexcept
104 return ConstVariantWithUnsignedIntegerSelectorFieldClassOption {libObjPtr};
107 inline ConstVariantWithSignedIntegerSelectorFieldClassOption
108 wrap(const bt_field_class_variant_with_selector_field_integer_signed_option
109 * const libObjPtr) noexcept
111 return ConstVariantWithSignedIntegerSelectorFieldClassOption {libObjPtr};
114 inline FieldClass wrap(bt_field_class * const libObjPtr) noexcept
116 return FieldClass {libObjPtr};
119 inline ConstFieldClass wrap(const bt_field_class * const libObjPtr) noexcept
121 return ConstFieldClass {libObjPtr};
124 inline ConstFieldPathItem wrap(const bt_field_path_item * const libObjPtr) noexcept
126 return ConstFieldPathItem {libObjPtr};
129 inline ConstFieldPath wrap(const bt_field_path * const libObjPtr) noexcept
131 return ConstFieldPath {libObjPtr};
134 inline Field wrap(bt_field * const libObjPtr) noexcept
136 return Field {libObjPtr};
139 inline ConstField wrap(const bt_field * const libObjPtr) noexcept
141 return ConstField {libObjPtr};
144 inline UnsignedIntegerRangeSet wrap(bt_integer_range_set_unsigned * const libObjPtr) noexcept
146 return UnsignedIntegerRangeSet {libObjPtr};
149 inline ConstUnsignedIntegerRangeSet
150 wrap(const bt_integer_range_set_unsigned * const libObjPtr) noexcept
152 return ConstUnsignedIntegerRangeSet {libObjPtr};
155 inline SignedIntegerRangeSet wrap(bt_integer_range_set_signed * const libObjPtr) noexcept
157 return SignedIntegerRangeSet {libObjPtr};
160 inline ConstSignedIntegerRangeSet wrap(const bt_integer_range_set_signed * const libObjPtr) noexcept
162 return ConstSignedIntegerRangeSet {libObjPtr};
165 inline ConstUnsignedIntegerRange wrap(const bt_integer_range_unsigned * const libObjPtr) noexcept
167 return ConstUnsignedIntegerRange {libObjPtr};
170 inline ConstSignedIntegerRange wrap(const bt_integer_range_signed * const libObjPtr) noexcept
172 return ConstSignedIntegerRange {libObjPtr};
175 inline MessageIterator wrap(bt_message_iterator * const libObjPtr) noexcept
177 return MessageIterator {libObjPtr};
180 inline Message wrap(bt_message * const libObjPtr) noexcept
182 return Message {libObjPtr};
185 inline ConstMessage wrap(const bt_message * const libObjPtr) noexcept
187 return ConstMessage {libObjPtr};
190 inline PrivateQueryExecutor wrap(bt_private_query_executor * const libObjPtr) noexcept
192 return PrivateQueryExecutor {libObjPtr};
195 inline SelfComponentClass wrap(bt_self_component_class * const libObjPtr) noexcept
197 return SelfComponentClass {libObjPtr};
200 inline SelfComponentClass wrap(bt_self_component_class_source * const libObjPtr) noexcept
202 return SelfComponentClass {libObjPtr};
205 inline SelfComponentClass wrap(bt_self_component_class_filter * const libObjPtr) noexcept
207 return SelfComponentClass {libObjPtr};
210 inline SelfComponentClass wrap(bt_self_component_class_sink * const libObjPtr) noexcept
212 return SelfComponentClass {libObjPtr};
215 inline SelfComponent wrap(bt_self_component * const libObjPtr) noexcept
217 return SelfComponent {libObjPtr};
220 inline SelfSourceComponent wrap(bt_self_component_source * const libObjPtr) noexcept
222 return SelfSourceComponent {libObjPtr};
225 inline SelfFilterComponent wrap(bt_self_component_filter * const libObjPtr) noexcept
227 return SelfFilterComponent {libObjPtr};
230 inline SelfSinkComponent wrap(bt_self_component_sink * const libObjPtr) noexcept
232 return SelfSinkComponent {libObjPtr};
235 inline SelfComponentInputPort wrap(bt_self_component_port_input * const libObjPtr) noexcept
237 return SelfComponentInputPort {libObjPtr};
240 inline SelfComponentOutputPort wrap(bt_self_component_port_output * const libObjPtr) noexcept
242 return SelfComponentOutputPort {libObjPtr};
245 inline SelfMessageIterator wrap(bt_self_message_iterator * const libObjPtr) noexcept
247 return SelfMessageIterator {libObjPtr};
250 inline SelfMessageIteratorConfiguration
251 wrap(bt_self_message_iterator_configuration * const libObjPtr) noexcept
253 return SelfMessageIteratorConfiguration {libObjPtr};
256 inline Event wrap(bt_event * const libObjPtr) noexcept
258 return Event {libObjPtr};
261 inline ConstEvent wrap(const bt_event * const libObjPtr) noexcept
263 return ConstEvent {libObjPtr};
266 inline Packet wrap(bt_packet * const libObjPtr) noexcept
268 return Packet {libObjPtr};
271 inline ConstPacket wrap(const bt_packet * const libObjPtr) noexcept
273 return ConstPacket {libObjPtr};
276 inline Stream wrap(bt_stream * const libObjPtr) noexcept
278 return Stream {libObjPtr};
281 inline ConstStream wrap(const bt_stream * const libObjPtr) noexcept
283 return ConstStream {libObjPtr};
286 inline Trace wrap(bt_trace * const libObjPtr) noexcept
288 return Trace {libObjPtr};
291 inline ConstTrace wrap(const bt_trace * const libObjPtr) noexcept
293 return ConstTrace {libObjPtr};
296 inline EventClass wrap(bt_event_class * const libObjPtr) noexcept
298 return EventClass {libObjPtr};
301 inline ConstEventClass wrap(const bt_event_class * const libObjPtr) noexcept
303 return ConstEventClass {libObjPtr};
306 inline StreamClass wrap(bt_stream_class * const libObjPtr) noexcept
308 return StreamClass {libObjPtr};
311 inline ConstStreamClass wrap(const bt_stream_class * const libObjPtr) noexcept
313 return ConstStreamClass {libObjPtr};
316 inline TraceClass wrap(bt_trace_class * const libObjPtr) noexcept
318 return TraceClass {libObjPtr};
321 inline ConstTraceClass wrap(const bt_trace_class * const libObjPtr) noexcept
323 return ConstTraceClass {libObjPtr};
326 inline Value wrap(bt_value * const libObjPtr) noexcept
328 return Value {libObjPtr};
331 inline ConstValue wrap(const bt_value * const libObjPtr) noexcept
333 return ConstValue {libObjPtr};
336 inline OptionalBorrowedObject<ClockClass> wrapOptional(bt_clock_class * const libObjPtr) noexcept
341 inline OptionalBorrowedObject<ConstClockClass>
342 wrapOptional(const bt_clock_class * const libObjPtr) noexcept
347 inline OptionalBorrowedObject<ConstClockSnapshot>
348 wrapOptional(const bt_clock_snapshot * const libObjPtr) noexcept
353 inline OptionalBorrowedObject<ConstComponent>
354 wrapOptional(const bt_component * const libObjPtr) noexcept
359 inline OptionalBorrowedObject<ConstSourceComponent>
360 wrapOptional(const bt_component_source * const libObjPtr) noexcept
365 inline OptionalBorrowedObject<ConstFilterComponent>
366 wrapOptional(const bt_component_filter * const libObjPtr) noexcept
371 inline OptionalBorrowedObject<ConstSinkComponent>
372 wrapOptional(const bt_component_sink * const libObjPtr) noexcept
377 inline OptionalBorrowedObject<ConstInputPort>
378 wrapOptional(const bt_port_input * const libObjPtr) noexcept
383 inline OptionalBorrowedObject<ConstOutputPort>
384 wrapOptional(const bt_port_output * const libObjPtr) noexcept
389 inline OptionalBorrowedObject<FieldClass> wrapOptional(bt_field_class * const libObjPtr) noexcept
394 inline OptionalBorrowedObject<ConstFieldClass>
395 wrapOptional(const bt_field_class * const libObjPtr) noexcept
400 inline OptionalBorrowedObject<ConstFieldPathItem>
401 wrapOptional(const bt_field_path_item * const libObjPtr) noexcept
406 inline OptionalBorrowedObject<ConstFieldPath>
407 wrapOptional(const bt_field_path * const libObjPtr) noexcept
412 inline OptionalBorrowedObject<Field> wrapOptional(bt_field * const libObjPtr) noexcept
417 inline OptionalBorrowedObject<ConstField> wrapOptional(const bt_field * const libObjPtr) noexcept
422 inline OptionalBorrowedObject<UnsignedIntegerRangeSet>
423 wrapOptional(bt_integer_range_set_unsigned * const libObjPtr) noexcept
428 inline OptionalBorrowedObject<ConstUnsignedIntegerRangeSet>
429 wrapOptional(const bt_integer_range_set_unsigned * const libObjPtr) noexcept
434 inline OptionalBorrowedObject<SignedIntegerRangeSet>
435 wrapOptional(bt_integer_range_set_signed * const libObjPtr) noexcept
440 inline OptionalBorrowedObject<ConstSignedIntegerRangeSet>
441 wrapOptional(const bt_integer_range_set_signed * const libObjPtr) noexcept
446 inline OptionalBorrowedObject<ConstUnsignedIntegerRange>
447 wrapOptional(const bt_integer_range_unsigned * const libObjPtr) noexcept
452 inline OptionalBorrowedObject<ConstSignedIntegerRange>
453 wrapOptional(const bt_integer_range_signed * const libObjPtr) noexcept
458 inline OptionalBorrowedObject<MessageIterator>
459 wrapOptional(bt_message_iterator * const libObjPtr) noexcept
464 inline OptionalBorrowedObject<Message> wrapOptional(bt_message * const libObjPtr) noexcept
469 inline OptionalBorrowedObject<ConstMessage>
470 wrapOptional(const bt_message * const libObjPtr) noexcept
475 inline OptionalBorrowedObject<PrivateQueryExecutor>
476 wrapOptional(bt_private_query_executor * const libObjPtr) noexcept
481 inline OptionalBorrowedObject<SelfComponentClass>
482 wrapOptional(bt_self_component_class * const libObjPtr) noexcept
487 inline OptionalBorrowedObject<SelfComponentClass>
488 wrapOptional(bt_self_component_class_source * const libObjPtr) noexcept
490 return bt_self_component_class_source_as_self_component_class(libObjPtr);
493 inline OptionalBorrowedObject<SelfComponentClass>
494 wrapOptional(bt_self_component_class_filter * const libObjPtr) noexcept
496 return bt_self_component_class_filter_as_self_component_class(libObjPtr);
499 inline OptionalBorrowedObject<SelfComponentClass>
500 wrapOptional(bt_self_component_class_sink * const libObjPtr) noexcept
502 return bt_self_component_class_sink_as_self_component_class(libObjPtr);
505 inline OptionalBorrowedObject<SelfComponent>
506 wrapOptional(bt_self_component * const libObjPtr) noexcept
511 inline OptionalBorrowedObject<SelfSourceComponent>
512 wrapOptional(bt_self_component_source * const libObjPtr) noexcept
517 inline OptionalBorrowedObject<SelfFilterComponent>
518 wrapOptional(bt_self_component_filter * const libObjPtr) noexcept
523 inline OptionalBorrowedObject<SelfSinkComponent>
524 wrapOptional(bt_self_component_sink * const libObjPtr) noexcept
529 inline OptionalBorrowedObject<SelfComponentInputPort>
530 wrapOptional(bt_self_component_port_input * const libObjPtr) noexcept
535 inline OptionalBorrowedObject<SelfComponentOutputPort>
536 wrapOptional(bt_self_component_port_output * const libObjPtr) noexcept
541 inline OptionalBorrowedObject<SelfMessageIterator>
542 wrapOptional(bt_self_message_iterator * const libObjPtr) noexcept
547 inline OptionalBorrowedObject<SelfMessageIteratorConfiguration>
548 wrapOptional(bt_self_message_iterator_configuration * const libObjPtr) noexcept
553 inline OptionalBorrowedObject<Event> wrapOptional(bt_event * const libObjPtr) noexcept
558 inline OptionalBorrowedObject<ConstEvent> wrapOptional(const bt_event * const libObjPtr) noexcept
563 inline OptionalBorrowedObject<Packet> wrapOptional(bt_packet * const libObjPtr) noexcept
568 inline OptionalBorrowedObject<ConstPacket> wrapOptional(const bt_packet * const libObjPtr) noexcept
573 inline OptionalBorrowedObject<Stream> wrapOptional(bt_stream * const libObjPtr) noexcept
578 inline OptionalBorrowedObject<ConstStream> wrapOptional(const bt_stream * const libObjPtr) noexcept
583 inline OptionalBorrowedObject<Trace> wrapOptional(bt_trace * const libObjPtr) noexcept
588 inline OptionalBorrowedObject<ConstTrace> wrapOptional(const bt_trace * const libObjPtr) noexcept
593 inline OptionalBorrowedObject<EventClass> wrapOptional(bt_event_class * const libObjPtr) noexcept
598 inline OptionalBorrowedObject<ConstEventClass>
599 wrapOptional(const bt_event_class * const libObjPtr) noexcept
604 inline OptionalBorrowedObject<StreamClass> wrapOptional(bt_stream_class * const libObjPtr) noexcept
609 inline OptionalBorrowedObject<ConstStreamClass>
610 wrapOptional(const bt_stream_class * const libObjPtr) noexcept
615 inline OptionalBorrowedObject<TraceClass> wrapOptional(bt_trace_class * const libObjPtr) noexcept
620 inline OptionalBorrowedObject<ConstTraceClass>
621 wrapOptional(const bt_trace_class * const libObjPtr) noexcept
626 inline OptionalBorrowedObject<Value> wrapOptional(bt_value * const libObjPtr) noexcept
631 inline OptionalBorrowedObject<ConstValue> wrapOptional(const bt_value * const libObjPtr) noexcept
636 } /* namespace bt2 */
638 #endif /* BABELTRACE_CPP_COMMON_BT2_WRAP_HPP */