X-Git-Url: https://git.efficios.com/?a=blobdiff_plain;f=src%2Fcpp-common%2Fbt2%2Fclock-class.hpp;h=f9814a78b58c0df128cf5a214d2f835012288592;hb=aa5aac94c5ec89c7f361cf37c4df668229704180;hp=6c8c66380588cff939459947c95cec9895ba1259;hpb=e7f0f07bea73c3fdf14bbc919bfd44bff3eb85e1;p=babeltrace.git diff --git a/src/cpp-common/bt2/clock-class.hpp b/src/cpp-common/bt2/clock-class.hpp index 6c8c6638..f9814a78 100644 --- a/src/cpp-common/bt2/clock-class.hpp +++ b/src/cpp-common/bt2/clock-class.hpp @@ -8,7 +8,6 @@ #define BABELTRACE_CPP_COMMON_BT2_CLOCK_CLASS_HPP #include -#include #include #include @@ -64,10 +63,10 @@ struct CommonClockClassSpec final } /* 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} { } @@ -132,20 +131,21 @@ public: 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::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 @@ -173,7 +173,7 @@ public: return static_cast(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::value, "Not available with `bt2::ConstClockClass`."); @@ -184,17 +184,12 @@ public: } } - 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::value, "Not available with `bt2::ConstClockClass`."); @@ -205,11 +200,6 @@ public: } } - void description(const std::string& description) const - { - this->description(description.data()); - } - bt2c::CStringView description() const noexcept { return bt_clock_class_get_description(this->libObjPtr());