cpp-common/bt2: remove useless friend classes to access libObjPtr()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Fri, 3 Nov 2023 15:56:49 +0000 (11:56 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Thu, 14 Dec 2023 15:57:04 +0000 (10:57 -0500)
Mr. Deslauriers made bt2::BorrowedObj::libObjPtr() public in 341a67c45
("cpp-common: Expose BorrowedObj::libObjPtr() as public method").

Therefore, all those friend classes aren't needed anymore.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Change-Id: Ie37bfa78e4cd29dd8e08af135ff6a0e597ebd0ae
Reviewed-on: https://review.lttng.org/c/babeltrace/+/11230
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/cpp-common/bt2/borrowed-object.hpp
src/cpp-common/bt2/field-class.hpp
src/cpp-common/bt2/integer-range-set.hpp
src/cpp-common/bt2/trace-ir.hpp
src/cpp-common/bt2/value.hpp

index 24f026ecf01bed7acc968045c09c092568b77e71..0e8c70de257d0a274c2edd49cff09600c0283387 100644 (file)
@@ -23,8 +23,8 @@ namespace bt2 {
  * `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.
+ * The user of a borrowed object, including methods of a derived class,
+ * can call libObjPtr() to access the libbabeltrace2 object pointer.
  */
 template <typename LibObjT>
 class BorrowedObject
index 6682e5b52a07d9a239b358a2852594e881403e85..ae2c52a3711f58da6754e6ef82c32c849506e658 100644 (file)
@@ -163,29 +163,6 @@ enum class FieldClassType
 template <typename LibObjT>
 class CommonFieldClass : public BorrowedObject<LibObjT>
 {
-    /* Allow appendMember() to call `fc.libObjPtr()` */
-    friend class CommonStructureFieldClass<bt_field_class>;
-
-    /* Allow appendOption() to call `fc.libObjPtr()` */
-    friend class CommonVariantWithoutSelectorFieldClass<bt_field_class>;
-
-    friend class CommonVariantWithIntegerSelectorFieldClass<
-        bt_field_class,
-        ConstVariantWithIntegerSelectorFieldClassOption<
-            const bt_field_class_variant_with_selector_field_integer_unsigned_option>>;
-
-    friend class CommonVariantWithIntegerSelectorFieldClass<
-        bt_field_class,
-        ConstVariantWithIntegerSelectorFieldClassOption<
-            const bt_field_class_variant_with_selector_field_integer_signed_option>>;
-
-    /* Allow *FieldClass() to call `fc.libObjPtr()` */
-    friend class CommonEventClass<bt_event_class>;
-    friend class CommonStreamClass<bt_stream_class>;
-
-    /* Allow create*FieldClass() to call `fc.libObjPtr()` */
-    friend class CommonTraceClass<bt_trace_class>;
-
 private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
 
index 974aa6004459d0745cfb9f434117f93c5685ebbb..f7ef1aaf77f966a95064e1b31149626a82fa5de2 100644 (file)
@@ -131,38 +131,9 @@ struct CommonIntegerRangeSetSpec<const bt_integer_range_set_signed> final
 
 } /* namespace internal */
 
-template <typename LibObjT>
-class ConstVariantWithIntegerSelectorFieldClassOption;
-
-template <typename LibObjT, typename RangeSetT>
-class CommonVariantWithIntegerSelectorFieldClass;
-
-template <typename LibObjT>
-class CommonTraceClass;
-
 template <typename LibObjT>
 class CommonIntegerRangeSet final : public BorrowedObject<LibObjT>
 {
-    /* Allow operator==() to call `other.libObjPtr()` */
-    friend class CommonIntegerRangeSet<bt_integer_range_set_unsigned>;
-    friend class CommonIntegerRangeSet<const bt_integer_range_set_unsigned>;
-    friend class CommonIntegerRangeSet<bt_integer_range_set_signed>;
-    friend class CommonIntegerRangeSet<const bt_integer_range_set_signed>;
-
-    /* Allow appendOption() to call `ranges.libObjPtr()` */
-    friend class CommonVariantWithIntegerSelectorFieldClass<
-        bt_field_class,
-        ConstVariantWithIntegerSelectorFieldClassOption<
-            const bt_field_class_variant_with_selector_field_integer_unsigned_option>>;
-
-    friend class CommonVariantWithIntegerSelectorFieldClass<
-        bt_field_class,
-        ConstVariantWithIntegerSelectorFieldClassOption<
-            const bt_field_class_variant_with_selector_field_integer_signed_option>>;
-
-    /* Allow create*FieldClass() to call `ranges.libObjPtr()` */
-    friend class CommonTraceClass<bt_trace_class>;
-
 private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
index 1026600e6b5089495b21e5f46a97a73f5db51267..efdf0ba07e33bcd793a80f2dced0c11ad85bcf7b 100644 (file)
@@ -633,9 +633,6 @@ struct CommonTraceSpec<const bt_trace> final
 template <typename LibObjT>
 class CommonTrace final : public BorrowedObject<LibObjT>
 {
-    /* Allow instantiate() to call `trace.libObjPtr()` */
-    friend class CommonStreamClass<bt_stream_class>;
-
 private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
     using typename BorrowedObject<LibObjT>::_LibObjPtr;
index 7c4e4a997c5b04596ec0fd8ece7930580f0d643a..1051cedf1b89bedea1c2f6edbe8adf50bc5a4fb5 100644 (file)
@@ -81,45 +81,9 @@ enum class ValueType
     MAP = BT_VALUE_TYPE_MAP,
 };
 
-template <typename LibObjT>
-class CommonClockClass;
-
-template <typename LibObjT>
-class CommonFieldClass;
-
-template <typename LibObjT>
-class CommonTraceClass;
-
-template <typename LibObjT>
-class CommonStreamClass;
-
-template <typename LibObjT>
-class CommonEventClass;
-
-template <typename LibObjT>
-class CommonStream;
-
 template <typename LibObjT>
 class CommonValue : public BorrowedObject<LibObjT>
 {
-    /* Allow append() to call `val.libObjPtr()` */
-    friend class CommonArrayValue<bt_value>;
-
-    /* Allow insert() to call `val.libObjPtr()` */
-    friend class CommonMapValue<bt_value>;
-
-    /* Allow userAttributes() to call `val.libObjPtr()` */
-    friend class CommonClockClass<bt_clock_class>;
-    friend class CommonFieldClass<bt_field_class>;
-    friend class CommonTraceClass<bt_trace_class>;
-    friend class CommonStreamClass<bt_stream_class>;
-    friend class CommonEventClass<bt_event_class>;
-    friend class CommonStream<bt_stream>;
-
-    /* Allow operator==() to call `other.libObjPtr()` */
-    friend class CommonValue<bt_value>;
-    friend class CommonValue<const bt_value>;
-
 private:
     using typename BorrowedObject<LibObjT>::_ThisBorrowedObject;
 
This page took 0.035056 seconds and 4 git commands to generate.