#include <Teuchos_RefCountPtrDecl.hpp>
Inheritance diagram for Teuchos::RefCountPtr< T >:
Public Types | |
| typedef T | element_type |
Public Member Functions | |
| RefCountPtr (ENull null_arg=null) | |
Initialize RefCountPtr<T> to NULL. | |
| RefCountPtr (const RefCountPtr< T > &r_ptr) | |
Initialize from another RefCountPtr<T> object. | |
| template<class T2> | |
| RefCountPtr (const RefCountPtr< T2 > &r_ptr) | |
Initialize from another RefCountPtr<T2> object (implicit conversion only). | |
| ~RefCountPtr () | |
| Removes a reference to a dynamically allocated object and possibly deletes the object if owned. | |
| RefCountPtr< T > & | operator= (const RefCountPtr< T > &r_ptr) |
| Copy the pointer to the referenced object and increment the reference count. | |
| T * | operator-> () const |
Pointer (->) access to members of underlying object. | |
| T & | operator * () const |
| Dereference the underlying object. | |
| T * | get () const |
| Get the raw C++ pointer to the underlying object. | |
| T * | release () |
| Release the ownership of the underlying dynamically allocated object. | |
| int | count () const |
Return the number of RefCountPtr<> objects that have a reference to the underlying pointer that is being shared. | |
| void | set_has_ownership () |
Give this and other RefCountPtr<> objects ownership of the referenced object this->get(). | |
| bool | has_ownership () const |
Returns true if this has ownership of object pointed to by this->get() in order to delete it. | |
| bool | shares_resource (const RefCountPtr< T > &r_ptr) const |
| Returns true if the the smart pointers share the same resource. | |
Private Types | |
| typedef PrivateUtilityPack::RefCountPtr_node | node_t |
Private Member Functions | |
| void | assert_not_null () const |
Private Attributes | |
| T * | ptr_ |
| node_t * | node_ |
This is a class for smart reference counted pointer objects that deletes an object (if the object is owned) that was allocated by new after all refereces to it have been removed.
For casting, non-member template functions are supplied to allow the equaivalient to implicit pointer casts and const casts. Dynamic casting with multiple inheritance is also handled by this implementation.
The client must be very careful how this class is used. Conversions from RefCountPtr<T1> to RefCountPtr<T2> objects must be handled by the conversion functions. Never use get() to perform a conversion.
For a more detailed discussion see this description.
Definition at line 102 of file Teuchos_RefCountPtrDecl.hpp.
|
|||||
|
Definition at line 105 of file Teuchos_RefCountPtrDecl.hpp. |
|
|||||
|
Definition at line 282 of file Teuchos_RefCountPtrDecl.hpp. |
|
||||||||||
|
Initialize This allows clients to write code like: RefCountPtr<int> p = null; RefCountPtr<int> p; NULL
Definition at line 137 of file Teuchos_RefCountPtr.hpp. |
|
||||||||||
|
Initialize from another
After construction, This form of the copy constructor is required even though the below more general templated version is sufficient since some compilers will generate this function automatically which will give an incorrect implementation. Postconditons:
Definition at line 144 of file Teuchos_RefCountPtr.hpp. |
|
||||||||||||||
|
Initialize from another
This function allows the implicit conversion of smart pointer objects just like with raw C++ pointers. Note that this function will only compile if the statement Postconditons:
Definition at line 153 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Removes a reference to a dynamically allocated object and possibly deletes the object if owned.
Peforms Definition at line 162 of file Teuchos_RefCountPtr.hpp. |
|
||||||||||
|
Copy the pointer to the referenced object and increment the reference count.
If Postconditons:
Definition at line 169 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Pointer ( Preconditions:
Definition at line 185 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Dereference the underlying object. Preconditions:
Definition at line 192 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Get the raw C++ pointer to the underlying object.
Definition at line 199 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Release the ownership of the underlying dynamically allocated object.
After this function is called then the client is responsible for calling delete on the returned pointer no matter how many
Note that this function does not have the exact same semantics as does Postconditions:
Definition at line 205 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Return the number of
Definition at line 213 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Give
See ~RefCountPtr() above. This function does nothing if Postconditions:
Definition at line 221 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Returns true if See ~RefCountPtr() above.
Definition at line 228 of file Teuchos_RefCountPtr.hpp. |
|
||||||||||
|
Returns true if the the smart pointers share the same resource.
This method does more than just check if Definition at line 236 of file Teuchos_RefCountPtr.hpp. |
|
|||||||||
|
Definition at line 244 of file Teuchos_RefCountPtr.hpp. |
|
|||||
|
Definition at line 287 of file Teuchos_RefCountPtrDecl.hpp. |
|
|||||
|
Definition at line 288 of file Teuchos_RefCountPtrDecl.hpp. |
1.3.9.1