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"
16 #include "field-class.hpp"
17 #include "field-location.hpp"
20 #include "integer-range-set.hpp"
21 #include "integer-range.hpp"
22 #include "message-iterator.hpp"
23 #include "message.hpp"
24 #include "optional-borrowed-object.hpp"
25 #include "private-query-executor.hpp"
26 #include "self-component-class.hpp"
27 #include "self-component-port.hpp"
28 #include "self-message-iterator-configuration.hpp"
29 #include "self-message-iterator.hpp"
30 #include "trace-ir.hpp"
35 inline ConstErrorCause wrap(const bt_error_cause * const libObjPtr) noexcept
37 return ConstErrorCause {libObjPtr};
40 inline Graph wrap(bt_graph * const libObjPtr) noexcept
42 return Graph {libObjPtr};
45 inline ClockClass wrap(bt_clock_class * const libObjPtr) noexcept
47 return ClockClass {libObjPtr};
50 inline ConstClockClass wrap(const bt_clock_class * const libObjPtr) noexcept
52 return ConstClockClass {libObjPtr};
55 inline ConstClockSnapshot wrap(const bt_clock_snapshot * const libObjPtr) noexcept
57 return ConstClockSnapshot {libObjPtr};
60 inline ConstComponent wrap(const bt_component * const libObjPtr) noexcept
62 return ConstComponent {libObjPtr};
65 inline ConstSourceComponent wrap(const bt_component_source * const libObjPtr) noexcept
67 return ConstSourceComponent {libObjPtr};
70 inline ConstFilterComponent wrap(const bt_component_filter * const libObjPtr) noexcept
72 return ConstFilterComponent {libObjPtr};
75 inline ConstSinkComponent wrap(const bt_component_sink * const libObjPtr) noexcept
77 return ConstSinkComponent {libObjPtr};
80 inline ConstInputPort wrap(const bt_port_input * const libObjPtr) noexcept
82 return ConstInputPort {libObjPtr};
85 inline ConstOutputPort wrap(const bt_port_output * const libObjPtr) noexcept
87 return ConstOutputPort {libObjPtr};
90 inline ConstUnsignedEnumerationFieldClassMapping
91 wrap(const bt_field_class_enumeration_unsigned_mapping * const libObjPtr) noexcept
93 return ConstUnsignedEnumerationFieldClassMapping {libObjPtr};
96 inline ConstSignedEnumerationFieldClassMapping
97 wrap(const bt_field_class_enumeration_signed_mapping * const libObjPtr) noexcept
99 return ConstSignedEnumerationFieldClassMapping {libObjPtr};
102 inline VariantFieldClassOption wrap(bt_field_class_variant_option * const libObjPtr) noexcept
104 return VariantFieldClassOption {libObjPtr};
107 inline ConstVariantFieldClassOption
108 wrap(const bt_field_class_variant_option * const libObjPtr) noexcept
110 return ConstVariantFieldClassOption {libObjPtr};
113 inline ConstVariantWithUnsignedIntegerSelectorFieldClassOption
114 wrap(const bt_field_class_variant_with_selector_field_integer_unsigned_option
115 * const libObjPtr) noexcept
117 return ConstVariantWithUnsignedIntegerSelectorFieldClassOption {libObjPtr};
120 inline ConstVariantWithSignedIntegerSelectorFieldClassOption
121 wrap(const bt_field_class_variant_with_selector_field_integer_signed_option
122 * const libObjPtr) noexcept
124 return ConstVariantWithSignedIntegerSelectorFieldClassOption {libObjPtr};
127 inline FieldClass wrap(bt_field_class * const libObjPtr) noexcept
129 return FieldClass {libObjPtr};
132 inline ConstFieldClass wrap(const bt_field_class * const libObjPtr) noexcept
134 return ConstFieldClass {libObjPtr};
137 inline ConstFieldPathItem wrap(const bt_field_path_item * const libObjPtr) noexcept
139 return ConstFieldPathItem {libObjPtr};
142 inline ConstFieldLocation wrap(const bt_field_location * const libObjPtr) noexcept
144 return ConstFieldLocation {libObjPtr};
147 inline ConstFieldPath wrap(const bt_field_path * const libObjPtr) noexcept
149 return ConstFieldPath {libObjPtr};
152 inline Field wrap(bt_field * const libObjPtr) noexcept
154 return Field {libObjPtr};
157 inline ConstField wrap(const bt_field * const libObjPtr) noexcept
159 return ConstField {libObjPtr};
162 inline UnsignedIntegerRangeSet wrap(bt_integer_range_set_unsigned * const libObjPtr) noexcept
164 return UnsignedIntegerRangeSet {libObjPtr};
167 inline ConstUnsignedIntegerRangeSet
168 wrap(const bt_integer_range_set_unsigned * const libObjPtr) noexcept
170 return ConstUnsignedIntegerRangeSet {libObjPtr};
173 inline SignedIntegerRangeSet wrap(bt_integer_range_set_signed * const libObjPtr) noexcept
175 return SignedIntegerRangeSet {libObjPtr};
178 inline ConstSignedIntegerRangeSet wrap(const bt_integer_range_set_signed * const libObjPtr) noexcept
180 return ConstSignedIntegerRangeSet {libObjPtr};
183 inline ConstUnsignedIntegerRange wrap(const bt_integer_range_unsigned * const libObjPtr) noexcept
185 return ConstUnsignedIntegerRange {libObjPtr};
188 inline ConstSignedIntegerRange wrap(const bt_integer_range_signed * const libObjPtr) noexcept
190 return ConstSignedIntegerRange {libObjPtr};
193 inline MessageIterator wrap(bt_message_iterator * const libObjPtr) noexcept
195 return MessageIterator {libObjPtr};
198 inline Message wrap(bt_message * const libObjPtr) noexcept
200 return Message {libObjPtr};
203 inline ConstMessage wrap(const bt_message * const libObjPtr) noexcept
205 return ConstMessage {libObjPtr};
208 inline PrivateQueryExecutor wrap(bt_private_query_executor * const libObjPtr) noexcept
210 return PrivateQueryExecutor {libObjPtr};
213 inline SelfComponentClass wrap(bt_self_component_class * const libObjPtr) noexcept
215 return SelfComponentClass {libObjPtr};
218 inline SelfComponentClass wrap(bt_self_component_class_source * const libObjPtr) noexcept
220 return SelfComponentClass {libObjPtr};
223 inline SelfComponentClass wrap(bt_self_component_class_filter * const libObjPtr) noexcept
225 return SelfComponentClass {libObjPtr};
228 inline SelfComponentClass wrap(bt_self_component_class_sink * const libObjPtr) noexcept
230 return SelfComponentClass {libObjPtr};
233 inline SelfComponent wrap(bt_self_component * const libObjPtr) noexcept
235 return SelfComponent {libObjPtr};
238 inline SelfSourceComponent wrap(bt_self_component_source * const libObjPtr) noexcept
240 return SelfSourceComponent {libObjPtr};
243 inline SelfFilterComponent wrap(bt_self_component_filter * const libObjPtr) noexcept
245 return SelfFilterComponent {libObjPtr};
248 inline SelfSinkComponent wrap(bt_self_component_sink * const libObjPtr) noexcept
250 return SelfSinkComponent {libObjPtr};
253 inline SelfComponentInputPort wrap(bt_self_component_port_input * const libObjPtr) noexcept
255 return SelfComponentInputPort {libObjPtr};
258 inline SelfComponentOutputPort wrap(bt_self_component_port_output * const libObjPtr) noexcept
260 return SelfComponentOutputPort {libObjPtr};
263 inline SelfMessageIterator wrap(bt_self_message_iterator * const libObjPtr) noexcept
265 return SelfMessageIterator {libObjPtr};
268 inline SelfMessageIteratorConfiguration
269 wrap(bt_self_message_iterator_configuration * const libObjPtr) noexcept
271 return SelfMessageIteratorConfiguration {libObjPtr};
274 inline Event wrap(bt_event * const libObjPtr) noexcept
276 return Event {libObjPtr};
279 inline ConstEvent wrap(const bt_event * const libObjPtr) noexcept
281 return ConstEvent {libObjPtr};
284 inline Packet wrap(bt_packet * const libObjPtr) noexcept
286 return Packet {libObjPtr};
289 inline ConstPacket wrap(const bt_packet * const libObjPtr) noexcept
291 return ConstPacket {libObjPtr};
294 inline Stream wrap(bt_stream * const libObjPtr) noexcept
296 return Stream {libObjPtr};
299 inline ConstStream wrap(const bt_stream * const libObjPtr) noexcept
301 return ConstStream {libObjPtr};
304 inline Trace wrap(bt_trace * const libObjPtr) noexcept
306 return Trace {libObjPtr};
309 inline ConstTrace wrap(const bt_trace * const libObjPtr) noexcept
311 return ConstTrace {libObjPtr};
314 inline EventClass wrap(bt_event_class * const libObjPtr) noexcept
316 return EventClass {libObjPtr};
319 inline ConstEventClass wrap(const bt_event_class * const libObjPtr) noexcept
321 return ConstEventClass {libObjPtr};
324 inline StreamClass wrap(bt_stream_class * const libObjPtr) noexcept
326 return StreamClass {libObjPtr};
329 inline ConstStreamClass wrap(const bt_stream_class * const libObjPtr) noexcept
331 return ConstStreamClass {libObjPtr};
334 inline TraceClass wrap(bt_trace_class * const libObjPtr) noexcept
336 return TraceClass {libObjPtr};
339 inline ConstTraceClass wrap(const bt_trace_class * const libObjPtr) noexcept
341 return ConstTraceClass {libObjPtr};
344 inline Value wrap(bt_value * const libObjPtr) noexcept
346 return Value {libObjPtr};
349 inline ConstValue wrap(const bt_value * const libObjPtr) noexcept
351 return ConstValue {libObjPtr};
354 inline OptionalBorrowedObject<ClockClass> wrapOptional(bt_clock_class * const libObjPtr) noexcept
359 inline OptionalBorrowedObject<ConstClockClass>
360 wrapOptional(const bt_clock_class * const libObjPtr) noexcept
365 inline OptionalBorrowedObject<ConstClockSnapshot>
366 wrapOptional(const bt_clock_snapshot * const libObjPtr) noexcept
371 inline OptionalBorrowedObject<ConstComponent>
372 wrapOptional(const bt_component * const libObjPtr) noexcept
377 inline OptionalBorrowedObject<ConstSourceComponent>
378 wrapOptional(const bt_component_source * const libObjPtr) noexcept
383 inline OptionalBorrowedObject<ConstFilterComponent>
384 wrapOptional(const bt_component_filter * const libObjPtr) noexcept
389 inline OptionalBorrowedObject<ConstSinkComponent>
390 wrapOptional(const bt_component_sink * const libObjPtr) noexcept
395 inline OptionalBorrowedObject<ConstInputPort>
396 wrapOptional(const bt_port_input * const libObjPtr) noexcept
401 inline OptionalBorrowedObject<ConstOutputPort>
402 wrapOptional(const bt_port_output * const libObjPtr) noexcept
407 inline OptionalBorrowedObject<FieldClass> wrapOptional(bt_field_class * const libObjPtr) noexcept
412 inline OptionalBorrowedObject<ConstFieldClass>
413 wrapOptional(const bt_field_class * const libObjPtr) noexcept
418 inline OptionalBorrowedObject<ConstFieldPathItem>
419 wrapOptional(const bt_field_path_item * const libObjPtr) noexcept
424 inline OptionalBorrowedObject<ConstFieldPath>
425 wrapOptional(const bt_field_path * const libObjPtr) noexcept
430 inline OptionalBorrowedObject<Field> wrapOptional(bt_field * const libObjPtr) noexcept
435 inline OptionalBorrowedObject<ConstField> wrapOptional(const bt_field * const libObjPtr) noexcept
440 inline OptionalBorrowedObject<UnsignedIntegerRangeSet>
441 wrapOptional(bt_integer_range_set_unsigned * const libObjPtr) noexcept
446 inline OptionalBorrowedObject<ConstUnsignedIntegerRangeSet>
447 wrapOptional(const bt_integer_range_set_unsigned * const libObjPtr) noexcept
452 inline OptionalBorrowedObject<SignedIntegerRangeSet>
453 wrapOptional(bt_integer_range_set_signed * const libObjPtr) noexcept
458 inline OptionalBorrowedObject<ConstSignedIntegerRangeSet>
459 wrapOptional(const bt_integer_range_set_signed * const libObjPtr) noexcept
464 inline OptionalBorrowedObject<ConstUnsignedIntegerRange>
465 wrapOptional(const bt_integer_range_unsigned * const libObjPtr) noexcept
470 inline OptionalBorrowedObject<ConstSignedIntegerRange>
471 wrapOptional(const bt_integer_range_signed * const libObjPtr) noexcept
476 inline OptionalBorrowedObject<MessageIterator>
477 wrapOptional(bt_message_iterator * const libObjPtr) noexcept
482 inline OptionalBorrowedObject<Message> wrapOptional(bt_message * const libObjPtr) noexcept
487 inline OptionalBorrowedObject<ConstMessage>
488 wrapOptional(const bt_message * const libObjPtr) noexcept
493 inline OptionalBorrowedObject<PrivateQueryExecutor>
494 wrapOptional(bt_private_query_executor * const libObjPtr) noexcept
499 inline OptionalBorrowedObject<SelfComponentClass>
500 wrapOptional(bt_self_component_class * const libObjPtr) noexcept
505 inline OptionalBorrowedObject<SelfComponentClass>
506 wrapOptional(bt_self_component_class_source * const libObjPtr) noexcept
508 return bt_self_component_class_source_as_self_component_class(libObjPtr);
511 inline OptionalBorrowedObject<SelfComponentClass>
512 wrapOptional(bt_self_component_class_filter * const libObjPtr) noexcept
514 return bt_self_component_class_filter_as_self_component_class(libObjPtr);
517 inline OptionalBorrowedObject<SelfComponentClass>
518 wrapOptional(bt_self_component_class_sink * const libObjPtr) noexcept
520 return bt_self_component_class_sink_as_self_component_class(libObjPtr);
523 inline OptionalBorrowedObject<SelfComponent>
524 wrapOptional(bt_self_component * const libObjPtr) noexcept
529 inline OptionalBorrowedObject<SelfSourceComponent>
530 wrapOptional(bt_self_component_source * const libObjPtr) noexcept
535 inline OptionalBorrowedObject<SelfFilterComponent>
536 wrapOptional(bt_self_component_filter * const libObjPtr) noexcept
541 inline OptionalBorrowedObject<SelfSinkComponent>
542 wrapOptional(bt_self_component_sink * const libObjPtr) noexcept
547 inline OptionalBorrowedObject<SelfComponentInputPort>
548 wrapOptional(bt_self_component_port_input * const libObjPtr) noexcept
553 inline OptionalBorrowedObject<SelfComponentOutputPort>
554 wrapOptional(bt_self_component_port_output * const libObjPtr) noexcept
559 inline OptionalBorrowedObject<SelfMessageIterator>
560 wrapOptional(bt_self_message_iterator * const libObjPtr) noexcept
565 inline OptionalBorrowedObject<SelfMessageIteratorConfiguration>
566 wrapOptional(bt_self_message_iterator_configuration * const libObjPtr) noexcept
571 inline OptionalBorrowedObject<Event> wrapOptional(bt_event * const libObjPtr) noexcept
576 inline OptionalBorrowedObject<ConstEvent> wrapOptional(const bt_event * const libObjPtr) noexcept
581 inline OptionalBorrowedObject<Packet> wrapOptional(bt_packet * const libObjPtr) noexcept
586 inline OptionalBorrowedObject<ConstPacket> wrapOptional(const bt_packet * const libObjPtr) noexcept
591 inline OptionalBorrowedObject<Stream> wrapOptional(bt_stream * const libObjPtr) noexcept
596 inline OptionalBorrowedObject<ConstStream> wrapOptional(const bt_stream * const libObjPtr) noexcept
601 inline OptionalBorrowedObject<Trace> wrapOptional(bt_trace * const libObjPtr) noexcept
606 inline OptionalBorrowedObject<ConstTrace> wrapOptional(const bt_trace * const libObjPtr) noexcept
611 inline OptionalBorrowedObject<EventClass> wrapOptional(bt_event_class * const libObjPtr) noexcept
616 inline OptionalBorrowedObject<ConstEventClass>
617 wrapOptional(const bt_event_class * const libObjPtr) noexcept
622 inline OptionalBorrowedObject<StreamClass> wrapOptional(bt_stream_class * const libObjPtr) noexcept
627 inline OptionalBorrowedObject<ConstStreamClass>
628 wrapOptional(const bt_stream_class * const libObjPtr) noexcept
633 inline OptionalBorrowedObject<TraceClass> wrapOptional(bt_trace_class * const libObjPtr) noexcept
638 inline OptionalBorrowedObject<ConstTraceClass>
639 wrapOptional(const bt_trace_class * const libObjPtr) noexcept
644 inline OptionalBorrowedObject<Value> wrapOptional(bt_value * const libObjPtr) noexcept
649 inline OptionalBorrowedObject<ConstValue> wrapOptional(const bt_value * const libObjPtr) noexcept
654 } /* namespace bt2 */
656 #endif /* BABELTRACE_CPP_COMMON_BT2_WRAP_HPP */