NeoPZ
Classes | Public Member Functions | Private Attributes | Friends | List of all members
TPZAutoPointer< T > Class Template Reference

This class implements a reference counter mechanism to administer a dynamically allocated object. Utility. More...

#include <TPZPersistenceManager.h>

Collaboration diagram for TPZAutoPointer< T >:
[legend]

Classes

struct  TPZReference
 Counter struct. More...
 

Public Member Functions

 TPZAutoPointer ()
 Creates an reference counted null pointer. More...
 
 ~TPZAutoPointer ()
 The destructor will delete the administered pointer if its reference count is zero. More...
 
 TPZAutoPointer (T *obj)
 This method will create an object which will administer the area pointed to by obj. More...
 
 TPZAutoPointer (const TPZAutoPointer< T > &copy)
 Share the pointer of the copy. More...
 
TPZAutoPointeroperator= (TPZAutoPointer< T > &&copy)
 Move assignment operator. More...
 
TPZAutoPointeroperator= (const TPZAutoPointer< T > &copy)
 Assignment operator. More...
 
 operator T & ()
 Returns the referenced object. More...
 
T & operator* () const
 Returns the referenced object. More...
 
T & operator* ()
 Returns the referenced object. More...
 
T * operator-> () const
 Returns the pointer for referenced object. More...
 
T * operator-> ()
 
void ReallocForNuma (int node)
 
 operator bool () const
 Returns if pointer was attributed. More...
 
 operator bool ()
 
int Count () const
 Returns the counter value. More...
 
int Count ()
 

Private Attributes

TPZReference< T > * fRef
 The object which contains the pointer and the reference count. More...
 

Friends

template<typename R , typename T2 >
TPZAutoPointer< R > TPZAutoPointerDynamicCast (TPZAutoPointer< T2 > in)
 

Detailed Description

template<class T>
class TPZAutoPointer< T >

This class implements a reference counter mechanism to administer a dynamically allocated object. Utility.

Author
Philippe R. B. Devloo

Definition at line 14 of file TPZPersistenceManager.h.

Constructor & Destructor Documentation

◆ TPZAutoPointer() [1/3]

template<class T>
TPZAutoPointer< T >::TPZAutoPointer ( )
inline

Creates an reference counted null pointer.

Definition at line 148 of file tpzautopointer.h.

◆ ~TPZAutoPointer()

template<class T>
TPZAutoPointer< T >::~TPZAutoPointer ( )
inline

The destructor will delete the administered pointer if its reference count is zero.

Definition at line 154 of file tpzautopointer.h.

◆ TPZAutoPointer() [2/3]

template<class T>
TPZAutoPointer< T >::TPZAutoPointer ( T *  obj)
inline

This method will create an object which will administer the area pointed to by obj.

Definition at line 162 of file tpzautopointer.h.

◆ TPZAutoPointer() [3/3]

template<class T>
TPZAutoPointer< T >::TPZAutoPointer ( const TPZAutoPointer< T > &  copy)
inline

Share the pointer of the copy.

Definition at line 168 of file tpzautopointer.h.

Member Function Documentation

◆ Count() [1/2]

template<class T>
int TPZAutoPointer< T >::Count ( ) const
inline

Returns the counter value.

Definition at line 236 of file tpzautopointer.h.

◆ Count() [2/2]

template<class T>
int TPZAutoPointer< T >::Count ( )
inline

Definition at line 240 of file tpzautopointer.h.

◆ operator bool() [1/2]

template<class T>
TPZAutoPointer< T >::operator bool ( ) const
inline

Returns if pointer was attributed.

Definition at line 228 of file tpzautopointer.h.

◆ operator bool() [2/2]

template<class T>
TPZAutoPointer< T >::operator bool ( )
inline

Definition at line 231 of file tpzautopointer.h.

◆ operator T &()

template<class T>
TPZAutoPointer< T >::operator T& ( )
inline

Returns the referenced object.

Definition at line 195 of file tpzautopointer.h.

◆ operator*() [1/2]

template<class T>
T& TPZAutoPointer< T >::operator* ( ) const
inline

Returns the referenced object.

Definition at line 201 of file tpzautopointer.h.

◆ operator*() [2/2]

template<class T>
T& TPZAutoPointer< T >::operator* ( )
inline

Returns the referenced object.

Definition at line 207 of file tpzautopointer.h.

◆ operator->() [1/2]

template<class T>
T* TPZAutoPointer< T >::operator-> ( ) const
inline

Returns the pointer for referenced object.

Definition at line 213 of file tpzautopointer.h.

◆ operator->() [2/2]

template<class T>
T* TPZAutoPointer< T >::operator-> ( )
inline

Definition at line 217 of file tpzautopointer.h.

◆ operator=() [1/2]

template<class T>
TPZAutoPointer& TPZAutoPointer< T >::operator= ( TPZAutoPointer< T > &&  copy)
inline

Move assignment operator.

Definition at line 175 of file tpzautopointer.h.

◆ operator=() [2/2]

template<class T>
TPZAutoPointer& TPZAutoPointer< T >::operator= ( const TPZAutoPointer< T > &  copy)
inline

Assignment operator.

Definition at line 185 of file tpzautopointer.h.

◆ ReallocForNuma()

template<class T>
void TPZAutoPointer< T >::ReallocForNuma ( int  node)
inline

Friends And Related Function Documentation

◆ TPZAutoPointerDynamicCast

template<class T>
template<typename R , typename T2 >
TPZAutoPointer<R> TPZAutoPointerDynamicCast ( TPZAutoPointer< T2 >  in)
friend

Member Data Documentation

◆ fRef

template<class T>
TPZReference<T>* TPZAutoPointer< T >::fRef
private

The object which contains the pointer and the reference count.

Definition at line 144 of file tpzautopointer.h.

Referenced by TPZAutoPointer< TPZDohrSubstructCondense< TVar > >::operator=(), TPZAutoPointer< TPZDohrSubstructCondense< TVar > >::TPZAutoPointer(), and TPZAutoPointerDynamicCast().


The documentation for this class was generated from the following files: