cpp-common/bt2: use bt2c::CStringView in parameters and return values throughout
[babeltrace.git] / src / cpp-common / bt2 / self-component-port.hpp
1 /*
2 * Copyright (c) 2023 Philippe Proulx <pproulx@efficios.com>
3 *
4 * SPDX-License-Identifier: MIT
5 */
6
7 #ifndef BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_PORT_HPP
8 #define BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_PORT_HPP
9
10 #include <cstdint>
11 #include <string>
12
13 #include <babeltrace2/babeltrace.h>
14
15 #include "logging.hpp"
16
17 #include "common/assert.h"
18 #include "cpp-common/bt2c/c-string-view.hpp"
19
20 #include "borrowed-object-iterator.hpp"
21 #include "borrowed-object.hpp"
22 #include "component-port.hpp"
23 #include "message-iterator.hpp"
24
25 namespace bt2 {
26
27 class SelfSourceComponent;
28 class SelfFilterComponent;
29 class SelfSinkComponent;
30
31 class SelfComponent final : public BorrowedObject<bt_self_component>
32 {
33 public:
34 explicit SelfComponent(const LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr}
35 {
36 }
37
38 explicit SelfComponent(bt_self_component_source * const libObjPtr) noexcept :
39 _ThisBorrowedObject {bt_self_component_source_as_self_component(libObjPtr)}
40 {
41 }
42
43 explicit SelfComponent(bt_self_component_filter * const libObjPtr) noexcept :
44 _ThisBorrowedObject {bt_self_component_filter_as_self_component(libObjPtr)}
45 {
46 }
47
48 explicit SelfComponent(bt_self_component_sink * const libObjPtr) noexcept :
49 _ThisBorrowedObject {bt_self_component_sink_as_self_component(libObjPtr)}
50 {
51 }
52
53 /* Not `explicit` to make them behave like copy constructors */
54 SelfComponent(SelfSourceComponent other) noexcept;
55 SelfComponent(SelfFilterComponent other) noexcept;
56 SelfComponent(SelfSinkComponent other) noexcept;
57
58 SelfComponent operator=(SelfSourceComponent other) noexcept;
59 SelfComponent operator=(SelfFilterComponent other) noexcept;
60 SelfComponent operator=(SelfSinkComponent other) noexcept;
61
62 ConstComponent asConstComponent() const noexcept
63 {
64 return ConstComponent {bt_self_component_as_component(this->libObjPtr())};
65 }
66
67 bool isSource() const noexcept
68 {
69 return this->asConstComponent().isSource();
70 }
71
72 bool isFilter() const noexcept
73 {
74 return this->asConstComponent().isFilter();
75 }
76
77 bool isSink() const noexcept
78 {
79 return this->asConstComponent().isSink();
80 }
81
82 bt2c::CStringView name() const noexcept
83 {
84 return this->asConstComponent().name();
85 }
86
87 LoggingLevel loggingLevel() const noexcept
88 {
89 return this->asConstComponent().loggingLevel();
90 }
91
92 std::uint64_t graphMipVersion() const noexcept
93 {
94 return bt_self_component_get_graph_mip_version(this->libObjPtr());
95 }
96
97 template <typename T>
98 T& data() const noexcept
99 {
100 return *static_cast<T *>(bt_self_component_get_data(this->libObjPtr()));
101 }
102
103 template <typename T>
104 void data(T& obj) const noexcept
105 {
106 bt_self_component_set_data(this->libObjPtr(), static_cast<void *>(&obj));
107 }
108 };
109
110 template <typename LibObjT>
111 class SelfSpecificComponent : public BorrowedObject<LibObjT>
112 {
113 private:
114 using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
115
116 public:
117 using typename BorrowedObject<LibObjT>::LibObjPtr;
118
119 protected:
120 explicit SelfSpecificComponent(const LibObjPtr libObjPtr) noexcept :
121 _ThisBorrowedObject {libObjPtr}
122 {
123 }
124
125 template <typename PortT, typename LibPortT, typename AddPortFuncT, typename DataT>
126 PortT _addPort(const char * const name, DataT * const data, AddPortFuncT&& func) const
127 {
128 LibPortT *libPortPtr;
129
130 const auto status = func(this->libObjPtr(), name, static_cast<void *>(data), &libPortPtr);
131
132 switch (status) {
133 case BT_SELF_COMPONENT_ADD_PORT_STATUS_OK:
134 return PortT {libPortPtr};
135 case BT_SELF_COMPONENT_ADD_PORT_STATUS_MEMORY_ERROR:
136 throw MemoryError {};
137 case BT_SELF_COMPONENT_ADD_PORT_STATUS_ERROR:
138 throw Error {};
139 default:
140 bt_common_abort();
141 }
142 }
143
144 public:
145 bt2c::CStringView name() const noexcept
146 {
147 return this->_selfComponent().name();
148 }
149
150 LoggingLevel loggingLevel() const noexcept
151 {
152 return this->_selfComponent().loggingLevel();
153 }
154
155 std::uint64_t graphMipVersion() const noexcept
156 {
157 return this->_selfComponent().graphMipVersion();
158 }
159
160 template <typename T>
161 T& data() const noexcept
162 {
163 return this->_selfComponent().template data<T>();
164 }
165
166 template <typename T>
167 void data(T& obj) const noexcept
168 {
169 this->_selfComponent().data(obj);
170 }
171
172 private:
173 SelfComponent _selfComponent() const noexcept
174 {
175 return SelfComponent {this->libObjPtr()};
176 }
177 };
178
179 namespace internal {
180
181 template <typename LibSelfCompT, typename LibSelfCompPortPtrT>
182 struct SelfComponentPortsSpec;
183
184 template <>
185 struct SelfComponentPortsSpec<bt_self_component_source, bt_self_component_port_output> final
186 {
187 static std::uint64_t portCount(bt_self_component_source * const libCompPtr) noexcept
188 {
189 return bt_component_source_get_output_port_count(
190 bt_self_component_source_as_component_source(libCompPtr));
191 }
192
193 static bt_self_component_port_output *portByIndex(bt_self_component_source * const libCompPtr,
194 const std::uint64_t index) noexcept
195 {
196 return bt_self_component_source_borrow_output_port_by_index(libCompPtr, index);
197 }
198
199 static bt_self_component_port_output *portByName(bt_self_component_source * const libCompPtr,
200 const char * const name) noexcept
201 {
202 return bt_self_component_source_borrow_output_port_by_name(libCompPtr, name);
203 }
204 };
205
206 template <>
207 struct SelfComponentPortsSpec<bt_self_component_filter, bt_self_component_port_output> final
208 {
209 static std::uint64_t portCount(bt_self_component_filter * const libCompPtr) noexcept
210 {
211 return bt_component_filter_get_output_port_count(
212 bt_self_component_filter_as_component_filter(libCompPtr));
213 }
214
215 static bt_self_component_port_output *portByIndex(bt_self_component_filter * const libCompPtr,
216 const std::uint64_t index) noexcept
217 {
218 return bt_self_component_filter_borrow_output_port_by_index(libCompPtr, index);
219 }
220
221 static bt_self_component_port_output *portByName(bt_self_component_filter * const libCompPtr,
222 const char * const name) noexcept
223 {
224 return bt_self_component_filter_borrow_output_port_by_name(libCompPtr, name);
225 }
226 };
227
228 template <>
229 struct SelfComponentPortsSpec<bt_self_component_filter, bt_self_component_port_input> final
230 {
231 static std::uint64_t portCount(bt_self_component_filter * const libCompPtr) noexcept
232 {
233 return bt_component_filter_get_input_port_count(
234 bt_self_component_filter_as_component_filter(libCompPtr));
235 }
236
237 static bt_self_component_port_input *portByIndex(bt_self_component_filter * const libCompPtr,
238 const std::uint64_t index) noexcept
239 {
240 return bt_self_component_filter_borrow_input_port_by_index(libCompPtr, index);
241 }
242
243 static bt_self_component_port_input *portByName(bt_self_component_filter * const libCompPtr,
244 const char * const name) noexcept
245 {
246 return bt_self_component_filter_borrow_input_port_by_name(libCompPtr, name);
247 }
248 };
249
250 template <>
251 struct SelfComponentPortsSpec<bt_self_component_sink, bt_self_component_port_input> final
252 {
253 static std::uint64_t portCount(bt_self_component_sink * const libCompPtr) noexcept
254 {
255 return bt_component_sink_get_input_port_count(
256 bt_self_component_sink_as_component_sink(libCompPtr));
257 }
258
259 static bt_self_component_port_input *portByIndex(bt_self_component_sink * const libCompPtr,
260 const std::uint64_t index) noexcept
261 {
262 return bt_self_component_sink_borrow_input_port_by_index(libCompPtr, index);
263 }
264
265 static bt_self_component_port_input *portByName(bt_self_component_sink * const libCompPtr,
266 const char * const name) noexcept
267 {
268 return bt_self_component_sink_borrow_input_port_by_name(libCompPtr, name);
269 }
270 };
271
272 } /* namespace internal */
273
274 template <typename LibSelfCompPortT, typename LibPortT>
275 class SelfComponentPort;
276
277 template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
278 class SelfComponentPorts final : public BorrowedObject<LibSelfCompT>
279 {
280 private:
281 using typename BorrowedObject<LibSelfCompT>::_ThisBorrowedObject;
282 using _Spec = internal::SelfComponentPortsSpec<LibSelfCompT, LibSelfCompPortT>;
283
284 public:
285 using typename BorrowedObject<LibSelfCompT>::LibObjPtr;
286 using Port = SelfComponentPort<LibSelfCompPortT, LibPortT>;
287 using Iterator = BorrowedObjectIterator<SelfComponentPorts>;
288
289 explicit SelfComponentPorts(const LibObjPtr libObjPtr) noexcept :
290 _ThisBorrowedObject {libObjPtr}
291 {
292 }
293
294 std::uint64_t length() const noexcept
295 {
296 return _Spec::portCount(this->libObjPtr());
297 }
298
299 Port operator[](std::uint64_t index) const noexcept;
300 Port operator[](bt2c::CStringView name) const noexcept;
301 Iterator begin() const noexcept;
302 Iterator end() const noexcept;
303 Port front() const noexcept;
304 Port back() const noexcept;
305 };
306
307 class SelfSourceComponent final : public SelfSpecificComponent<bt_self_component_source>
308 {
309 public:
310 using OutputPorts = SelfComponentPorts<bt_self_component_source, bt_self_component_port_output,
311 const bt_port_output>;
312
313 explicit SelfSourceComponent(bt_self_component_source * const libObjPtr) noexcept :
314 SelfSpecificComponent {libObjPtr}
315 {
316 }
317
318 ConstSourceComponent asConstComponent() const noexcept
319 {
320 return ConstSourceComponent {
321 bt_self_component_source_as_component_source(this->libObjPtr())};
322 }
323
324 template <typename DataT>
325 OutputPorts::Port addOutputPort(bt2c::CStringView name, DataT& data) const;
326
327 OutputPorts::Port addOutputPort(bt2c::CStringView name) const;
328
329 OutputPorts outputPorts() const noexcept;
330
331 private:
332 template <typename DataT>
333 OutputPorts::Port _addOutputPort(const char *name, DataT *data) const;
334 };
335
336 class SelfFilterComponent final : public SelfSpecificComponent<bt_self_component_filter>
337 {
338 public:
339 using InputPorts = SelfComponentPorts<bt_self_component_filter, bt_self_component_port_input,
340 const bt_port_input>;
341 using OutputPorts = SelfComponentPorts<bt_self_component_filter, bt_self_component_port_output,
342 const bt_port_output>;
343
344 explicit SelfFilterComponent(bt_self_component_filter * const libObjPtr) noexcept :
345 SelfSpecificComponent {libObjPtr}
346 {
347 }
348
349 ConstFilterComponent asConstComponent() const noexcept
350 {
351 return ConstFilterComponent {
352 bt_self_component_filter_as_component_filter(this->libObjPtr())};
353 }
354
355 template <typename DataT>
356 InputPorts::Port addInputPort(bt2c::CStringView name, DataT& data) const;
357
358 InputPorts::Port addInputPort(bt2c::CStringView name) const;
359
360 InputPorts inputPorts() const noexcept;
361
362 template <typename DataT>
363 OutputPorts::Port addOutputPort(bt2c::CStringView name, DataT& data) const;
364
365 OutputPorts::Port addOutputPort(bt2c::CStringView name) const;
366
367 OutputPorts outputPorts() const noexcept;
368
369 private:
370 template <typename DataT>
371 InputPorts::Port _addInputPort(const char *name, DataT *data) const;
372
373 template <typename DataT>
374 OutputPorts::Port _addOutputPort(const char *name, DataT *data) const;
375 };
376
377 class SelfSinkComponent final : public SelfSpecificComponent<bt_self_component_sink>
378 {
379 public:
380 using InputPorts = SelfComponentPorts<bt_self_component_sink, bt_self_component_port_input,
381 const bt_port_input>;
382
383 explicit SelfSinkComponent(bt_self_component_sink * const libObjPtr) noexcept :
384 SelfSpecificComponent {libObjPtr}
385 {
386 }
387
388 ConstSinkComponent asConstComponent() const noexcept
389 {
390 return ConstSinkComponent {bt_self_component_sink_as_component_sink(this->libObjPtr())};
391 }
392
393 MessageIterator::Shared createMessageIterator(InputPorts::Port port) const;
394
395 bool isInterrupted() const noexcept
396 {
397 return static_cast<bool>(bt_self_component_sink_is_interrupted(this->libObjPtr()));
398 }
399
400 template <typename DataT>
401 InputPorts::Port addInputPort(bt2c::CStringView name, DataT& data) const;
402
403 InputPorts::Port addInputPort(bt2c::CStringView name) const;
404
405 InputPorts inputPorts() const noexcept;
406
407 private:
408 template <typename DataT>
409 InputPorts::Port _addInputPort(const char *name, DataT *data) const;
410 };
411
412 inline SelfComponent::SelfComponent(const SelfSourceComponent other) noexcept :
413 SelfComponent {other.libObjPtr()}
414 {
415 }
416
417 inline SelfComponent::SelfComponent(const SelfFilterComponent other) noexcept :
418 SelfComponent {other.libObjPtr()}
419 {
420 }
421
422 inline SelfComponent::SelfComponent(const SelfSinkComponent other) noexcept :
423 SelfComponent {other.libObjPtr()}
424 {
425 }
426
427 inline SelfComponent SelfComponent::operator=(const SelfSourceComponent other) noexcept
428 {
429 *this = SelfComponent {other.libObjPtr()};
430 return *this;
431 }
432
433 inline SelfComponent SelfComponent::operator=(const SelfFilterComponent other) noexcept
434 {
435 *this = SelfComponent {other.libObjPtr()};
436 return *this;
437 }
438
439 inline SelfComponent SelfComponent::operator=(const SelfSinkComponent other) noexcept
440 {
441 *this = SelfComponent {other.libObjPtr()};
442 return *this;
443 }
444
445 namespace internal {
446
447 template <typename LibObjT>
448 struct SelfComponentPortSpec;
449
450 /* Functions specific to self component input ports */
451 template <>
452 struct SelfComponentPortSpec<bt_self_component_port_input> final
453 {
454 static bt_self_component_port *
455 asSelfCompPort(bt_self_component_port_input * const libObjPtr) noexcept
456 {
457 return bt_self_component_port_input_as_self_component_port(libObjPtr);
458 }
459
460 static const bt_port_input *
461 asConstPort(const bt_self_component_port_input * const libObjPtr) noexcept
462 {
463 return bt_self_component_port_input_as_port_input(libObjPtr);
464 }
465 };
466
467 /* Functions specific to self component output ports */
468 template <>
469 struct SelfComponentPortSpec<bt_self_component_port_output> final
470 {
471 static bt_self_component_port *
472 asSelfCompPort(bt_self_component_port_output * const libObjPtr) noexcept
473 {
474 return bt_self_component_port_output_as_self_component_port(libObjPtr);
475 }
476
477 static const bt_port_output *
478 asConstPort(bt_self_component_port_output * const libObjPtr) noexcept
479 {
480 return bt_self_component_port_output_as_port_output(libObjPtr);
481 }
482 };
483
484 } /* namespace internal */
485
486 template <typename LibSelfCompPortT, typename LibPortT>
487 class SelfComponentPort final : public BorrowedObject<LibSelfCompPortT>
488 {
489 public:
490 using typename BorrowedObject<LibSelfCompPortT>::LibObjPtr;
491
492 explicit SelfComponentPort(const LibObjPtr libObjPtr) noexcept :
493 BorrowedObject<LibSelfCompPortT> {libObjPtr}
494 {
495 }
496
497 ConstPort<LibPortT> asConstPort() const noexcept
498 {
499 return ConstPort<LibPortT> {
500 internal::SelfComponentPortSpec<LibSelfCompPortT>::asConstPort(this->libObjPtr())};
501 }
502
503 bt2c::CStringView name() const noexcept
504 {
505 return this->asConstPort().name();
506 }
507
508 bool isConnected() const noexcept
509 {
510 return this->asConstPort().isConnected();
511 }
512
513 SelfComponent component() const noexcept
514 {
515 return SelfComponent {bt_self_component_port_borrow_component(this->_libSelfCompPortPtr())};
516 }
517
518 template <typename T>
519 T& data() const noexcept
520 {
521 *static_cast<T *>(bt_self_component_port_get_data(this->_libSelfCompPortPtr()));
522 }
523
524 private:
525 bt_self_component_port *_libSelfCompPortPtr() const noexcept
526 {
527 return internal::SelfComponentPortSpec<LibSelfCompPortT>::asSelfCompPort(this->libObjPtr());
528 }
529 };
530
531 template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
532 typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Port
533 SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::operator[](
534 const std::uint64_t index) const noexcept
535 {
536 return Port {_Spec::portByIndex(this->libObjPtr(), index)};
537 }
538
539 template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
540 typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Port
541 SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::operator[](
542 const bt2c::CStringView name) const noexcept
543 {
544 return Port {_Spec::portByName(this->libObjPtr(), name)};
545 }
546
547 template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
548 typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Iterator
549 SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::begin() const noexcept
550 {
551 return Iterator {*this, 0};
552 }
553
554 template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
555 typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Iterator
556 SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::end() const noexcept
557 {
558 return Iterator {*this, this->length()};
559 }
560
561 template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
562 typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Port
563 SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::front() const noexcept
564 {
565 return (*this)[0];
566 }
567
568 template <typename LibSelfCompT, typename LibSelfCompPortT, typename LibPortT>
569 typename SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::Port
570 SelfComponentPorts<LibSelfCompT, LibSelfCompPortT, LibPortT>::back() const noexcept
571 {
572 return (*this)[this->length() - 1];
573 }
574
575 using SelfComponentInputPort = SelfComponentPort<bt_self_component_port_input, const bt_port_input>;
576
577 using SelfComponentOutputPort =
578 SelfComponentPort<bt_self_component_port_output, const bt_port_output>;
579
580 template <typename DataT>
581 SelfSourceComponent::OutputPorts::Port SelfSourceComponent::_addOutputPort(const char * const name,
582 DataT * const data) const
583 {
584 return this->_addPort<SelfSourceComponent::OutputPorts::Port, bt_self_component_port_output>(
585 name, data, bt_self_component_source_add_output_port);
586 }
587
588 template <typename DataT>
589 SelfSourceComponent::OutputPorts::Port
590 SelfSourceComponent::addOutputPort(const bt2c::CStringView name, DataT& data) const
591 {
592 return this->_addOutputPort(name, &data);
593 }
594
595 inline SelfSourceComponent::OutputPorts::Port
596 SelfSourceComponent::addOutputPort(const bt2c::CStringView name) const
597 {
598 return this->_addOutputPort<void>(name, nullptr);
599 }
600
601 inline SelfSourceComponent::OutputPorts SelfSourceComponent::outputPorts() const noexcept
602 {
603 return OutputPorts {this->libObjPtr()};
604 }
605
606 template <typename DataT>
607 SelfFilterComponent::OutputPorts::Port SelfFilterComponent::_addOutputPort(const char * const name,
608 DataT * const data) const
609 {
610 return this->_addPort<SelfFilterComponent::OutputPorts::Port, bt_self_component_port_output>(
611 name, data, bt_self_component_filter_add_output_port);
612 }
613
614 template <typename DataT>
615 SelfFilterComponent::OutputPorts::Port
616 SelfFilterComponent::addOutputPort(const bt2c::CStringView name, DataT& data) const
617 {
618 return this->_addOutputPort(name, &data);
619 }
620
621 inline SelfFilterComponent::OutputPorts::Port
622 SelfFilterComponent::addOutputPort(const bt2c::CStringView name) const
623 {
624 return this->_addOutputPort<void>(name, nullptr);
625 }
626
627 inline SelfFilterComponent::OutputPorts SelfFilterComponent::outputPorts() const noexcept
628 {
629 return OutputPorts {this->libObjPtr()};
630 }
631
632 template <typename DataT>
633 SelfFilterComponent::InputPorts::Port SelfFilterComponent::_addInputPort(const char * const name,
634 DataT * const data) const
635 {
636 return this->_addPort<SelfFilterComponent::InputPorts::Port, bt_self_component_port_input>(
637 name, data, bt_self_component_filter_add_input_port);
638 }
639
640 template <typename DataT>
641 SelfFilterComponent::InputPorts::Port
642 SelfFilterComponent::addInputPort(const bt2c::CStringView name, DataT& data) const
643 {
644 return this->_addInputPort(name, &data);
645 }
646
647 inline SelfFilterComponent::InputPorts::Port
648 SelfFilterComponent::addInputPort(const bt2c::CStringView name) const
649 {
650 return this->_addInputPort<void>(name, nullptr);
651 }
652
653 inline SelfFilterComponent::InputPorts SelfFilterComponent::inputPorts() const noexcept
654 {
655 return InputPorts {this->libObjPtr()};
656 }
657
658 inline MessageIterator::Shared
659 SelfSinkComponent::createMessageIterator(const InputPorts::Port port) const
660 {
661 bt_message_iterator *libMsgIterPtr = nullptr;
662
663 const auto status = bt_message_iterator_create_from_sink_component(
664 this->libObjPtr(), port.libObjPtr(), &libMsgIterPtr);
665
666 switch (status) {
667 case BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_OK:
668 BT_ASSERT(libMsgIterPtr);
669 return MessageIterator::Shared::createWithoutRef(libMsgIterPtr);
670 case BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_MEMORY_ERROR:
671 throw MemoryError {};
672 case BT_MESSAGE_ITERATOR_CREATE_FROM_SINK_COMPONENT_STATUS_ERROR:
673 throw Error {};
674 default:
675 bt_common_abort();
676 }
677 }
678
679 template <typename DataT>
680 SelfSinkComponent::InputPorts::Port SelfSinkComponent::_addInputPort(const char * const name,
681 DataT * const data) const
682 {
683 return this->_addPort<SelfSinkComponent::InputPorts::Port, bt_self_component_port_input>(
684 name, data, bt_self_component_sink_add_input_port);
685 }
686
687 template <typename DataT>
688 SelfSinkComponent::InputPorts::Port SelfSinkComponent::addInputPort(const bt2c::CStringView name,
689 DataT& data) const
690 {
691 return this->_addInputPort(name, &data);
692 }
693
694 inline SelfSinkComponent::InputPorts::Port
695 SelfSinkComponent::addInputPort(const bt2c::CStringView name) const
696 {
697 return this->_addInputPort<void>(name, nullptr);
698 }
699
700 inline SelfSinkComponent::InputPorts SelfSinkComponent::inputPorts() const noexcept
701 {
702 return InputPorts {this->libObjPtr()};
703 }
704
705 } /* namespace bt2 */
706
707 #endif /* BABELTRACE_CPP_COMMON_BT2_SELF_COMPONENT_PORT_HPP */
This page took 0.04395 seconds and 4 git commands to generate.