From: Philippe Proulx Date: Mon, 13 Nov 2023 19:15:33 +0000 (-0500) Subject: cpp-common/bt2: rename `bt2::BorrowedObj` -> `bt2::BorrowedObject` X-Git-Url: https://git.efficios.com/?a=commitdiff_plain;h=0d218157e8e692f965c246389f55194724f4a757;p=babeltrace.git cpp-common/bt2: rename `bt2::BorrowedObj` -> `bt2::BorrowedObject` This is public now, so use the full name without abbreviation like everything else does. Signed-off-by: Philippe Proulx Change-Id: I9716e1c5b60a06211f2292e71df574a2924e862f Reviewed-on: https://review.lttng.org/c/babeltrace/+/11366 Reviewed-by: Simon Marchi --- diff --git a/src/Makefile.am b/src/Makefile.am index fc890bb3..523274bf 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,7 +12,7 @@ SUBDIRS += bindings/python/bt2 endif noinst_HEADERS = \ - cpp-common/bt2/borrowed-obj.hpp \ + cpp-common/bt2/borrowed-object.hpp \ cpp-common/bt2/clock-class.hpp \ cpp-common/bt2/clock-snapshot.hpp \ cpp-common/bt2/common-iter.hpp \ diff --git a/src/cpp-common/bt2/borrowed-obj.hpp b/src/cpp-common/bt2/borrowed-obj.hpp deleted file mode 100644 index b006670e..00000000 --- a/src/cpp-common/bt2/borrowed-obj.hpp +++ /dev/null @@ -1,168 +0,0 @@ -/* - * Copyright 2019-2020 (c) Philippe Proulx - * - * SPDX-License-Identifier: MIT - */ - -#ifndef BABELTRACE_CPP_COMMON_BT2_BORROWED_OBJ_HPP -#define BABELTRACE_CPP_COMMON_BT2_BORROWED_OBJ_HPP - -#include -#include - -#include "common/assert.h" - -namespace bt2 { - -/* - * An instance of this class wraps a pointer to a libbabeltrace2 object - * of type `LibObjT` without managing any reference counting. - * - * This is an abstract base class for any libbabeltrace2 object wrapper. - * - * `LibObjT` is the direct libbabeltrace2 object type, for example - * `bt_stream_class` or `const bt_value`. - * - * Methods of a derived class can call libObjPtr() to access the - * libbabeltrace2 object pointer. - */ -template -class BorrowedObj -{ - static_assert(!std::is_pointer::value, "`LibObjT` must not be a pointer"); - - /* - * This makes it possible for a `BorrowedObj` - * instance to get assigned an instance of - * `BorrowedObj` ("copy" constructor and "assignment" - * operator). - * - * C++ forbids the other way around. - */ - template - friend class BorrowedObj; - -private: - /* - * Provides `val` which indicates whether or not you can assign this - * object from a borrowed object of type `OtherLibObjT`. - */ - template - struct _AssignableFromConst final - { - /* - * If `LibObjT` is const (for example, `const bt_value`), then - * you may always assign from its non-const equivalent (for - * example, `bt_value`). In C (correct): - * - * bt_value * const meow = bt_value_bool_create_init(BT_TRUE); - * const bt_value * const mix = meow; - * - * If `LibObjT` is non-const, then you may not assign from its - * const equivalent. In C (not correct): - * - * const bt_value * const meow = - * bt_value_array_borrow_element_by_index_const(some_val, 17); - * bt_value * const mix = meow; - */ - static constexpr bool val = - std::is_const::value || !std::is_const::value; - }; - -protected: - /* libbabeltrace2 object pointer */ - using _LibObjPtr = LibObjT *; - - /* This complete borrowed object */ - using _ThisBorrowedObj = BorrowedObj; - - /* - * Builds a borrowed object to wrap the libbabeltrace2 object - * pointer `libObjPtr`. - * - * `libObjPtr` must not be `nullptr`. - */ - explicit BorrowedObj(const _LibObjPtr libObjPtr) noexcept : _mLibObjPtr {libObjPtr} - { - BT_ASSERT(libObjPtr); - } - - /* Default copy operations */ - BorrowedObj(const BorrowedObj&) noexcept = default; - BorrowedObj& operator=(const BorrowedObj&) noexcept = default; - - /* - * Generic "copy" constructor. - * - * This converting constructor accepts both an instance of - * `_ThisBorrowedObj` and an instance (`other`) of - * `BorrowedObj`, where `ConstLibObjT` is the `const` - * version of `LibObjT`, if applicable. - * - * This makes it possible for a `BorrowedObj` - * instance to be built from an instance of - * `BorrowedObj`. C++ forbids the other way around. - */ - template - BorrowedObj(const BorrowedObj& other) noexcept : BorrowedObj {other._mLibObjPtr} - { - static_assert(_AssignableFromConst::val, - "Don't assign a non-const wrapper from a const wrapper."); - } - - /* - * Generic "assignment" operator. - * - * This operator accepts both an instance of - * `_ThisBorrowedObj` and an instance (`other`) of - * `BorrowedObj`, where `ConstLibObjT` is the `const` - * version of `LibObjT`, if applicable. - * - * This makes it possible for a `BorrowedObj` - * instance to get assigned an instance of - * `BorrowedObj`. C++ forbids the other way around, - * therefore we use `_EnableIfAssignableT` to show a more relevant - * context in the compiler error message. - */ - template - _ThisBorrowedObj& operator=(const BorrowedObj& other) noexcept - { - static_assert(_AssignableFromConst::val, - "Don't assign a non-const wrapper from a const wrapper."); - - _mLibObjPtr = other._mLibObjPtr; - return *this; - } - -public: - /* - * Returns a hash of this object, solely based on its raw libbabeltrace2 - * pointer. - */ - std::size_t hash() const noexcept - { - return std::hash<_LibObjPtr> {}(_mLibObjPtr); - } - - /* - * Returns whether or not this object is the exact same as `other`, - * solely based on the raw libbabeltrace2 pointers. - */ - bool isSame(const _ThisBorrowedObj& other) const noexcept - { - return _mLibObjPtr == other._mLibObjPtr; - } - - /* Wrapped libbabeltrace2 object pointer */ - _LibObjPtr libObjPtr() const noexcept - { - return _mLibObjPtr; - } - -private: - _LibObjPtr _mLibObjPtr; -}; - -} /* namespace bt2 */ - -#endif /* BABELTRACE_CPP_COMMON_BT2_BORROWED_OBJ_HPP */ diff --git a/src/cpp-common/bt2/borrowed-object.hpp b/src/cpp-common/bt2/borrowed-object.hpp new file mode 100644 index 00000000..24f026ec --- /dev/null +++ b/src/cpp-common/bt2/borrowed-object.hpp @@ -0,0 +1,169 @@ +/* + * Copyright 2019-2020 (c) Philippe Proulx + * + * SPDX-License-Identifier: MIT + */ + +#ifndef BABELTRACE_CPP_COMMON_BT2_BORROWED_OBJECT_HPP +#define BABELTRACE_CPP_COMMON_BT2_BORROWED_OBJECT_HPP + +#include +#include + +#include "common/assert.h" + +namespace bt2 { + +/* + * An instance of this class wraps a pointer to a libbabeltrace2 object + * of type `LibObjT` without managing any reference counting. + * + * This is an abstract base class for any libbabeltrace2 object wrapper. + * + * `LibObjT` is the direct libbabeltrace2 object type, for example + * `bt_stream_class` or `const bt_value`. + * + * Methods of a derived class can call libObjPtr() to access the + * libbabeltrace2 object pointer. + */ +template +class BorrowedObject +{ + static_assert(!std::is_pointer::value, "`LibObjT` must not be a pointer"); + + /* + * This makes it possible for a `BorrowedObject` + * instance to get assigned an instance of + * `BorrowedObject` ("copy" constructor and + * "assignment" operator). + * + * C++ forbids the other way around. + */ + template + friend class BorrowedObject; + +private: + /* + * Provides `val` which indicates whether or not you can assign this + * object from a borrowed object of type `OtherLibObjT`. + */ + template + struct _AssignableFromConst final + { + /* + * If `LibObjT` is const (for example, `const bt_value`), then + * you may always assign from its non-const equivalent (for + * example, `bt_value`). In C (correct): + * + * bt_value * const meow = bt_value_bool_create_init(BT_TRUE); + * const bt_value * const mix = meow; + * + * If `LibObjT` is non-const, then you may not assign from its + * const equivalent. In C (not correct): + * + * const bt_value * const meow = + * bt_value_array_borrow_element_by_index_const(some_val, 17); + * bt_value * const mix = meow; + */ + static constexpr bool val = + std::is_const::value || !std::is_const::value; + }; + +protected: + /* libbabeltrace2 object pointer */ + using _LibObjPtr = LibObjT *; + + /* This complete borrowed object */ + using _ThisBorrowedObject = BorrowedObject; + + /* + * Builds a borrowed object to wrap the libbabeltrace2 object + * pointer `libObjPtr`. + * + * `libObjPtr` must not be `nullptr`. + */ + explicit BorrowedObject(const _LibObjPtr libObjPtr) noexcept : _mLibObjPtr {libObjPtr} + { + BT_ASSERT(libObjPtr); + } + + /* Default copy operations */ + BorrowedObject(const BorrowedObject&) noexcept = default; + BorrowedObject& operator=(const BorrowedObject&) noexcept = default; + + /* + * Generic "copy" constructor. + * + * This converting constructor accepts both an instance of + * `_ThisBorrowedObject` and an instance (`other`) of + * `BorrowedObject`, where `ConstLibObjT` is the + * `const` version of `LibObjT`, if applicable. + * + * This makes it possible for a `BorrowedObject` + * instance to be built from an instance of + * `BorrowedObject`. C++ forbids the other way around. + */ + template + BorrowedObject(const BorrowedObject& other) noexcept : + BorrowedObject {other._mLibObjPtr} + { + static_assert(_AssignableFromConst::val, + "Don't assign a non-const wrapper from a const wrapper."); + } + + /* + * Generic "assignment" operator. + * + * This operator accepts both an instance of + * `_ThisBorrowedObject` and an instance (`other`) of + * `BorrowedObject`, where `ConstLibObjT` is the + * `const` version of `LibObjT`, if applicable. + * + * This makes it possible for a `BorrowedObject` + * instance to get assigned an instance of + * `BorrowedObject`. C++ forbids the other way around, + * therefore we use `_EnableIfAssignableT` to show a more relevant + * context in the compiler error message. + */ + template + _ThisBorrowedObject& operator=(const BorrowedObject& other) noexcept + { + static_assert(_AssignableFromConst::val, + "Don't assign a non-const wrapper from a const wrapper."); + + _mLibObjPtr = other._mLibObjPtr; + return *this; + } + +public: + /* + * Returns a hash of this object, solely based on its raw + * libbabeltrace2 pointer. + */ + std::size_t hash() const noexcept + { + return std::hash<_LibObjPtr> {}(_mLibObjPtr); + } + + /* + * Returns whether or not this object is the exact same as `other`, + * solely based on the raw libbabeltrace2 pointers. + */ + bool isSame(const _ThisBorrowedObject& other) const noexcept + { + return _mLibObjPtr == other._mLibObjPtr; + } + + /* Wrapped libbabeltrace2 object pointer */ + _LibObjPtr libObjPtr() const noexcept + { + return _mLibObjPtr; + } + +private: + _LibObjPtr _mLibObjPtr; +}; + +} /* namespace bt2 */ + +#endif /* BABELTRACE_CPP_COMMON_BT2_BORROWED_OBJECT_HPP */ diff --git a/src/cpp-common/bt2/clock-class.hpp b/src/cpp-common/bt2/clock-class.hpp index c713ca26..16bfd23b 100644 --- a/src/cpp-common/bt2/clock-class.hpp +++ b/src/cpp-common/bt2/clock-class.hpp @@ -17,7 +17,7 @@ #include "cpp-common/string_view.hpp" #include "cpp-common/uuid-view.hpp" -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "exc.hpp" #include "internal/shared-obj.hpp" #include "internal/utils.hpp" @@ -92,11 +92,11 @@ private: }; template -class CommonClockClass final : public BorrowedObj +class CommonClockClass final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ThisCommonClockClass = CommonClockClass; public: @@ -106,20 +106,20 @@ public: using UserAttributes = typename std::conditional::value, ConstMapValue, MapValue>::type; - explicit CommonClockClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonClockClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template CommonClockClass(const CommonClockClass clkClass) noexcept : - _ThisBorrowedObj {clkClass} + _ThisBorrowedObject {clkClass} { } template _ThisCommonClockClass& operator=(const CommonClockClass clkClass) noexcept { - _ThisBorrowedObj::operator=(clkClass); + _ThisBorrowedObject::operator=(clkClass); return *this; } diff --git a/src/cpp-common/bt2/clock-snapshot.hpp b/src/cpp-common/bt2/clock-snapshot.hpp index acd399b1..ed30eaf5 100644 --- a/src/cpp-common/bt2/clock-snapshot.hpp +++ b/src/cpp-common/bt2/clock-snapshot.hpp @@ -11,26 +11,27 @@ #include -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "exc.hpp" namespace bt2 { -class ConstClockSnapshot final : public BorrowedObj +class ConstClockSnapshot final : public BorrowedObject { public: - explicit ConstClockSnapshot(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit ConstClockSnapshot(const _LibObjPtr libObjPtr) noexcept : + _ThisBorrowedObject {libObjPtr} { } ConstClockSnapshot(const ConstClockSnapshot& clkSnapshot) noexcept : - _ThisBorrowedObj {clkSnapshot} + _ThisBorrowedObject {clkSnapshot} { } ConstClockSnapshot& operator=(const ConstClockSnapshot& clkSnapshot) noexcept { - _ThisBorrowedObj::operator=(clkSnapshot); + _ThisBorrowedObject::operator=(clkSnapshot); return *this; } diff --git a/src/cpp-common/bt2/field-class.hpp b/src/cpp-common/bt2/field-class.hpp index a8bbb3c4..67bf9e8a 100644 --- a/src/cpp-common/bt2/field-class.hpp +++ b/src/cpp-common/bt2/field-class.hpp @@ -16,7 +16,7 @@ #include "cpp-common/optional.hpp" #include "cpp-common/string_view.hpp" -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "common-iter.hpp" #include "exc.hpp" #include "field-path.hpp" @@ -161,7 +161,7 @@ enum class FieldClassType }; template -class CommonFieldClass : public BorrowedObj +class CommonFieldClass : public BorrowedObject { /* Allow appendMember() to call `fc.libObjPtr()` */ friend class CommonStructureFieldClass; @@ -187,10 +187,10 @@ class CommonFieldClass : public BorrowedObj friend class CommonTraceClass; private: - using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObject::_ThisBorrowedObject; protected: - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_LibObjPtr; using _ThisCommonFieldClass = CommonFieldClass; public: @@ -199,19 +199,19 @@ public: using UserAttributes = typename std::conditional::value, ConstMapValue, MapValue>::type; - explicit CommonFieldClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonFieldClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template - CommonFieldClass(const CommonFieldClass fc) noexcept : _ThisBorrowedObj {fc} + CommonFieldClass(const CommonFieldClass fc) noexcept : _ThisBorrowedObject {fc} { } template CommonFieldClass& operator=(const CommonFieldClass fc) noexcept { - _ThisBorrowedObj::operator=(fc); + _ThisBorrowedObject::operator=(fc); return *this; } @@ -679,11 +679,11 @@ struct ConstEnumerationFieldClassMappingSpec -class ConstEnumerationFieldClassMapping final : public BorrowedObj +class ConstEnumerationFieldClassMapping final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; public: using RangeSet = typename std::conditional< @@ -691,19 +691,19 @@ public: ConstUnsignedIntegerRangeSet, ConstSignedIntegerRangeSet>::type; explicit ConstEnumerationFieldClassMapping(const _LibObjPtr libObjPtr) noexcept : - _ThisBorrowedObj {libObjPtr} + _ThisBorrowedObject {libObjPtr} { } ConstEnumerationFieldClassMapping(const ConstEnumerationFieldClassMapping& mapping) noexcept : - _ThisBorrowedObj {mapping} + _ThisBorrowedObject {mapping} { } ConstEnumerationFieldClassMapping& operator=(const ConstEnumerationFieldClassMapping& mapping) noexcept { - _ThisBorrowedObj::operator=(mapping); + _ThisBorrowedObject::operator=(mapping); return *this; } @@ -1000,11 +1000,11 @@ struct CommonStructureFieldClassMemberSpec -class CommonStructureFieldClassMember final : public BorrowedObj +class CommonStructureFieldClassMember final : public BorrowedObject { private: - using typename BorrowedObj::_LibObjPtr; - using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObject::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; using _FieldClass = typename std::conditional::value, ConstFieldClass, FieldClass>::type; @@ -1014,14 +1014,14 @@ public: typename std::conditional::value, ConstMapValue, MapValue>::type; explicit CommonStructureFieldClassMember(const _LibObjPtr libObjPtr) noexcept : - _ThisBorrowedObj {libObjPtr} + _ThisBorrowedObject {libObjPtr} { } template CommonStructureFieldClassMember(const CommonStructureFieldClassMember fc) noexcept : - _ThisBorrowedObj {fc} + _ThisBorrowedObject {fc} { } @@ -1029,7 +1029,7 @@ public: CommonStructureFieldClassMember& operator=(const CommonStructureFieldClassMember fc) noexcept { - _ThisBorrowedObj::operator=(fc); + _ThisBorrowedObject::operator=(fc); return *this; } @@ -1925,11 +1925,11 @@ struct CommonVariantFieldClassOptionSpec fi } /* namespace internal */ template -class CommonVariantFieldClassOption : public BorrowedObj +class CommonVariantFieldClassOption : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _FieldClass = typename std::conditional::value, ConstFieldClass, FieldClass>::type; @@ -1939,13 +1939,13 @@ public: typename std::conditional::value, ConstMapValue, MapValue>::type; explicit CommonVariantFieldClassOption(const _LibObjPtr libObjPtr) noexcept : - _ThisBorrowedObj {libObjPtr} + _ThisBorrowedObject {libObjPtr} { } template CommonVariantFieldClassOption(const CommonVariantFieldClassOption fc) noexcept : - _ThisBorrowedObj {fc} + _ThisBorrowedObject {fc} { } @@ -1953,7 +1953,7 @@ public: CommonVariantFieldClassOption& operator=(const CommonVariantFieldClassOption fc) noexcept { - _ThisBorrowedObj::operator=(fc); + _ThisBorrowedObject::operator=(fc); return *this; } @@ -2076,11 +2076,11 @@ struct ConstVariantWithIntegerSelectorFieldClassOptionSpec< } /* namespace internal */ template -class ConstVariantWithIntegerSelectorFieldClassOption : public BorrowedObj +class ConstVariantWithIntegerSelectorFieldClassOption : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _Spec = internal::ConstVariantWithIntegerSelectorFieldClassOptionSpec; public: @@ -2091,14 +2091,14 @@ public: ConstUnsignedIntegerRangeSet, ConstSignedIntegerRangeSet>::type; explicit ConstVariantWithIntegerSelectorFieldClassOption(const _LibObjPtr libObjPtr) noexcept : - _ThisBorrowedObj {libObjPtr} + _ThisBorrowedObject {libObjPtr} { } template ConstVariantWithIntegerSelectorFieldClassOption( const ConstVariantWithIntegerSelectorFieldClassOption fc) noexcept : - _ThisBorrowedObj {fc} + _ThisBorrowedObject {fc} { } @@ -2106,7 +2106,7 @@ public: ConstVariantWithIntegerSelectorFieldClassOption& operator=(const ConstVariantWithIntegerSelectorFieldClassOption fc) noexcept { - _ThisBorrowedObj::operator=(fc); + _ThisBorrowedObject::operator=(fc); return *this; } diff --git a/src/cpp-common/bt2/field-path.hpp b/src/cpp-common/bt2/field-path.hpp index aac6ffd1..0416b00a 100644 --- a/src/cpp-common/bt2/field-path.hpp +++ b/src/cpp-common/bt2/field-path.hpp @@ -13,7 +13,7 @@ #include "common/assert.h" -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "common-iter.hpp" #include "internal/shared-obj.hpp" @@ -28,20 +28,21 @@ enum class FieldPathItemType CURRENT_OPTION_CONTENT = BT_FIELD_PATH_ITEM_TYPE_CURRENT_OPTION_CONTENT, }; -class ConstFieldPathItem : public BorrowedObj +class ConstFieldPathItem : public BorrowedObject { public: - explicit ConstFieldPathItem(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit ConstFieldPathItem(const _LibObjPtr libObjPtr) noexcept : + _ThisBorrowedObject {libObjPtr} { } - ConstFieldPathItem(const ConstFieldPathItem& fpItem) noexcept : _ThisBorrowedObj {fpItem} + ConstFieldPathItem(const ConstFieldPathItem& fpItem) noexcept : _ThisBorrowedObject {fpItem} { } ConstFieldPathItem& operator=(const ConstFieldPathItem& fpItem) noexcept { - _ThisBorrowedObj::operator=(fpItem); + _ThisBorrowedObject::operator=(fpItem); return *this; } @@ -123,7 +124,7 @@ struct FieldPathRefFuncs final } /* namespace internal */ -class ConstFieldPath final : public BorrowedObj +class ConstFieldPath final : public BorrowedObject { public: using Shared = @@ -139,17 +140,17 @@ public: EVENT_PAYLOAD = BT_FIELD_PATH_SCOPE_EVENT_PAYLOAD, }; - explicit ConstFieldPath(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit ConstFieldPath(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } - ConstFieldPath(const ConstFieldPath& fieldPath) noexcept : _ThisBorrowedObj {fieldPath} + ConstFieldPath(const ConstFieldPath& fieldPath) noexcept : _ThisBorrowedObject {fieldPath} { } ConstFieldPath& operator=(const ConstFieldPath& fieldPath) noexcept { - _ThisBorrowedObj::operator=(fieldPath); + _ThisBorrowedObject::operator=(fieldPath); return *this; } diff --git a/src/cpp-common/bt2/field.hpp b/src/cpp-common/bt2/field.hpp index 61cdd60a..509e66d2 100644 --- a/src/cpp-common/bt2/field.hpp +++ b/src/cpp-common/bt2/field.hpp @@ -16,7 +16,7 @@ #include "cpp-common/optional.hpp" #include "cpp-common/string_view.hpp" -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "field-class.hpp" #include "internal/utils.hpp" @@ -92,32 +92,32 @@ struct CommonFieldSpec final } /* namespace internal */ template -class CommonField : public BorrowedObj +class CommonField : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObject::_ThisBorrowedObject; protected: - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_LibObjPtr; using _ThisCommonField = CommonField; public: using Class = typename std::conditional::value, ConstFieldClass, FieldClass>::type; - explicit CommonField(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonField(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template - CommonField(const CommonField val) noexcept : _ThisBorrowedObj {val} + CommonField(const CommonField val) noexcept : _ThisBorrowedObject {val} { } template _ThisCommonField& operator=(const CommonField val) noexcept { - _ThisBorrowedObj::operator=(val); + _ThisBorrowedObject::operator=(val); return *this; } diff --git a/src/cpp-common/bt2/integer-range-set.hpp b/src/cpp-common/bt2/integer-range-set.hpp index 1ad8f4c1..eb109921 100644 --- a/src/cpp-common/bt2/integer-range-set.hpp +++ b/src/cpp-common/bt2/integer-range-set.hpp @@ -12,7 +12,7 @@ #include -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "common-iter.hpp" #include "exc.hpp" #include "integer-range.hpp" @@ -141,7 +141,7 @@ template class CommonTraceClass; template -class CommonIntegerRangeSet final : public BorrowedObj +class CommonIntegerRangeSet final : public BorrowedObject { /* Allow operator==() to call `other.libObjPtr()` */ friend class CommonIntegerRangeSet; @@ -164,8 +164,8 @@ class CommonIntegerRangeSet final : public BorrowedObj friend class CommonTraceClass; private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ConstLibObjT = typename std::add_const::type; using _RefFuncs = internal::IntegerRangeSetRefFuncs<_ConstLibObjT>; using _Spec = internal::CommonIntegerRangeSetSpec<_ConstLibObjT>; @@ -182,7 +182,7 @@ public: using Iterator = CommonIterator; explicit CommonIntegerRangeSet(const _LibObjPtr libObjPtr) noexcept : - _ThisBorrowedObj {libObjPtr} + _ThisBorrowedObject {libObjPtr} { } @@ -196,7 +196,7 @@ public: template CommonIntegerRangeSet(const CommonIntegerRangeSet rangeSet) noexcept : - _ThisBorrowedObj {rangeSet} + _ThisBorrowedObject {rangeSet} { } @@ -204,7 +204,7 @@ public: _ThisCommonIntegerRangeSet& operator=(const CommonIntegerRangeSet rangeSet) noexcept { - _ThisBorrowedObj::operator=(rangeSet); + _ThisBorrowedObject::operator=(rangeSet); return *this; } diff --git a/src/cpp-common/bt2/integer-range.hpp b/src/cpp-common/bt2/integer-range.hpp index 03ba0b60..f41101ee 100644 --- a/src/cpp-common/bt2/integer-range.hpp +++ b/src/cpp-common/bt2/integer-range.hpp @@ -12,7 +12,7 @@ #include -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" namespace bt2 { @@ -66,11 +66,11 @@ struct ConstIntegerRangeSpec final } /* namespace internal */ template -class ConstIntegerRange final : public BorrowedObj +class ConstIntegerRange final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ThisConstIntegerRange = ConstIntegerRange; public: @@ -79,17 +79,18 @@ public: std::uint64_t, std::int64_t>::type; public: - explicit ConstIntegerRange(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit ConstIntegerRange(const _LibObjPtr libObjPtr) noexcept : + _ThisBorrowedObject {libObjPtr} { } - ConstIntegerRange(const _ThisConstIntegerRange& range) noexcept : _ThisBorrowedObj {range} + ConstIntegerRange(const _ThisConstIntegerRange& range) noexcept : _ThisBorrowedObject {range} { } _ThisConstIntegerRange& operator=(const _ThisConstIntegerRange& range) noexcept { - _ThisBorrowedObj::operator=(range); + _ThisBorrowedObject::operator=(range); return *this; } diff --git a/src/cpp-common/bt2/message.hpp b/src/cpp-common/bt2/message.hpp index eb1980a5..e284afe2 100644 --- a/src/cpp-common/bt2/message.hpp +++ b/src/cpp-common/bt2/message.hpp @@ -17,7 +17,7 @@ #include "cpp-common/bt2/trace-ir.hpp" #include "cpp-common/optional.hpp" -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "internal/shared-obj.hpp" #include "internal/utils.hpp" @@ -79,31 +79,31 @@ enum class MessageType }; template -class CommonMessage : public BorrowedObj +class CommonMessage : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObject::_ThisBorrowedObject; protected: - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_LibObjPtr; using _ThisCommonMessage = CommonMessage; public: using Shared = internal::SharedMessage, LibObjT>; - explicit CommonMessage(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonMessage(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template - CommonMessage(const CommonMessage val) noexcept : _ThisBorrowedObj {val} + CommonMessage(const CommonMessage val) noexcept : _ThisBorrowedObject {val} { } template _ThisCommonMessage& operator=(const CommonMessage val) noexcept { - _ThisBorrowedObj::operator=(val); + _ThisBorrowedObject::operator=(val); return *this; } diff --git a/src/cpp-common/bt2/trace-ir.hpp b/src/cpp-common/bt2/trace-ir.hpp index 3a936782..88ac7b0f 100644 --- a/src/cpp-common/bt2/trace-ir.hpp +++ b/src/cpp-common/bt2/trace-ir.hpp @@ -15,7 +15,7 @@ #include "cpp-common/optional.hpp" #include "cpp-common/string_view.hpp" -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "clock-class.hpp" #include "field-class.hpp" #include "field.hpp" @@ -123,11 +123,11 @@ struct CommonEventSpec final } /* namespace internal */ template -class CommonEvent final : public BorrowedObj +class CommonEvent final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ConstSpec = internal::CommonEventSpec; using _Spec = internal::CommonEventSpec; @@ -147,19 +147,19 @@ public: CommonEventClass, CommonEventClass>::type; - explicit CommonEvent(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonEvent(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template - CommonEvent(const CommonEvent event) noexcept : _ThisBorrowedObj {event} + CommonEvent(const CommonEvent event) noexcept : _ThisBorrowedObject {event} { } template CommonEvent& operator=(const CommonEvent event) noexcept { - _ThisBorrowedObj::operator=(event); + _ThisBorrowedObject::operator=(event); return *this; } @@ -307,11 +307,11 @@ struct CommonPacketSpec final } /* namespace internal */ template -class CommonPacket final : public BorrowedObj +class CommonPacket final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ConstSpec = internal::CommonPacketSpec; using _Spec = internal::CommonPacketSpec; using _ThisCommonPacket = CommonPacket; @@ -326,19 +326,19 @@ private: public: using Shared = internal::SharedObj<_ThisCommonPacket, LibObjT, internal::PacketRefFuncs>; - explicit CommonPacket(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonPacket(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template - CommonPacket(const CommonPacket packet) noexcept : _ThisBorrowedObj {packet} + CommonPacket(const CommonPacket packet) noexcept : _ThisBorrowedObject {packet} { } template _ThisCommonPacket& operator=(const CommonPacket packet) noexcept { - _ThisBorrowedObj::operator=(packet); + _ThisBorrowedObject::operator=(packet); return *this; } @@ -481,11 +481,11 @@ struct CommonStreamSpec final } /* namespace internal */ template -class CommonStream final : public BorrowedObj +class CommonStream final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ConstSpec = internal::CommonStreamSpec; using _Spec = internal::CommonStreamSpec; using _ThisCommonStream = CommonStream; @@ -504,19 +504,19 @@ public: using UserAttributes = typename std::conditional::value, ConstMapValue, MapValue>::type; - explicit CommonStream(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonStream(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template - CommonStream(const CommonStream stream) noexcept : _ThisBorrowedObj {stream} + CommonStream(const CommonStream stream) noexcept : _ThisBorrowedObject {stream} { } template _ThisCommonStream& operator=(const CommonStream stream) noexcept { - _ThisBorrowedObj::operator=(stream); + _ThisBorrowedObject::operator=(stream); return *this; } @@ -711,14 +711,14 @@ struct CommonTraceSpec final } /* namespace internal */ template -class CommonTrace final : public BorrowedObj +class CommonTrace final : public BorrowedObject { /* Allow instantiate() to call `trace.libObjPtr()` */ friend class CommonStreamClass; private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ConstSpec = internal::CommonTraceSpec; using _Spec = internal::CommonTraceSpec; using _ThisCommonTrace = CommonTrace; @@ -743,19 +743,19 @@ public: ConstValue value; }; - explicit CommonTrace(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonTrace(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template - CommonTrace(const CommonTrace trace) noexcept : _ThisBorrowedObj {trace} + CommonTrace(const CommonTrace trace) noexcept : _ThisBorrowedObject {trace} { } template _ThisCommonTrace& operator=(const CommonTrace trace) noexcept { - _ThisBorrowedObj::operator=(trace); + _ThisBorrowedObject::operator=(trace); return *this; } @@ -1047,11 +1047,11 @@ struct CommonEventClassSpec final } /* namespace internal */ template -class CommonEventClass final : public BorrowedObj +class CommonEventClass final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ConstSpec = internal::CommonEventClassSpec; using _Spec = internal::CommonEventClassSpec; using _ThisCommonEventClass = CommonEventClass; @@ -1090,20 +1090,20 @@ public: DEBUG = BT_EVENT_CLASS_LOG_LEVEL_DEBUG, }; - explicit CommonEventClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonEventClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template CommonEventClass(const CommonEventClass eventClass) noexcept : - _ThisBorrowedObj {eventClass} + _ThisBorrowedObject {eventClass} { } template _ThisCommonEventClass& operator=(const CommonEventClass eventClass) noexcept { - _ThisBorrowedObj::operator=(eventClass); + _ThisBorrowedObject::operator=(eventClass); return *this; } @@ -1423,11 +1423,11 @@ struct CommonStreamClassSpec final } /* namespace internal */ template -class CommonStreamClass final : public BorrowedObj +class CommonStreamClass final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ConstSpec = internal::CommonStreamClassSpec; using _Spec = internal::CommonStreamClassSpec; using _ThisCommonStreamClass = CommonStreamClass; @@ -1454,20 +1454,21 @@ public: using UserAttributes = typename std::conditional::value, ConstMapValue, MapValue>::type; - explicit CommonStreamClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonStreamClass(const _LibObjPtr libObjPtr) noexcept : + _ThisBorrowedObject {libObjPtr} { } template CommonStreamClass(const CommonStreamClass streamClass) noexcept : - _ThisBorrowedObj {streamClass} + _ThisBorrowedObject {streamClass} { } template _ThisCommonStreamClass& operator=(const CommonStreamClass streamClass) noexcept { - _ThisBorrowedObj::operator=(streamClass); + _ThisBorrowedObject::operator=(streamClass); return *this; } @@ -1916,11 +1917,11 @@ struct CommonTraceClassSpec final } /* namespace internal */ template -class CommonTraceClass final : public BorrowedObj +class CommonTraceClass final : public BorrowedObject { private: - using typename BorrowedObj::_ThisBorrowedObj; - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_ThisBorrowedObject; + using typename BorrowedObject::_LibObjPtr; using _ConstSpec = internal::CommonTraceClassSpec; using _Spec = internal::CommonTraceClassSpec; using _ThisCommonTraceClass = CommonTraceClass; @@ -1936,20 +1937,20 @@ public: using UserAttributes = typename std::conditional::value, ConstMapValue, MapValue>::type; - explicit CommonTraceClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonTraceClass(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template CommonTraceClass(const CommonTraceClass traceClass) noexcept : - _ThisBorrowedObj {traceClass} + _ThisBorrowedObject {traceClass} { } template _ThisCommonTraceClass& operator=(const CommonTraceClass traceClass) noexcept { - _ThisBorrowedObj::operator=(traceClass); + _ThisBorrowedObject::operator=(traceClass); return *this; } diff --git a/src/cpp-common/bt2/value.hpp b/src/cpp-common/bt2/value.hpp index 9f30b74b..c78b5701 100644 --- a/src/cpp-common/bt2/value.hpp +++ b/src/cpp-common/bt2/value.hpp @@ -18,7 +18,7 @@ #include "cpp-common/optional.hpp" #include "cpp-common/string_view.hpp" -#include "borrowed-obj.hpp" +#include "borrowed-object.hpp" #include "common-iter.hpp" #include "exc.hpp" #include "internal/shared-obj.hpp" @@ -100,7 +100,7 @@ template class CommonStream; template -class CommonValue : public BorrowedObj +class CommonValue : public BorrowedObject { /* Allow append() to call `val.libObjPtr()` */ friend class CommonArrayValue; @@ -121,28 +121,28 @@ class CommonValue : public BorrowedObj friend class CommonValue; private: - using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObject::_ThisBorrowedObject; protected: - using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObject::_LibObjPtr; using _ThisCommonValue = CommonValue; public: using Shared = internal::SharedValue, LibObjT>; - explicit CommonValue(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} + explicit CommonValue(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObject {libObjPtr} { } template - CommonValue(const CommonValue val) noexcept : _ThisBorrowedObj {val} + CommonValue(const CommonValue val) noexcept : _ThisBorrowedObject {val} { } template _ThisCommonValue& operator=(const CommonValue val) noexcept { - _ThisBorrowedObj::operator=(val); + _ThisBorrowedObject::operator=(val); return *this; }