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"
19 #include "integer-range-set.hpp"
20 #include "integer-range.hpp"
21 #include "message-iterator.hpp"
22 #include "message.hpp"
23 #include "optional-borrowed-object.hpp"
24 #include "private-query-executor.hpp"
25 #include "self-component-class.hpp"
26 #include "self-component-port.hpp"
27 #include "self-message-iterator-configuration.hpp"
28 #include "self-message-iterator.hpp"
29 #include "trace-ir.hpp"
34 inline ConstErrorCause wrap(const bt_error_cause * const libObjPtr) noexcept
36 return ConstErrorCause {libObjPtr};
39 inline Graph wrap(bt_graph * const libObjPtr) noexcept
41 return Graph {libObjPtr};
44 inline ClockClass wrap(bt_clock_class * const libObjPtr) noexcept
46 return ClockClass {libObjPtr};
49 inline ConstClockClass wrap(const bt_clock_class * const libObjPtr) noexcept
51 return ConstClockClass {libObjPtr};
54 inline ConstClockSnapshot wrap(const bt_clock_snapshot * const libObjPtr) noexcept
56 return ConstClockSnapshot {libObjPtr};
59 inline ConstComponent wrap(const bt_component * const libObjPtr) noexcept
61 return ConstComponent {libObjPtr};
64 inline ConstSourceComponent wrap(const bt_component_source * const libObjPtr) noexcept
66 return ConstSourceComponent {libObjPtr};
69 inline ConstFilterComponent wrap(const bt_component_filter * const libObjPtr) noexcept
71 return ConstFilterComponent {libObjPtr};
74 inline ConstSinkComponent wrap(const bt_component_sink * const libObjPtr) noexcept
76 return ConstSinkComponent {libObjPtr};
79 inline ConstInputPort wrap(const bt_port_input * const libObjPtr) noexcept
81 return ConstInputPort {libObjPtr};
84 inline ConstOutputPort wrap(const bt_port_output * const libObjPtr) noexcept
86 return ConstOutputPort {libObjPtr};
89 inline ConstUnsignedEnumerationFieldClassMapping
90 wrap(const bt_field_class_enumeration_unsigned_mapping * const libObjPtr) noexcept
92 return ConstUnsignedEnumerationFieldClassMapping {libObjPtr};
95 inline ConstSignedEnumerationFieldClassMapping
96 wrap(const bt_field_class_enumeration_signed_mapping * const libObjPtr) noexcept
98 return ConstSignedEnumerationFieldClassMapping {libObjPtr};
101 inline VariantFieldClassOption wrap(bt_field_class_variant_option * const libObjPtr) noexcept
103 return VariantFieldClassOption {libObjPtr};
106 inline ConstVariantFieldClassOption
107 wrap(const bt_field_class_variant_option * const libObjPtr) noexcept
109 return ConstVariantFieldClassOption {libObjPtr};
112 inline ConstVariantWithUnsignedIntegerSelectorFieldClassOption
113 wrap(const bt_field_class_variant_with_selector_field_integer_unsigned_option
114 * const libObjPtr) noexcept
116 return ConstVariantWithUnsignedIntegerSelectorFieldClassOption {libObjPtr};
119 inline ConstVariantWithSignedIntegerSelectorFieldClassOption
120 wrap(const bt_field_class_variant_with_selector_field_integer_signed_option
121 * const libObjPtr) noexcept
123 return ConstVariantWithSignedIntegerSelectorFieldClassOption {libObjPtr};
126 inline FieldClass wrap(bt_field_class * const libObjPtr) noexcept
128 return FieldClass {libObjPtr};
131 inline ConstFieldClass wrap(const bt_field_class * const libObjPtr) noexcept
133 return ConstFieldClass {libObjPtr};
136 inline ConstFieldPathItem wrap(const bt_field_path_item * const libObjPtr) noexcept
138 return ConstFieldPathItem {libObjPtr};
141 inline ConstFieldPath wrap(const bt_field_path * const libObjPtr) noexcept
143 return ConstFieldPath {libObjPtr};
146 inline Field wrap(bt_field * const libObjPtr) noexcept
148 return Field {libObjPtr};
151 inline ConstField wrap(const bt_field * const libObjPtr) noexcept
153 return ConstField {libObjPtr};
156 inline UnsignedIntegerRangeSet wrap(bt_integer_range_set_unsigned * const libObjPtr) noexcept
158 return UnsignedIntegerRangeSet {libObjPtr};
161 inline ConstUnsignedIntegerRangeSet
162 wrap(const bt_integer_range_set_unsigned * const libObjPtr) noexcept
164 return ConstUnsignedIntegerRangeSet {libObjPtr};
167 inline SignedIntegerRangeSet wrap(bt_integer_range_set_signed * const libObjPtr) noexcept
169 return SignedIntegerRangeSet {libObjPtr};
172 inline ConstSignedIntegerRangeSet wrap(const bt_integer_range_set_signed * const libObjPtr) noexcept
174 return ConstSignedIntegerRangeSet {libObjPtr};
177 inline ConstUnsignedIntegerRange wrap(const bt_integer_range_unsigned * const libObjPtr) noexcept
179 return ConstUnsignedIntegerRange {libObjPtr};
182 inline ConstSignedIntegerRange wrap(const bt_integer_range_signed * const libObjPtr) noexcept
184 return ConstSignedIntegerRange {libObjPtr};
187 inline MessageIterator wrap(bt_message_iterator * const libObjPtr) noexcept
189 return MessageIterator {libObjPtr};
192 inline Message wrap(bt_message * const libObjPtr) noexcept
194 return Message {libObjPtr};
197 inline ConstMessage wrap(const bt_message * const libObjPtr) noexcept
199 return ConstMessage {libObjPtr};
202 inline PrivateQueryExecutor wrap(bt_private_query_executor * const libObjPtr) noexcept
204 return PrivateQueryExecutor {libObjPtr};
207 inline SelfComponentClass wrap(bt_self_component_class * const libObjPtr) noexcept
209 return SelfComponentClass {libObjPtr};
212 inline SelfComponentClass wrap(bt_self_component_class_source * const libObjPtr) noexcept
214 return SelfComponentClass {libObjPtr};
217 inline SelfComponentClass wrap(bt_self_component_class_filter * const libObjPtr) noexcept
219 return SelfComponentClass {libObjPtr};
222 inline SelfComponentClass wrap(bt_self_component_class_sink * const libObjPtr) noexcept
224 return SelfComponentClass {libObjPtr};
227 inline SelfComponent wrap(bt_self_component * const libObjPtr) noexcept
229 return SelfComponent {libObjPtr};
232 inline SelfSourceComponent wrap(bt_self_component_source * const libObjPtr) noexcept
234 return SelfSourceComponent {libObjPtr};
237 inline SelfFilterComponent wrap(bt_self_component_filter * const libObjPtr) noexcept
239 return SelfFilterComponent {libObjPtr};
242 inline SelfSinkComponent wrap(bt_self_component_sink * const libObjPtr) noexcept
244 return SelfSinkComponent {libObjPtr};
247 inline SelfComponentInputPort wrap(bt_self_component_port_input * const libObjPtr) noexcept
249 return SelfComponentInputPort {libObjPtr};
252 inline SelfComponentOutputPort wrap(bt_self_component_port_output * const libObjPtr) noexcept
254 return SelfComponentOutputPort {libObjPtr};
257 inline SelfMessageIterator wrap(bt_self_message_iterator * const libObjPtr) noexcept
259 return SelfMessageIterator {libObjPtr};
262 inline SelfMessageIteratorConfiguration
263 wrap(bt_self_message_iterator_configuration * const libObjPtr) noexcept
265 return SelfMessageIteratorConfiguration {libObjPtr};
268 inline Event wrap(bt_event * const libObjPtr) noexcept
270 return Event {libObjPtr};
273 inline ConstEvent wrap(const bt_event * const libObjPtr) noexcept
275 return ConstEvent {libObjPtr};
278 inline Packet wrap(bt_packet * const libObjPtr) noexcept
280 return Packet {libObjPtr};
283 inline ConstPacket wrap(const bt_packet * const libObjPtr) noexcept
285 return ConstPacket {libObjPtr};
288 inline Stream wrap(bt_stream * const libObjPtr) noexcept
290 return Stream {libObjPtr};
293 inline ConstStream wrap(const bt_stream * const libObjPtr) noexcept
295 return ConstStream {libObjPtr};
298 inline Trace wrap(bt_trace * const libObjPtr) noexcept
300 return Trace {libObjPtr};
303 inline ConstTrace wrap(const bt_trace * const libObjPtr) noexcept
305 return ConstTrace {libObjPtr};
308 inline EventClass wrap(bt_event_class * const libObjPtr) noexcept
310 return EventClass {libObjPtr};
313 inline ConstEventClass wrap(const bt_event_class * const libObjPtr) noexcept
315 return ConstEventClass {libObjPtr};
318 inline StreamClass wrap(bt_stream_class * const libObjPtr) noexcept
320 return StreamClass {libObjPtr};
323 inline ConstStreamClass wrap(const bt_stream_class * const libObjPtr) noexcept
325 return ConstStreamClass {libObjPtr};
328 inline TraceClass wrap(bt_trace_class * const libObjPtr) noexcept
330 return TraceClass {libObjPtr};
333 inline ConstTraceClass wrap(const bt_trace_class * const libObjPtr) noexcept
335 return ConstTraceClass {libObjPtr};
338 inline Value wrap(bt_value * const libObjPtr) noexcept
340 return Value {libObjPtr};
343 inline ConstValue wrap(const bt_value * const libObjPtr) noexcept
345 return ConstValue {libObjPtr};
348 inline OptionalBorrowedObject<ClockClass> wrapOptional(bt_clock_class * const libObjPtr) noexcept
353 inline OptionalBorrowedObject<ConstClockClass>
354 wrapOptional(const bt_clock_class * const libObjPtr) noexcept
359 inline OptionalBorrowedObject<ConstClockSnapshot>
360 wrapOptional(const bt_clock_snapshot * const libObjPtr) noexcept
365 inline OptionalBorrowedObject<ConstComponent>
366 wrapOptional(const bt_component * const libObjPtr) noexcept
371 inline OptionalBorrowedObject<ConstSourceComponent>
372 wrapOptional(const bt_component_source * const libObjPtr) noexcept
377 inline OptionalBorrowedObject<ConstFilterComponent>
378 wrapOptional(const bt_component_filter * const libObjPtr) noexcept
383 inline OptionalBorrowedObject<ConstSinkComponent>
384 wrapOptional(const bt_component_sink * const libObjPtr) noexcept
389 inline OptionalBorrowedObject<ConstInputPort>
390 wrapOptional(const bt_port_input * const libObjPtr) noexcept
395 inline OptionalBorrowedObject<ConstOutputPort>
396 wrapOptional(const bt_port_output * const libObjPtr) noexcept
401 inline OptionalBorrowedObject<FieldClass> wrapOptional(bt_field_class * const libObjPtr) noexcept
406 inline OptionalBorrowedObject<ConstFieldClass>
407 wrapOptional(const bt_field_class * const libObjPtr) noexcept
412 inline OptionalBorrowedObject<ConstFieldPathItem>
413 wrapOptional(const bt_field_path_item * const libObjPtr) noexcept
418 inline OptionalBorrowedObject<ConstFieldPath>
419 wrapOptional(const bt_field_path * const libObjPtr) noexcept
424 inline OptionalBorrowedObject<Field> wrapOptional(bt_field * const libObjPtr) noexcept
429 inline OptionalBorrowedObject<ConstField> wrapOptional(const bt_field * const libObjPtr) noexcept
434 inline OptionalBorrowedObject<UnsignedIntegerRangeSet>
435 wrapOptional(bt_integer_range_set_unsigned * const libObjPtr) noexcept
440 inline OptionalBorrowedObject<ConstUnsignedIntegerRangeSet>
441 wrapOptional(const bt_integer_range_set_unsigned * const libObjPtr) noexcept
446 inline OptionalBorrowedObject<SignedIntegerRangeSet>
447 wrapOptional(bt_integer_range_set_signed * const libObjPtr) noexcept
452 inline OptionalBorrowedObject<ConstSignedIntegerRangeSet>
453 wrapOptional(const bt_integer_range_set_signed * const libObjPtr) noexcept
458 inline OptionalBorrowedObject<ConstUnsignedIntegerRange>
459 wrapOptional(const bt_integer_range_unsigned * const libObjPtr) noexcept
464 inline OptionalBorrowedObject<ConstSignedIntegerRange>
465 wrapOptional(const bt_integer_range_signed * const libObjPtr) noexcept
470 inline OptionalBorrowedObject<MessageIterator>
471 wrapOptional(bt_message_iterator * const libObjPtr) noexcept
476 inline OptionalBorrowedObject<Message> wrapOptional(bt_message * const libObjPtr) noexcept
481 inline OptionalBorrowedObject<ConstMessage>
482 wrapOptional(const bt_message * const libObjPtr) noexcept
487 inline OptionalBorrowedObject<PrivateQueryExecutor>
488 wrapOptional(bt_private_query_executor * const libObjPtr) noexcept
493 inline OptionalBorrowedObject<SelfComponentClass>
494 wrapOptional(bt_self_component_class * const libObjPtr) noexcept
499 inline OptionalBorrowedObject<SelfComponentClass>
500 wrapOptional(bt_self_component_class_source * const libObjPtr) noexcept
502 return bt_self_component_class_source_as_self_component_class(libObjPtr);
505 inline OptionalBorrowedObject<SelfComponentClass>
506 wrapOptional(bt_self_component_class_filter * const libObjPtr) noexcept
508 return bt_self_component_class_filter_as_self_component_class(libObjPtr);
511 inline OptionalBorrowedObject<SelfComponentClass>
512 wrapOptional(bt_self_component_class_sink * const libObjPtr) noexcept
514 return bt_self_component_class_sink_as_self_component_class(libObjPtr);
517 inline OptionalBorrowedObject<SelfComponent>
518 wrapOptional(bt_self_component * const libObjPtr) noexcept
523 inline OptionalBorrowedObject<SelfSourceComponent>
524 wrapOptional(bt_self_component_source * const libObjPtr) noexcept
529 inline OptionalBorrowedObject<SelfFilterComponent>
530 wrapOptional(bt_self_component_filter * const libObjPtr) noexcept
535 inline OptionalBorrowedObject<SelfSinkComponent>
536 wrapOptional(bt_self_component_sink * const libObjPtr) noexcept
541 inline OptionalBorrowedObject<SelfComponentInputPort>
542 wrapOptional(bt_self_component_port_input * const libObjPtr) noexcept
547 inline OptionalBorrowedObject<SelfComponentOutputPort>
548 wrapOptional(bt_self_component_port_output * const libObjPtr) noexcept
553 inline OptionalBorrowedObject<SelfMessageIterator>
554 wrapOptional(bt_self_message_iterator * const libObjPtr) noexcept
559 inline OptionalBorrowedObject<SelfMessageIteratorConfiguration>
560 wrapOptional(bt_self_message_iterator_configuration * const libObjPtr) noexcept
565 inline OptionalBorrowedObject<Event> wrapOptional(bt_event * const libObjPtr) noexcept
570 inline OptionalBorrowedObject<ConstEvent> wrapOptional(const bt_event * const libObjPtr) noexcept
575 inline OptionalBorrowedObject<Packet> wrapOptional(bt_packet * const libObjPtr) noexcept
580 inline OptionalBorrowedObject<ConstPacket> wrapOptional(const bt_packet * const libObjPtr) noexcept
585 inline OptionalBorrowedObject<Stream> wrapOptional(bt_stream * const libObjPtr) noexcept
590 inline OptionalBorrowedObject<ConstStream> wrapOptional(const bt_stream * const libObjPtr) noexcept
595 inline OptionalBorrowedObject<Trace> wrapOptional(bt_trace * const libObjPtr) noexcept
600 inline OptionalBorrowedObject<ConstTrace> wrapOptional(const bt_trace * const libObjPtr) noexcept
605 inline OptionalBorrowedObject<EventClass> wrapOptional(bt_event_class * const libObjPtr) noexcept
610 inline OptionalBorrowedObject<ConstEventClass>
611 wrapOptional(const bt_event_class * const libObjPtr) noexcept
616 inline OptionalBorrowedObject<StreamClass> wrapOptional(bt_stream_class * const libObjPtr) noexcept
621 inline OptionalBorrowedObject<ConstStreamClass>
622 wrapOptional(const bt_stream_class * const libObjPtr) noexcept
627 inline OptionalBorrowedObject<TraceClass> wrapOptional(bt_trace_class * const libObjPtr) noexcept
632 inline OptionalBorrowedObject<ConstTraceClass>
633 wrapOptional(const bt_trace_class * const libObjPtr) noexcept
638 inline OptionalBorrowedObject<Value> wrapOptional(bt_value * const libObjPtr) noexcept
643 inline OptionalBorrowedObject<ConstValue> wrapOptional(const bt_value * const libObjPtr) noexcept
648 } /* namespace bt2 */
650 #endif /* BABELTRACE_CPP_COMMON_BT2_WRAP_HPP */