#include <babeltrace2/babeltrace.h>
+#include "cpp-common/bt2c/c-string-view.hpp"
#include "cpp-common/bt2s/optional.hpp"
#include "borrowed-object.hpp"
return bt_stream_get_id(this->libObjPtr());
}
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstStream`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
- const char *name() const noexcept
+ bt2c::CStringView name() const noexcept
{
return bt_stream_get_name(this->libObjPtr());
}
struct ConstEnvironmentEntry
{
- const char *name;
+ bt2c::CStringView name;
ConstValue value;
};
Class cls() const noexcept;
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
- const char *name() const noexcept
+ bt2c::CStringView name() const noexcept
{
return bt_trace_get_name(this->libObjPtr());
}
return _Spec::streamById(this->libObjPtr(), id);
}
- void environmentEntry(const char * const name, const std::int64_t val) const
+ void environmentEntry(const bt2c::CStringView name, const std::int64_t val) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
}
}
- void environmentEntry(const std::string& name, const std::int64_t val) const
- {
- this->environmentEntry(name.data(), val);
- }
-
- void environmentEntry(const char * const name, const char * const val) const
+ void environmentEntry(const bt2c::CStringView name, const bt2c::CStringView val) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstTrace`.");
}
}
- void environmentEntry(const std::string& name, const char * const val) const
- {
- this->environmentEntry(name.data(), val);
- }
-
- void environmentEntry(const char * const name, const std::string& val) const
- {
- this->environmentEntry(name, val.data());
- }
-
- void environmentEntry(const std::string& name, const std::string& val) const
- {
- this->environmentEntry(name.data(), val.data());
- }
-
std::uint64_t environmentSize() const noexcept
{
return bt_trace_get_environment_entry_count(this->libObjPtr());
return ConstEnvironmentEntry {name, ConstValue {libObjPtr}};
}
- OptionalBorrowedObject<ConstValue> environmentEntry(const char * const name) const noexcept
+ OptionalBorrowedObject<ConstValue> environmentEntry(const bt2c::CStringView name) const noexcept
{
return bt_trace_borrow_environment_entry_value_by_name_const(this->libObjPtr(), name);
}
- OptionalBorrowedObject<ConstValue> environmentEntry(const std::string& name) const noexcept
- {
- return this->environmentEntry(name.data());
- }
-
template <typename LibValT>
void userAttributes(const CommonMapValue<LibValT> userAttrs) const noexcept
{
return bt_event_class_get_id(this->libObjPtr());
}
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
- const char *name() const noexcept
+ bt2c::CStringView name() const noexcept
{
return bt_event_class_get_name(this->libObjPtr());
}
bt2s::optional<LogLevel> logLevel() const noexcept
{
bt_event_class_log_level libLogLevel;
- const auto avail = bt_event_class_get_log_level(this->libObjPtr(), &libLogLevel);
- if (avail == BT_PROPERTY_AVAILABILITY_AVAILABLE) {
+ if (bt_event_class_get_log_level(this->libObjPtr(), &libLogLevel)) {
return static_cast<LogLevel>(libLogLevel);
}
return bt2s::nullopt;
}
- void emfUri(const char * const emfUri) const
+ void emfUri(const bt2c::CStringView emfUri) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstEventClass`.");
}
}
- void emfUri(const std::string& emfUri) const
- {
- this->emfUri(emfUri.data());
- }
-
- const char *emfUri() const noexcept
+ bt2c::CStringView emfUri() const noexcept
{
return bt_event_class_get_emf_uri(this->libObjPtr());
}
return bt_stream_class_get_id(this->libObjPtr());
}
- void name(const char * const name) const
+ void name(const bt2c::CStringView name) const
{
static_assert(!std::is_const<LibObjT>::value,
"Not available with `bt2::ConstStreamClass`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
- const char *name() const noexcept
+ bt2c::CStringView name() const noexcept
{
return bt_stream_class_get_name(this->libObjPtr());
}