cpp-common/bt2: add `bt2::Self*Component` and `bt2::SelfComponent*Port`
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 2 Nov 2023 21:04:36 +0000 (17:04 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 14 Dec 2023 15:57:04 +0000 (10:57 -0500)
commitb6f09a6bc2b3728aabe45508a43a1c303ae39537
treef79c634f9412178f4fefa53668826cc21afc4cdc
parentd9a27df87dad3d1d7727709b7515904b8860514b
cpp-common/bt2: add `bt2::Self*Component` and `bt2::SelfComponent*Port`

This new file is an adaptation of `component-port.hpp` and works the
same way.

That being said, I didn't bother:

* Making equivalent objects in `component-port.hpp` accept the "self"
  versions.

  In theory, you could build a `bt2::ConstSourceComponent` from a
  `bt2::SelfSourceComponent`, for example, but I believe we won't do
  that often, if ever.

  Therefore you'll need to use the asConstComponent() and asConstPort()
  methods explicitly.

  However, I added aliases in the new classes to avoid going calling
  those in most situations. For example,
  bt2::SelfFilterComponent::name() calls bt2::SelfComponent::name()
  which calls bt2::ConstComponent::name().

* Implementing the constant versions of the new classes, for example
  `bt2::ConstSelfComponent`.

  For example, a method which would benefit this is
  bt2::SelfSinkComponent::isInterrupted().

  Again, I don't think we'll need this. The "self" wrappers are for the
  component class author, and she rarely needs a constant view of its
  own object.

Add a port to a self component with the addInputPort() or
addOutputPort() methods, which return a borrowed reference of the
created and added port. Those methods have an overload which accepts
user data to store into the returned port.

Create a message iterator from a self sink component with
bt2::SelfSinkComponent::createMessageIterator().

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Id6bcbfcea4a562780eee0700cee507431c4e5661
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11235
CI-Build: Simon Marchi <simon.marchi@efficios.com>
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
Tested-by: jenkins <jenkins@lttng.org>
src/Makefile.am
src/cpp-common/bt2/self-component-port.hpp [new file with mode: 0644]
This page took 0.024646 seconds and 4 git commands to generate.