cpp-common/bt2c/logging.hpp: remove no-formatting ("str") alternatives
[babeltrace.git] / src / plugins / utils / muxer / comp.cpp
CommitLineData
fca1d0f5
PP
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright 2017-2023 Philippe Proulx <pproulx@efficios.com>
5 */
6
7#include "cpp-common/vendor/fmt/core.h"
8
9#include "comp.hpp"
10
11namespace bt2mux {
12
e66071f3 13Comp::Comp(const bt2::SelfFilterComponent selfComp, const bt2::ConstMapValue params, void *) :
06bb401e 14 bt2::UserFilterComponent<Comp, MsgIter> {selfComp, "PLUGIN/FLT.UTILS.MUXER"}
fca1d0f5 15{
e27adb90 16 BT_CPPLOGI("Initializing component.");
fca1d0f5
PP
17
18 /* No parameters expected */
19 if (!params.isEmpty()) {
20 BT_CPPLOGE_APPEND_CAUSE_AND_THROW(
21 bt2c::Error, "This component expects no parameters: param-count={}", params.length());
22 }
23
24 /* Add initial available input port */
25 this->_addAvailInputPort();
26
27 /* Add single output port */
28 try {
29 this->_addOutputPort("out");
30 } catch (const bt2c::Error&) {
e27adb90 31 BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW("Failed to add a single output port.");
fca1d0f5
PP
32 }
33
e27adb90 34 BT_CPPLOGI("Initialized component.");
fca1d0f5
PP
35}
36
37void Comp::_inputPortConnected(const bt2::SelfComponentInputPort, const bt2::ConstOutputPort)
38{
39 this->_addAvailInputPort();
40}
41
42void Comp::_addAvailInputPort()
43{
44 try {
45 this->_addInputPort(fmt::format("in{}", this->_inputPorts().length()));
46 } catch (const bt2c::Error&) {
e27adb90 47 BT_CPPLOGE_APPEND_CAUSE_AND_RETHROW("Failed to add an available input port.");
fca1d0f5
PP
48 }
49
50 BT_CPPLOGI("Added one available input port: name={}", this->_inputPorts().back().name());
51}
52
53} /* namespace bt2mux */
This page took 0.031315 seconds and 4 git commands to generate.