#define BABELTRACE_CPP_COMMON_BT2_CLOCK_CLASS_HPP
#include <cstdint>
-#include <string>
#include <type_traits>
#include <babeltrace2/babeltrace.h>
} /* namespace internal */
-class ClockClassOffset final
+class ClockOffset final
{
public:
- explicit ClockClassOffset(const std::int64_t seconds, const std::uint64_t cycles) :
+ explicit ClockOffset(const std::int64_t seconds, const std::uint64_t cycles) :
_mSeconds {seconds}, _mCycles {cycles}
{
}
return bt_clock_class_get_frequency(this->libObjPtr());
}
- void offset(const ClockClassOffset& offset) const noexcept
+ void offsetFromOrigin(const ClockOffset& offsetFromOrigin) const noexcept
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstClockClass`.");
- bt_clock_class_set_offset(this->libObjPtr(), offset.seconds(), offset.cycles());
+ bt_clock_class_set_offset(this->libObjPtr(), offsetFromOrigin.seconds(),
+ offsetFromOrigin.cycles());
}
- ClockClassOffset offset() const noexcept
+ ClockOffset offsetFromOrigin() const noexcept
{
std::int64_t seconds;
std::uint64_t cycles;
bt_clock_class_get_offset(this->libObjPtr(), &seconds, &cycles);
- return ClockClassOffset {seconds, cycles};
+ return ClockOffset {seconds, cycles};
}
void precision(const std::uint64_t precision) const noexcept
return static_cast<bool>(bt_clock_class_origin_is_unix_epoch(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::ConstClockClass`.");
}
}
- void name(const std::string& name) const
- {
- this->name(name.data());
- }
-
bt2c::CStringView name() const noexcept
{
return bt_clock_class_get_name(this->libObjPtr());
}
- void description(const char * const description) const
+ void description(const bt2c::CStringView description) const
{
static_assert(!std::is_const<LibObjT>::value, "Not available with `bt2::ConstClockClass`.");
}
}
- void description(const std::string& description) const
- {
- this->description(description.data());
- }
-
bt2c::CStringView description() const noexcept
{
return bt_clock_class_get_description(this->libObjPtr());