#include <babeltrace2/babeltrace.h>
#include "cpp-common/bt2/graph.hpp"
+#include "cpp-common/bt2c/c-string-view.hpp"
#include "utils.hpp"
*/
template <typename FuncT>
CondTrigger *makeSimpleTrigger(FuncT&& func, const CondTrigger::Type type,
- const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix = bt2s::nullopt)
+ const std::string& condId, const bt2c::CStringView nameSuffix = {})
{
return new SimpleCondTrigger {std::forward<FuncT>(func), type, condId, nameSuffix};
}
*/
CondTrigger *makeRunInCompInitTrigger(OnCompInitFunc func, const CondTrigger::Type type,
const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix = bt2s::nullopt)
+ const bt2c::CStringView nameSuffix = {})
{
return new RunInCondTrigger<RunInDelegator> {RunInDelegator::makeOnCompInit(std::move(func)),
type, condId, nameSuffix};
#include "utils.hpp"
CondTrigger::CondTrigger(const Type type, const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix) noexcept :
+ const bt2c::CStringView nameSuffix) noexcept :
_mType {type},
_mCondId {fmt::format("{}:{}", type == Type::PRE ? "pre" : "post", condId)},
- _mName {
- fmt::format("{}{}{}", condId, nameSuffix ? "-" : "", nameSuffix ? nameSuffix->data() : "")}
+ _mName {fmt::format("{}{}{}", condId, nameSuffix ? "-" : "", nameSuffix ? nameSuffix : "")}
{
}
SimpleCondTrigger::SimpleCondTrigger(std::function<void()> func, const Type type,
const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix) :
+ const bt2c::CStringView nameSuffix) :
CondTrigger {type, condId, nameSuffix},
_mFunc {std::move(func)}
{
#include <babeltrace2/babeltrace.h>
-#include "cpp-common/bt2s/optional.hpp"
+#include "cpp-common/bt2c/c-string-view.hpp"
#include "cpp-common/bt2s/span.hpp"
#include "../utils/run-in.hpp"
* name of the created condition trigger with name().
*/
explicit CondTrigger(Type type, const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix) noexcept;
+ const bt2c::CStringView nameSuffix) noexcept;
public:
virtual ~CondTrigger() = default;
{
public:
explicit SimpleCondTrigger(std::function<void()> func, Type type, const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix = bt2s::nullopt);
+ const bt2c::CStringView nameSuffix = {});
void operator()() noexcept override
{
{
public:
explicit RunInCondTrigger(RunInT runIn, const Type type, const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix = bt2s::nullopt) :
+ const bt2c::CStringView nameSuffix = {}) :
CondTrigger {type, condId, nameSuffix},
_mRunIn {std::move(runIn)}
{
}
explicit RunInCondTrigger(const Type type, const std::string& condId,
- const bt2s::optional<std::string>& nameSuffix = bt2s::nullopt) :
+ const bt2c::CStringView nameSuffix = {}) :
RunInCondTrigger {RunInT {}, type, condId, nameSuffix}
{
}