VirtualBox

Changeset 6170 in vbox


Ignore:
Timestamp:
Dec 21, 2007 3:02:10 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
26926
Message:

IPRT/cpputils: Wording.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpputils.h

    r6076 r6170  
    108108 * Pointer management includes the following key points:
    109109 *
    110  *   1) Automatic increment of the reference counter when a pointer to the
    111  *      object of the managed class or another auto_ptr_instance of the same
    112  *      type is assigned to the given auto_ref_ptr instance.
     110 *   1) Automatic increment of the object's reference counter when the given
     111 *      auto_ref_ptr instance starts managing a pointer to this object.
     112 *
    113113 *   2) Automatic decrement of the reference counter when the given
    114  *      auto_ref_ptr instance is destroyed (for example, as a result of
    115  *      leaving the scope) or berfore it is assigned a new object pointer.
    116  *   3) Automatic deletion of the managed object pointer whenever its
    117  *      reference counter reaches zero after a decrement.
    118  *   4) Providing the dereference operator that gives direct access to the
     114 *      auto_ref_ptr instance is destroyed, or before it is assigned a pointer
     115 *      to a new object.
     116 *
     117 *   3) Automatic deletion of the managed object whenever its reference
     118 *      counter reaches zero after a decrement.
     119 *
     120 *   4) Providing the dereference operator-> that gives direct access to the
    119121 *      managed pointer.
    120122 *
     
    135137
    136138    /**
    137      * Creates an instance that starts managing the given pointer.
     139     * Creates an instance that starts managing the given pointer. The
     140     * reference counter of the object pointed to by @a a is incremented by
     141     * one.
    138142     *
    139143     * @param a Pointer to manage.
     
    142146
    143147    /**
    144      * Creates an instance that starts managing the pointer managed
    145      * by the given object.
     148     * Creates an instance that starts managing a pointer managed by the given
     149     * instance. The reference counter of the object managed by @a that is
     150     * incremented by one.
    146151     *
    147      * @param that Object to manage.
     152     * @param that Instance to take a pointer to manage from.
    148153     */
    149154    auto_ref_ptr (const auto_ref_ptr &that) : m (that.m) { if (m) m->ref(); }
     
    152157   
    153158    /**
    154      * Assigns the given pointer to this instance and starts managing it.
     159     * Assigns the given pointer to this instance and starts managing it. The
     160     * reference counter of the object pointed to by @a a is incremented by
     161     * one. The reference counter of the object previously managed by this
     162     * instance is decremented by one.
    155163     *
    156164     * @param a Pointer to assign.
     
    159167
    160168    /**
    161      * Assigns the given pointer to this instance and starts managing it.
     169     * Assigns a pointer managed by the given instance to this instance and
     170     * starts managing it. The reference counter of the object managed by @a
     171     * that is incremented by one. The reference counter of the object
     172     * previously managed by this instance is decremented by one.
    162173     *
    163174     * @param a Pointer to assign.
     
    166177
    167178    /**
    168      * Returns @c true if this instance is null and false otherwise.
     179     * Returns @c true if this instance is @c null and false otherwise.
    169180     */
    170181    bool is_null() const { return m == NULL; }
     
    172183    /**
    173184     * Dereferences the instance by returning the managed pointer.
    174      * Asserts that the managed pointer is not NULL.
     185     * Asserts that the managed pointer is not @c NULL.
    175186     */
    176187    C *operator-> () const { AssertMsg (m, ("Managed pointer is NULL!\n")); return m; }
    177188
    178189    /**
    179      * Returns the managed pointer or NULL if this instance is null.
     190     * Returns the managed pointer or @c NULL if this instance is @c null.
    180191     */
    181192    C *raw() const { return m; }
    182193
    183194    /**
    184      * Compares this auto_ref_ptr instance another instance and returns @c
    185      * true if both instances manage the same or @c NULL pointer.
     195     * Compares this auto_ref_ptr instance with another instance and returns
     196     * @c true if both instances manage the same or @c NULL pointer.
    186197     *
    187      * Note that this method doesn't try to compare objects managed pointers
    188      * point to because that would a) break the common 'pointer to something'
    189      * semantics auto_ref_ptr tries to follow and b) require to define the
    190      * comparison operator in the managed class which is not always possible.
    191      * You may analyze pointed objects yourself if you need more precise
    192      * comparison.
     198     * Note that this method compares pointer values only, it doesn't try to
     199     * compare objects themselves. Doing otherwise would a) break the common
     200     * 'pointer to something' comparison semantics auto_ref_ptr tries to
     201     * follow and b) require to define the comparison operator in the managed
     202     * class which is not always possible. You may analyze pointed objects
     203     * yourself if you need more precise comparison.
    193204     *
    194      * @param that Object to compare this object with.
     205     * @param that Instance to compare this instance with.
    195206     */
    196207    bool operator== (const auto_ref_ptr &that) const
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette