Sort includes in C++ files
[babeltrace.git] / src / cpp-common / bt2 / field-class.hpp
index 6460000ffe11c0dcda83fb0086777a63ee9edda8..165cfde32d35dad38eb7806ea58ae40ba59d1425 100644 (file)
@@ -7,20 +7,22 @@
 #ifndef BABELTRACE_CPP_COMMON_BT2_FIELD_CLASS_HPP
 #define BABELTRACE_CPP_COMMON_BT2_FIELD_CLASS_HPP
 
-#include <type_traits>
 #include <cstdint>
+#include <type_traits>
+
 #include <babeltrace2/babeltrace.h>
 
 #include "common/assert.h"
-#include "internal/borrowed-obj.hpp"
-#include "internal/shared-obj.hpp"
-#include "internal/utils.hpp"
 #include "cpp-common/optional.hpp"
 #include "cpp-common/string_view.hpp"
+
 #include "common-iter.hpp"
-#include "lib-error.hpp"
-#include "integer-range-set.hpp"
+#include "exc.hpp"
 #include "field-path.hpp"
+#include "integer-range-set.hpp"
+#include "internal/borrowed-obj.hpp"
+#include "internal/shared-obj.hpp"
+#include "internal/utils.hpp"
 #include "value.hpp"
 
 namespace bt2 {
@@ -202,12 +204,12 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonFieldClass(const CommonFieldClass<OtherLibObjT>& fc) noexcept : _ThisBorrowedObj {fc}
+    CommonFieldClass(const CommonFieldClass<OtherLibObjT> fc) noexcept : _ThisBorrowedObj {fc}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonFieldClass& operator=(const CommonFieldClass<OtherLibObjT>& fc) noexcept
+    CommonFieldClass& operator=(const CommonFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisBorrowedObj::operator=(fc);
         return *this;
@@ -419,7 +421,7 @@ public:
     asVariantWithSignedIntegerSelector() const noexcept;
 
     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`.");
 
@@ -490,14 +492,14 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonBitArrayFieldClass(const CommonBitArrayFieldClass<OtherLibObjT>& fc) noexcept :
+    CommonBitArrayFieldClass(const CommonBitArrayFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonBitArrayFieldClass<LibObjT>&
-    operator=(const CommonBitArrayFieldClass<OtherLibObjT>& fc) noexcept
+    operator=(const CommonBitArrayFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonFieldClass::operator=(fc);
         return *this;
@@ -565,13 +567,13 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonIntegerFieldClass(const CommonIntegerFieldClass<OtherLibObjT>& fc) noexcept :
+    CommonIntegerFieldClass(const CommonIntegerFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonIntegerFieldClass& operator=(const CommonIntegerFieldClass<OtherLibObjT>& fc) noexcept
+    CommonIntegerFieldClass& operator=(const CommonIntegerFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonFieldClass::operator=(fc);
         return *this;
@@ -798,15 +800,15 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonBaseEnumerationFieldClass(
-        const CommonBaseEnumerationFieldClass<OtherLibObjT>& fc) noexcept :
+    CommonBaseEnumerationFieldClass(const CommonBaseEnumerationFieldClass<OtherLibObjT> fc) noexcept
+        :
         _ThisCommonIntegerFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonBaseEnumerationFieldClass&
-    operator=(const CommonBaseEnumerationFieldClass<OtherLibObjT>& fc) noexcept
+    operator=(const CommonBaseEnumerationFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonIntegerFieldClass::operator=(fc);
         return *this;
@@ -844,14 +846,14 @@ public:
 
     template <typename OtherLibObjT>
     CommonEnumerationFieldClass(
-        const CommonEnumerationFieldClass<OtherLibObjT, MappingT>& fc) noexcept :
+        const CommonEnumerationFieldClass<OtherLibObjT, MappingT> fc) noexcept :
         _ThisCommonEnumerationFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonEnumerationFieldClass&
-    operator=(const CommonEnumerationFieldClass<OtherLibObjT, MappingT>& fc) noexcept
+    operator=(const CommonEnumerationFieldClass<OtherLibObjT, MappingT> fc) noexcept
     {
         _ThisCommonEnumerationFieldClass::operator=(fc);
         return *this;
@@ -886,7 +888,7 @@ public:
             this->libObjPtr(), label, ranges.libObjPtr());
 
         if (status == BT_FIELD_CLASS_ENUMERATION_ADD_MAPPING_STATUS_MEMORY_ERROR) {
-            throw LibMemoryError {};
+            throw MemoryError {};
         }
     }
 
@@ -1017,15 +1019,15 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonStructureFieldClassMember(
-        const CommonStructureFieldClassMember<OtherLibObjT>& fc) noexcept :
+    CommonStructureFieldClassMember(const CommonStructureFieldClassMember<OtherLibObjT> fc) noexcept
+        :
         _ThisBorrowedObj {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonStructureFieldClassMember<LibObjT>&
-    operator=(const CommonStructureFieldClassMember<OtherLibObjT>& fc) noexcept
+    operator=(const CommonStructureFieldClassMember<OtherLibObjT> fc) noexcept
     {
         _ThisBorrowedObj::operator=(fc);
         return *this;
@@ -1049,7 +1051,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`.");
 
@@ -1155,19 +1157,19 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonStructureFieldClass(const CommonStructureFieldClass<OtherLibObjT>& fc) noexcept :
+    CommonStructureFieldClass(const CommonStructureFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonStructureFieldClass& operator=(const CommonStructureFieldClass<OtherLibObjT>& fc) noexcept
+    CommonStructureFieldClass& operator=(const CommonStructureFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonFieldClass::operator=(fc);
         return *this;
     }
 
-    void appendMember(const char * const name, const FieldClass& fc)
+    void appendMember(const char * const name, const FieldClass fc)
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
@@ -1175,11 +1177,11 @@ public:
             bt_field_class_structure_append_member(this->libObjPtr(), name, fc.libObjPtr());
 
         if (status == BT_FIELD_CLASS_STRUCTURE_APPEND_MEMBER_STATUS_MEMORY_ERROR) {
-            throw LibMemoryError {};
+            throw MemoryError {};
         }
     }
 
-    void appendMember(const std::string& name, const FieldClass& fc)
+    void appendMember(const std::string& name, const FieldClass fc)
     {
         this->appendMember(name.data(), fc);
     }
@@ -1324,13 +1326,13 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonArrayFieldClass(const CommonArrayFieldClass<OtherLibObjT>& fc) noexcept :
+    CommonArrayFieldClass(const CommonArrayFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonArrayFieldClass& operator=(const CommonArrayFieldClass<OtherLibObjT>& fc) noexcept
+    CommonArrayFieldClass& operator=(const CommonArrayFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonFieldClass::operator=(fc);
         return *this;
@@ -1395,14 +1397,14 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonStaticArrayFieldClass(const CommonStaticArrayFieldClass<OtherLibObjT>& fc) noexcept :
+    CommonStaticArrayFieldClass(const CommonStaticArrayFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonArrayFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonStaticArrayFieldClass&
-    operator=(const CommonStaticArrayFieldClass<OtherLibObjT>& fc) noexcept
+    operator=(const CommonStaticArrayFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonArrayFieldClass::operator=(fc);
         return *this;
@@ -1461,14 +1463,14 @@ public:
 
     template <typename OtherLibObjT>
     CommonDynamicArrayWithLengthFieldClass(
-        const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT>& fc) noexcept :
+        const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonArrayFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonDynamicArrayWithLengthFieldClass&
-    operator=(const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT>& fc) noexcept
+    operator=(const CommonDynamicArrayWithLengthFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonArrayFieldClass::operator=(fc);
         return *this;
@@ -1560,13 +1562,13 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonOptionFieldClass(const CommonOptionFieldClass<OtherLibObjT>& fc) noexcept :
+    CommonOptionFieldClass(const CommonOptionFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonOptionFieldClass& operator=(const CommonOptionFieldClass<OtherLibObjT>& fc) noexcept
+    CommonOptionFieldClass& operator=(const CommonOptionFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonFieldClass::operator=(fc);
         return *this;
@@ -1635,14 +1637,14 @@ public:
 
     template <typename OtherLibObjT>
     CommonOptionWithSelectorFieldClass(
-        const CommonOptionWithSelectorFieldClass<OtherLibObjT>& fc) noexcept :
+        const CommonOptionWithSelectorFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonOptionFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonOptionWithSelectorFieldClass&
-    operator=(const CommonOptionWithSelectorFieldClass<OtherLibObjT>& fc) noexcept
+    operator=(const CommonOptionWithSelectorFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonOptionFieldClass::operator=(fc);
         return *this;
@@ -1705,14 +1707,14 @@ public:
 
     template <typename OtherLibObjT>
     CommonOptionWithBoolSelectorFieldClass(
-        const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT>& fc) noexcept :
+        const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonOptionWithSelectorFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonOptionWithBoolSelectorFieldClass&
-    operator=(const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT>& fc) noexcept
+    operator=(const CommonOptionWithBoolSelectorFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonOptionWithSelectorFieldClass::operator=(fc);
         return *this;
@@ -1810,14 +1812,14 @@ public:
 
     template <typename OtherLibObjT>
     CommonOptionWithIntegerSelectorFieldClass(
-        const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT>& fc) noexcept :
+        const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT> fc) noexcept :
         _ThisCommonOptionWithSelectorFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonOptionWithIntegerSelectorFieldClass&
-    operator=(const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT>& fc) noexcept
+    operator=(const CommonOptionWithIntegerSelectorFieldClass<OtherLibObjT, RangeSetT> fc) noexcept
     {
         _ThisCommonOptionWithSelectorFieldClass::operator=(fc);
         return *this;
@@ -1942,14 +1944,14 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonVariantFieldClassOption(const CommonVariantFieldClassOption<OtherLibObjT>& fc) noexcept :
+    CommonVariantFieldClassOption(const CommonVariantFieldClassOption<OtherLibObjT> fc) noexcept :
         _ThisBorrowedObj {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonVariantFieldClassOption&
-    operator=(const CommonVariantFieldClassOption<OtherLibObjT>& fc) noexcept
+    operator=(const CommonVariantFieldClassOption<OtherLibObjT> fc) noexcept
     {
         _ThisBorrowedObj::operator=(fc);
         return *this;
@@ -1979,7 +1981,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`.");
 
@@ -2095,14 +2097,14 @@ public:
 
     template <typename OtherLibObjT>
     ConstVariantWithIntegerSelectorFieldClassOption(
-        const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT>& fc) noexcept :
+        const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT> fc) noexcept :
         _ThisBorrowedObj {fc}
     {
     }
 
     template <typename OtherLibObjT>
     ConstVariantWithIntegerSelectorFieldClassOption&
-    operator=(const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT>& fc) noexcept
+    operator=(const ConstVariantWithIntegerSelectorFieldClassOption<OtherLibObjT> fc) noexcept
     {
         _ThisBorrowedObj::operator=(fc);
         return *this;
@@ -2204,13 +2206,13 @@ public:
     }
 
     template <typename OtherLibObjT>
-    CommonVariantFieldClass(const CommonVariantFieldClass<OtherLibObjT>& fc) noexcept :
+    CommonVariantFieldClass(const CommonVariantFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
-    CommonVariantFieldClass& operator=(const CommonVariantFieldClass<OtherLibObjT>& fc) noexcept
+    CommonVariantFieldClass& operator=(const CommonVariantFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonFieldClass::operator=(fc);
         return *this;
@@ -2329,20 +2331,20 @@ public:
 
     template <typename OtherLibObjT>
     CommonVariantWithoutSelectorFieldClass(
-        const CommonVariantWithoutSelectorFieldClass<OtherLibObjT>& fc) noexcept :
+        const CommonVariantWithoutSelectorFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonVariantFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonVariantWithoutSelectorFieldClass&
-    operator=(const CommonVariantWithoutSelectorFieldClass<OtherLibObjT>& fc) noexcept
+    operator=(const CommonVariantWithoutSelectorFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonVariantFieldClass::operator=(fc);
         return *this;
     }
 
-    void appendOption(const char * const name, const FieldClass& fc)
+    void appendOption(const char * const name, const FieldClass fc)
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
@@ -2351,11 +2353,11 @@ public:
 
         if (status ==
             BT_FIELD_CLASS_VARIANT_WITHOUT_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
-            throw LibMemoryError {};
+            throw MemoryError {};
         }
     }
 
-    void appendOption(const nonstd::optional<std::string>& name, const FieldClass& fc)
+    void appendOption(const nonstd::optional<std::string>& name, const FieldClass fc)
     {
         this->appendOption(name ? name->data() : nullptr, fc);
     }
@@ -2476,14 +2478,14 @@ public:
 
     template <typename OtherLibObjT>
     CommonVariantWithSelectorFieldClass(
-        const CommonVariantWithSelectorFieldClass<OtherLibObjT>& fc) noexcept :
+        const CommonVariantWithSelectorFieldClass<OtherLibObjT> fc) noexcept :
         _ThisCommonVariantFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonVariantWithSelectorFieldClass&
-    operator=(const CommonVariantWithSelectorFieldClass<OtherLibObjT>& fc) noexcept
+    operator=(const CommonVariantWithSelectorFieldClass<OtherLibObjT> fc) noexcept
     {
         _ThisCommonVariantFieldClass::operator=(fc);
         return *this;
@@ -2535,14 +2537,14 @@ public:
 
     template <typename OtherLibObjT>
     CommonVariantWithIntegerSelectorFieldClass(
-        const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT>& fc) noexcept :
+        const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT> fc) noexcept :
         _ThisCommonVariantWithSelectorFieldClass {fc}
     {
     }
 
     template <typename OtherLibObjT>
     CommonVariantWithIntegerSelectorFieldClass&
-    operator=(const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT>& fc) noexcept
+    operator=(const CommonVariantWithIntegerSelectorFieldClass<OtherLibObjT, OptionT> fc) noexcept
     {
         _ThisCommonVariantWithSelectorFieldClass::operator=(fc);
         return *this;
@@ -2569,8 +2571,8 @@ public:
         return (*this)[name.data()];
     }
 
-    void appendOption(const char * const name, const FieldClass& fc,
-                      const typename Option::RangeSet& ranges)
+    void appendOption(const char * const name, const FieldClass fc,
+                      const typename Option::RangeSet ranges)
     {
         static_assert(!std::is_const<LibObjT>::value, "`LibObjT` must NOT be `const`.");
 
@@ -2579,12 +2581,12 @@ public:
 
         if (status ==
             BT_FIELD_CLASS_VARIANT_WITH_SELECTOR_FIELD_APPEND_OPTION_STATUS_MEMORY_ERROR) {
-            throw LibMemoryError {};
+            throw MemoryError {};
         }
     }
 
-    void appendOption(const nonstd::optional<std::string>& name, const FieldClass& fc,
-                      const typename Option::RangeSet& ranges)
+    void appendOption(const nonstd::optional<std::string>& name, const FieldClass fc,
+                      const typename Option::RangeSet ranges)
     {
         this->appendOption(name ? name->data() : nullptr, fc, ranges);
     }
This page took 0.034196 seconds and 4 git commands to generate.