Hoa Nguyen has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/33116 )

Change subject: base: Tag API methods in refcnt.hh
......................................................................

base: Tag API methods in refcnt.hh

Change-Id: Ic0d6a6fd6e55a1996d94899157a9d4a6c0a0fe84
Signed-off-by: Hoa Nguyen <hoangu...@ucdavis.edu>
---
M src/base/refcnt.hh
1 file changed, 119 insertions(+), 28 deletions(-)



diff --git a/src/base/refcnt.hh b/src/base/refcnt.hh
index b4eeabf..1595ee5 100644
--- a/src/base/refcnt.hh
+++ b/src/base/refcnt.hh
@@ -77,6 +77,8 @@
      *
      * @attention A memory leak will occur if you never assign a newly
      * constructed object to a reference counting pointer.
+     *
+     * @ingroup api_ref_count
      */
     RefCounted() : count(0) {}

@@ -91,11 +93,19 @@
      */
     virtual ~RefCounted() {}

-    /// Increment the reference count
+    /**
+     * Increment the reference count
+     *
+     * @ingroup api_ref_count
+     */
     void incref() const { ++count; }

-    /// Decrement the reference count and destroy the object if all
-    /// references are gone.
+    /**
+     * Decrement the reference count and destroy the object if all
+     * references are gone.
+     *
+     * @ingroup api_ref_count
+     */
     void decref() const { if (--count <= 0) delete this; }
 };

@@ -179,19 +189,34 @@
     }

   public:
-    /// Create an empty reference counting pointer.
+    /**
+     * Create an empty reference counting pointer.
+     *
+     * @ingroup api_ref_count_pointer
+     */
     RefCountingPtr() : data(0) {}

-    /// Create a new reference counting pointer to some object
-    /// (probably something newly created).  Adds a reference.
+    /**
+     * Create a new reference counting pointer to some object
+     * (probably something newly created).  Adds a reference.
+     *
+     * @ingroup api_ref_count_pointer
+     */
     RefCountingPtr(T *data) { copy(data); }

-    /// Create a new reference counting pointer by copying another
-    /// one.  Adds a reference.
+    /**
+     * Create a new reference counting pointer by copying another
+     * one.  Adds a reference.
+     *
+     * @ingroup api_ref_count_pointer
+     */
     RefCountingPtr(const RefCountingPtr &r) { copy(r.data); }

-    /** Move-constructor.
+    /**
+     * Move-constructor.
      * Does not add a reference.
+     *
+     * @ingroup api_ref_count_pointer
      */
     RefCountingPtr(RefCountingPtr&& r)
     {
@@ -199,39 +224,73 @@
         r.data = nullptr;
     }

+    /**
+     * @ingroup api_ref_count_pointer
+     */
     template <bool B = TisConst>
     RefCountingPtr(const NonConstT &r) { copy(r.data); }

-    /// Destroy the pointer and any reference it may hold.
+    /**
+     * Destroy the pointer and any reference it may hold.
+     *
+     * @ingroup api_ref_count_pointer
+     */
     ~RefCountingPtr() { del(); }

     // The following pointer access functions are const because they
     // don't actually change the pointer, though the user could change
     // what is pointed to.  This is analagous to a "Foo * const".

-    /// Access a member variable.
+    /**
+     * Access a member variable.
+     *
+     * @ingroup api_ref_count_pointer
+     */
     T *operator->() const { return data; }

-    /// Dereference the pointer.
+    /**
+     *  Dereference the pointer.
+     *
+     * @ingroup api_ref_count_pointer
+     */
     T &operator*() const { return *data; }

-    /// Directly access the pointer itself without taking a reference.
+    /**
+     * Directly access the pointer itself without taking a reference.
+     *
+     * @ingroup api_ref_count_pointer
+     */
     T *get() const { return data; }

+    /**
+     * @ingroup api_ref_count_pointer
+     */
     template <bool B = TisConst>
     operator RefCountingPtr<typename std::enable_if<!B, ConstT>::type>()
     {
         return RefCountingPtr<const T>(*this);
     }

-    /// Assign a new value to the pointer
+    /**
+     * Assign a new value to the pointer
+     *
+     * @ingroup api_ref_count_pointer
+     */
     const RefCountingPtr &operator=(T *p) { set(p); return *this; }

-    /// Copy the pointer from another RefCountingPtr
+    /**
+     * Copy the pointer from another RefCountingPtr
+     *
+     * @ingroup api_ref_count_pointer
+     */
     const RefCountingPtr &operator=(const RefCountingPtr &r)
     { return operator=(r.data); }

-    /// Move-assign the pointer from another RefCountingPtr
+    /**
+     * Move-assign the pointer from another RefCountingPtr
+     *
+     * @ingroup api_ref_count_pointer
+     */
     const RefCountingPtr &operator=(RefCountingPtr&& r)
     {
/* This happens regardless of whether the pointer is the same or not,
@@ -243,43 +302,75 @@
         return *this;
     }

-    /// Check if the pointer is empty
+    /**
+     * Check if the pointer is empty
+     *
+     * @ingroup api_ref_count_pointer
+     */
     bool operator!() const { return data == 0; }

-    /// Check if the pointer is non-empty
+    /**
+     * Check if the pointer is non-empty
+     *
+     * @ingroup api_ref_count_pointer
+     */
     operator bool() const { return data != 0; }
 };

-/// Check for equality of two reference counting pointers.
+/**
+ * Check for equality of two reference counting pointers.
+ *
+ * @ingroup api_ref_count_pointer
+ */
 template<class T>
inline bool operator==(const RefCountingPtr<T> &l, const RefCountingPtr<T> &r)
 { return l.get() == r.get(); }

-/// Check for equality of of a reference counting pointers and a
-/// regular pointer
+/**
+ * Check for equality of of a reference counting pointers and a
+ * regular pointer
+ *
+ * @ingroup api_ref_count_pointer
+ */
 template<class T>
 inline bool operator==(const RefCountingPtr<T> &l, const T *r)
 { return l.get() == r; }

-/// Check for equality of of a reference counting pointers and a
-/// regular pointer
+/**
+ * Check for equality of of a reference counting pointers and a
+ * regular pointer
+ *
+ * @ingroup api_ref_count_pointer
+ */
 template<class T>
 inline bool operator==(const T *l, const RefCountingPtr<T> &r)
 { return l == r.get(); }

-/// Check for inequality of two reference counting pointers.
+/**
+ * Check for inequality of two reference counting pointers.
+ *
+ * @ingroup api_ref_count_pointer
+ */
 template<class T>
inline bool operator!=(const RefCountingPtr<T> &l, const RefCountingPtr<T> &r)
 { return l.get() != r.get(); }

-/// Check for inequality of of a reference counting pointers and a
-/// regular pointer
+/**
+ * Check for inequality of of a reference counting pointers and a
+ * regular pointer
+ *
+ * @ingroup api_ref_count_pointer
+ */
 template<class T>
 inline bool operator!=(const RefCountingPtr<T> &l, const T *r)
 { return l.get() != r; }

-/// Check for inequality of of a reference counting pointers and a
-/// regular pointer
+/**
+ * Check for inequality of of a reference counting pointers and a
+ * regular pointer
+ *
+ * @ingroup api_ref_count_pointer
+ */
 template<class T>
 inline bool operator!=(const T *l, const RefCountingPtr<T> &r)
 { return l != r.get(); }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/33116
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: Ic0d6a6fd6e55a1996d94899157a9d4a6c0a0fe84
Gerrit-Change-Number: 33116
Gerrit-PatchSet: 1
Gerrit-Owner: Hoa Nguyen <hoangu...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to