From: Simon Marchi Date: Mon, 11 Dec 2023 20:03:04 +0000 (-0500) Subject: cpp-common/bt2: `bt2::internal::BorrowedObj` -> `bt2::BorrowedObj` X-Git-Url: https://git.efficios.com/?a=commitdiff_plain;h=02f1b80317d17a9c72a82f0138b9f8143506c1ba;p=babeltrace.git cpp-common/bt2: `bt2::internal::BorrowedObj` -> `bt2::BorrowedObj` `BorrowedObj` is not completely internal: it has public methods which any concrete borrowed object inherits. Also, we don't need to hide anything from the end user in this file. Therefore make this base class not internal. Signed-off-by: Philippe Proulx Change-Id: Ib3a396a1aa7794608a4ec938f9b141c553e36c97 Reviewed-on: https://review.lttng.org/c/babeltrace/+/11365 Reviewed-by: Simon Marchi --- diff --git a/src/Makefile.am b/src/Makefile.am index 98b89b33..fc890bb3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -12,6 +12,7 @@ SUBDIRS += bindings/python/bt2 endif noinst_HEADERS = \ + cpp-common/bt2/borrowed-obj.hpp \ cpp-common/bt2/clock-class.hpp \ cpp-common/bt2/clock-snapshot.hpp \ cpp-common/bt2/common-iter.hpp \ @@ -21,7 +22,6 @@ noinst_HEADERS = \ cpp-common/bt2/field-path.hpp \ cpp-common/bt2/integer-range.hpp \ cpp-common/bt2/integer-range-set.hpp \ - cpp-common/bt2/internal/borrowed-obj.hpp \ cpp-common/bt2/internal/shared-obj.hpp \ cpp-common/bt2/internal/utils.hpp \ cpp-common/bt2/logging.hpp \ diff --git a/src/cpp-common/bt2/borrowed-obj.hpp b/src/cpp-common/bt2/borrowed-obj.hpp new file mode 100644 index 00000000..b006670e --- /dev/null +++ b/src/cpp-common/bt2/borrowed-obj.hpp @@ -0,0 +1,168 @@ +/* + * 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/clock-class.hpp b/src/cpp-common/bt2/clock-class.hpp index b2367645..c713ca26 100644 --- a/src/cpp-common/bt2/clock-class.hpp +++ b/src/cpp-common/bt2/clock-class.hpp @@ -17,8 +17,8 @@ #include "cpp-common/string_view.hpp" #include "cpp-common/uuid-view.hpp" +#include "borrowed-obj.hpp" #include "exc.hpp" -#include "internal/borrowed-obj.hpp" #include "internal/shared-obj.hpp" #include "internal/utils.hpp" #include "value.hpp" @@ -92,11 +92,11 @@ private: }; template -class CommonClockClass final : public internal::BorrowedObj +class CommonClockClass final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ThisCommonClockClass = CommonClockClass; public: diff --git a/src/cpp-common/bt2/clock-snapshot.hpp b/src/cpp-common/bt2/clock-snapshot.hpp index 364400b6..acd399b1 100644 --- a/src/cpp-common/bt2/clock-snapshot.hpp +++ b/src/cpp-common/bt2/clock-snapshot.hpp @@ -11,12 +11,12 @@ #include +#include "borrowed-obj.hpp" #include "exc.hpp" -#include "internal/borrowed-obj.hpp" namespace bt2 { -class ConstClockSnapshot final : public internal::BorrowedObj +class ConstClockSnapshot final : public BorrowedObj { public: explicit ConstClockSnapshot(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} diff --git a/src/cpp-common/bt2/field-class.hpp b/src/cpp-common/bt2/field-class.hpp index 165cfde3..a8bbb3c4 100644 --- a/src/cpp-common/bt2/field-class.hpp +++ b/src/cpp-common/bt2/field-class.hpp @@ -16,11 +16,11 @@ #include "cpp-common/optional.hpp" #include "cpp-common/string_view.hpp" +#include "borrowed-obj.hpp" #include "common-iter.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" @@ -161,7 +161,7 @@ enum class FieldClassType }; template -class CommonFieldClass : public internal::BorrowedObj +class CommonFieldClass : public BorrowedObj { /* Allow appendMember() to call `fc.libObjPtr()` */ friend class CommonStructureFieldClass; @@ -187,10 +187,10 @@ class CommonFieldClass : public internal::BorrowedObj friend class CommonTraceClass; private: - using typename internal::BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_ThisBorrowedObj; protected: - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_LibObjPtr; using _ThisCommonFieldClass = CommonFieldClass; public: @@ -679,11 +679,11 @@ struct ConstEnumerationFieldClassMappingSpec -class ConstEnumerationFieldClassMapping final : public internal::BorrowedObj +class ConstEnumerationFieldClassMapping final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; public: using RangeSet = typename std::conditional< @@ -1000,11 +1000,11 @@ struct CommonStructureFieldClassMemberSpec -class CommonStructureFieldClassMember final : public internal::BorrowedObj +class CommonStructureFieldClassMember final : public BorrowedObj { private: - using typename internal::BorrowedObj::_LibObjPtr; - using typename internal::BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; using _FieldClass = typename std::conditional::value, ConstFieldClass, FieldClass>::type; @@ -1925,11 +1925,11 @@ struct CommonVariantFieldClassOptionSpec fi } /* namespace internal */ template -class CommonVariantFieldClassOption : public internal::BorrowedObj +class CommonVariantFieldClassOption : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _FieldClass = typename std::conditional::value, ConstFieldClass, FieldClass>::type; @@ -2076,11 +2076,11 @@ struct ConstVariantWithIntegerSelectorFieldClassOptionSpec< } /* namespace internal */ template -class ConstVariantWithIntegerSelectorFieldClassOption : public internal::BorrowedObj +class ConstVariantWithIntegerSelectorFieldClassOption : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _Spec = internal::ConstVariantWithIntegerSelectorFieldClassOptionSpec; public: diff --git a/src/cpp-common/bt2/field-path.hpp b/src/cpp-common/bt2/field-path.hpp index 0a68927c..aac6ffd1 100644 --- a/src/cpp-common/bt2/field-path.hpp +++ b/src/cpp-common/bt2/field-path.hpp @@ -13,8 +13,8 @@ #include "common/assert.h" +#include "borrowed-obj.hpp" #include "common-iter.hpp" -#include "internal/borrowed-obj.hpp" #include "internal/shared-obj.hpp" namespace bt2 { @@ -28,7 +28,7 @@ enum class FieldPathItemType CURRENT_OPTION_CONTENT = BT_FIELD_PATH_ITEM_TYPE_CURRENT_OPTION_CONTENT, }; -class ConstFieldPathItem : public internal::BorrowedObj +class ConstFieldPathItem : public BorrowedObj { public: explicit ConstFieldPathItem(const _LibObjPtr libObjPtr) noexcept : _ThisBorrowedObj {libObjPtr} @@ -123,7 +123,7 @@ struct FieldPathRefFuncs final } /* namespace internal */ -class ConstFieldPath final : public internal::BorrowedObj +class ConstFieldPath final : public BorrowedObj { public: using Shared = diff --git a/src/cpp-common/bt2/field.hpp b/src/cpp-common/bt2/field.hpp index 5a3fdfd9..61cdd60a 100644 --- a/src/cpp-common/bt2/field.hpp +++ b/src/cpp-common/bt2/field.hpp @@ -16,8 +16,8 @@ #include "cpp-common/optional.hpp" #include "cpp-common/string_view.hpp" +#include "borrowed-obj.hpp" #include "field-class.hpp" -#include "internal/borrowed-obj.hpp" #include "internal/utils.hpp" namespace bt2 { @@ -92,13 +92,13 @@ struct CommonFieldSpec final } /* namespace internal */ template -class CommonField : public internal::BorrowedObj +class CommonField : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_ThisBorrowedObj; protected: - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_LibObjPtr; using _ThisCommonField = CommonField; public: diff --git a/src/cpp-common/bt2/integer-range-set.hpp b/src/cpp-common/bt2/integer-range-set.hpp index a86bcaf9..1ad8f4c1 100644 --- a/src/cpp-common/bt2/integer-range-set.hpp +++ b/src/cpp-common/bt2/integer-range-set.hpp @@ -12,10 +12,10 @@ #include +#include "borrowed-obj.hpp" #include "common-iter.hpp" #include "exc.hpp" #include "integer-range.hpp" -#include "internal/borrowed-obj.hpp" #include "internal/utils.hpp" namespace bt2 { @@ -141,7 +141,7 @@ template class CommonTraceClass; template -class CommonIntegerRangeSet final : public internal::BorrowedObj +class CommonIntegerRangeSet final : public BorrowedObj { /* Allow operator==() to call `other.libObjPtr()` */ friend class CommonIntegerRangeSet; @@ -164,8 +164,8 @@ class CommonIntegerRangeSet final : public internal::BorrowedObj friend class CommonTraceClass; private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ConstLibObjT = typename std::add_const::type; using _RefFuncs = internal::IntegerRangeSetRefFuncs<_ConstLibObjT>; using _Spec = internal::CommonIntegerRangeSetSpec<_ConstLibObjT>; diff --git a/src/cpp-common/bt2/integer-range.hpp b/src/cpp-common/bt2/integer-range.hpp index 12570718..03ba0b60 100644 --- a/src/cpp-common/bt2/integer-range.hpp +++ b/src/cpp-common/bt2/integer-range.hpp @@ -12,7 +12,7 @@ #include -#include "internal/borrowed-obj.hpp" +#include "borrowed-obj.hpp" namespace bt2 { @@ -66,11 +66,11 @@ struct ConstIntegerRangeSpec final } /* namespace internal */ template -class ConstIntegerRange final : public internal::BorrowedObj +class ConstIntegerRange final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ThisConstIntegerRange = ConstIntegerRange; public: diff --git a/src/cpp-common/bt2/internal/borrowed-obj.hpp b/src/cpp-common/bt2/internal/borrowed-obj.hpp deleted file mode 100644 index 5d3ab64d..00000000 --- a/src/cpp-common/bt2/internal/borrowed-obj.hpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2019-2020 (c) Philippe Proulx - * - * SPDX-License-Identifier: MIT - */ - -#ifndef BABELTRACE_CPP_COMMON_BT2_INTERNAL_BORROWED_OBJ_HPP -#define BABELTRACE_CPP_COMMON_BT2_INTERNAL_BORROWED_OBJ_HPP - -#include -#include - -#include "common/assert.h" - -namespace bt2 { -namespace internal { - -/* - * 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 internal */ -} /* namespace bt2 */ - -#endif /* BABELTRACE_CPP_COMMON_BT2_INTERNAL_BORROWED_OBJ_HPP */ diff --git a/src/cpp-common/bt2/message.hpp b/src/cpp-common/bt2/message.hpp index fe476dc6..eb1980a5 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 "internal/borrowed-obj.hpp" +#include "borrowed-obj.hpp" #include "internal/shared-obj.hpp" #include "internal/utils.hpp" @@ -79,13 +79,13 @@ enum class MessageType }; template -class CommonMessage : public internal::BorrowedObj +class CommonMessage : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_ThisBorrowedObj; protected: - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_LibObjPtr; using _ThisCommonMessage = CommonMessage; public: diff --git a/src/cpp-common/bt2/trace-ir.hpp b/src/cpp-common/bt2/trace-ir.hpp index f27a87ae..3a936782 100644 --- a/src/cpp-common/bt2/trace-ir.hpp +++ b/src/cpp-common/bt2/trace-ir.hpp @@ -15,10 +15,10 @@ #include "cpp-common/optional.hpp" #include "cpp-common/string_view.hpp" +#include "borrowed-obj.hpp" #include "clock-class.hpp" #include "field-class.hpp" #include "field.hpp" -#include "internal/borrowed-obj.hpp" #include "internal/utils.hpp" #include "value.hpp" @@ -123,11 +123,11 @@ struct CommonEventSpec final } /* namespace internal */ template -class CommonEvent final : public internal::BorrowedObj +class CommonEvent final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ConstSpec = internal::CommonEventSpec; using _Spec = internal::CommonEventSpec; @@ -307,11 +307,11 @@ struct CommonPacketSpec final } /* namespace internal */ template -class CommonPacket final : public internal::BorrowedObj +class CommonPacket final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ConstSpec = internal::CommonPacketSpec; using _Spec = internal::CommonPacketSpec; using _ThisCommonPacket = CommonPacket; @@ -481,11 +481,11 @@ struct CommonStreamSpec final } /* namespace internal */ template -class CommonStream final : public internal::BorrowedObj +class CommonStream final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ConstSpec = internal::CommonStreamSpec; using _Spec = internal::CommonStreamSpec; using _ThisCommonStream = CommonStream; @@ -711,14 +711,14 @@ struct CommonTraceSpec final } /* namespace internal */ template -class CommonTrace final : public internal::BorrowedObj +class CommonTrace final : public BorrowedObj { /* Allow instantiate() to call `trace.libObjPtr()` */ friend class CommonStreamClass; private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ConstSpec = internal::CommonTraceSpec; using _Spec = internal::CommonTraceSpec; using _ThisCommonTrace = CommonTrace; @@ -1047,11 +1047,11 @@ struct CommonEventClassSpec final } /* namespace internal */ template -class CommonEventClass final : public internal::BorrowedObj +class CommonEventClass final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ConstSpec = internal::CommonEventClassSpec; using _Spec = internal::CommonEventClassSpec; using _ThisCommonEventClass = CommonEventClass; @@ -1423,11 +1423,11 @@ struct CommonStreamClassSpec final } /* namespace internal */ template -class CommonStreamClass final : public internal::BorrowedObj +class CommonStreamClass final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ConstSpec = internal::CommonStreamClassSpec; using _Spec = internal::CommonStreamClassSpec; using _ThisCommonStreamClass = CommonStreamClass; @@ -1916,11 +1916,11 @@ struct CommonTraceClassSpec final } /* namespace internal */ template -class CommonTraceClass final : public internal::BorrowedObj +class CommonTraceClass final : public BorrowedObj { private: - using typename internal::BorrowedObj::_ThisBorrowedObj; - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_LibObjPtr; using _ConstSpec = internal::CommonTraceClassSpec; using _Spec = internal::CommonTraceClassSpec; using _ThisCommonTraceClass = CommonTraceClass; diff --git a/src/cpp-common/bt2/value.hpp b/src/cpp-common/bt2/value.hpp index 0dfe9dc6..9f30b74b 100644 --- a/src/cpp-common/bt2/value.hpp +++ b/src/cpp-common/bt2/value.hpp @@ -18,9 +18,9 @@ #include "cpp-common/optional.hpp" #include "cpp-common/string_view.hpp" +#include "borrowed-obj.hpp" #include "common-iter.hpp" #include "exc.hpp" -#include "internal/borrowed-obj.hpp" #include "internal/shared-obj.hpp" #include "internal/utils.hpp" @@ -100,7 +100,7 @@ template class CommonStream; template -class CommonValue : public internal::BorrowedObj +class CommonValue : public BorrowedObj { /* Allow append() to call `val.libObjPtr()` */ friend class CommonArrayValue; @@ -121,10 +121,10 @@ class CommonValue : public internal::BorrowedObj friend class CommonValue; private: - using typename internal::BorrowedObj::_ThisBorrowedObj; + using typename BorrowedObj::_ThisBorrowedObj; protected: - using typename internal::BorrowedObj::_LibObjPtr; + using typename BorrowedObj::_LibObjPtr; using _ThisCommonValue = CommonValue; public: