#ifndef BABELTRACE_CPP_COMMON_BT2_CLOCK_CLASS_HPP
#define BABELTRACE_CPP_COMMON_BT2_CLOCK_CLASS_HPP
-#include <type_traits>
#include <cstdint>
#include <string>
+#include <type_traits>
+
#include <babeltrace2/babeltrace.h>
-#include "internal/borrowed-obj.hpp"
-#include "internal/shared-obj.hpp"
#include "cpp-common/optional.hpp"
#include "cpp-common/string_view.hpp"
#include "cpp-common/uuid-view.hpp"
-#include "lib-error.hpp"
+
+#include "exc.hpp"
+#include "internal/borrowed-obj.hpp"
+#include "internal/shared-obj.hpp"
+#include "internal/utils.hpp"
#include "value.hpp"
namespace bt2 {
}
template <typename OtherLibObjT>
- CommonClockClass(const CommonClockClass<OtherLibObjT>& clkClass) noexcept :
+ CommonClockClass(const CommonClockClass<OtherLibObjT> clkClass) noexcept :
_ThisBorrowedObj {clkClass}
{
}
template <typename OtherLibObjT>
- _ThisCommonClockClass& operator=(const CommonClockClass<OtherLibObjT>& clkClass) noexcept
+ _ThisCommonClockClass& operator=(const CommonClockClass<OtherLibObjT> clkClass) noexcept
{
_ThisBorrowedObj::operator=(clkClass);
return *this;
const auto status = bt_clock_class_set_name(this->libObjPtr(), name);
if (status == BT_CLOCK_CLASS_SET_NAME_STATUS_MEMORY_ERROR) {
- throw LibMemoryError {};
+ throw MemoryError {};
}
}
const auto status = bt_clock_class_set_description(this->libObjPtr(), description);
if (status == BT_CLOCK_CLASS_SET_DESCRIPTION_STATUS_MEMORY_ERROR) {
- throw LibMemoryError {};
+ throw MemoryError {};
}
}
}
template <typename LibValT>
- void userAttributes(const CommonMapValue<LibValT>& userAttrs)
+ void userAttributes(const CommonMapValue<LibValT> userAttrs)
{
static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
bt_clock_class_cycles_to_ns_from_origin(this->libObjPtr(), value, &nsFromOrigin);
if (status == BT_CLOCK_CLASS_CYCLES_TO_NS_FROM_ORIGIN_STATUS_OVERFLOW_ERROR) {
- throw LibOverflowError {};
+ throw OverflowError {};
}
return nsFromOrigin;
Shared shared() const noexcept
{
- return Shared {*this};
+ return Shared::createWithRef(*this);
}
};
using ClockClass = CommonClockClass<bt_clock_class>;
using ConstClockClass = CommonClockClass<const bt_clock_class>;
+namespace internal {
+
+struct ClockClassTypeDescr
+{
+ using Const = ConstClockClass;
+ using NonConst = ClockClass;
+};
+
+template <>
+struct TypeDescr<ClockClass> : public ClockClassTypeDescr
+{
+};
+
+template <>
+struct TypeDescr<ConstClockClass> : public ClockClassTypeDescr
+{
+};
+
+} /* namespace internal */
} /* namespace bt2 */
#endif /* BABELTRACE_CPP_COMMON_BT2_CLOCK_CLASS_HPP */