Sort includes in C++ files
[babeltrace.git] / src / cpp-common / bt2 / clock-class.hpp
index 92caa9e4564d95ff054c643b649fa7a85e42dcf7..b236764510e437808965aab6b8f9b4cee1f989cb 100644 (file)
@@ -7,17 +7,20 @@
 #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 {
@@ -108,13 +111,13 @@ public:
     }
 
     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;
@@ -180,7 +183,7 @@ public:
         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 {};
         }
     }
 
@@ -207,7 +210,7 @@ public:
         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 {};
         }
     }
 
@@ -244,7 +247,7 @@ public:
     }
 
     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`.");
 
@@ -270,7 +273,7 @@ public:
             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;
@@ -278,13 +281,32 @@ public:
 
     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 */
This page took 0.026072 seconds and 4 git commands to generate.