The C++ framework for developing highly scalable, high performance servers on Windows platforms.

TConditionalSmartPointer Class Template Reference
[Smart Pointer]

Inheritance diagram for TConditionalSmartPointer:
Collaboration diagram for TConditionalSmartPointer:

List of all members.


Detailed Description

template<class T>
class JetByteTools::Core::TConditionalSmartPointer< T >

A smart pointer to memory using the C++ new API. Calls delete on any memory that the TConditionalSmartPointer owns when it goes out of scope to aid in scope based designs. Note that the TConditionalSmartPointer can be told that it does NOT own the memory that it is given; this is useful if sometimes it holds dynamically allocated memory that it should own and delete and sometimes it holds a pointer to, for example, a static null object implementation.


Public Member Functions

 TConditionalSmartPointer ()
 Create a TConditionalSmartPointer that currently owns no memory.
 TConditionalSmartPointer (T *pMemoryThatWasAllocatedWithNew, bool takeOwnershipOfMemory=true)
 Create a CConditionalSmartPointer that owns the supplied memory which must have been allocated using new. Can optionally be told NOT to take ownership of the supplied memory.
 TConditionalSmartPointer (const TConditionalSmartPointer &rhs)
 ~TConditionalSmartPointer ()
TConditionalSmartPointeroperator= (const TConditionalSmartPointer &rhs)
TConditionalSmartPointeroperator= (T *pMemoryThatWasAllocatedWithNew)
TConditionalSmartPointerAssign (T *pMemoryThatWasAllocatedWithNew, bool takeOwnershipOfMemory)
 Assign the supplied pointer to the CConditionalSmartPointer with the indicated ownership.
T * Get () const
 Obtain access to any memory that is owned by the pointer.
T * Detach ()
 Give up ownership and return any memory that is owned.
 operator T * () const
 Provide access to any memory that is owned by the pointer.
T * operator-> () const
T & operator * () const
bool IsValid () const
 Returns true if the TConditionalSmartPointer currently points to some memory.


Constructor & Destructor Documentation

TConditionalSmartPointer (  )  [inline]

Create a TConditionalSmartPointer that currently owns no memory.

TConditionalSmartPointer ( T *  pMemoryThatWasAllocatedWithNew,
bool  takeOwnershipOfMemory = true 
) [inline, explicit]

Create a CConditionalSmartPointer that owns the supplied memory which must have been allocated using new. Can optionally be told NOT to take ownership of the supplied memory.

~TConditionalSmartPointer (  )  [inline]


Member Function Documentation

TConditionalSmartPointer& operator= ( const TConditionalSmartPointer< T > &  rhs  ) 

TConditionalSmartPointer< T > & operator= ( T *  pMemoryThatWasAllocatedWithNew  )  [inline]

TConditionalSmartPointer< T > & Assign ( T *  pMemoryThatWasAllocatedWithNew,
bool  takeOwnershipOfMemory 
) [inline]

Assign the supplied pointer to the CConditionalSmartPointer with the indicated ownership.

T * Get (  )  const [inline]

Obtain access to any memory that is owned by the pointer.

T * Detach (  )  [inline]

Give up ownership and return any memory that is owned.

operator T * (  )  const [inline]

Provide access to any memory that is owned by the pointer.

T * operator-> (  )  const [inline]

T & operator * (  )  const [inline]

bool IsValid (  )  const [inline]

Returns true if the TConditionalSmartPointer currently points to some memory.


Generated on Sun Sep 12 19:08:23 2021 for The Server Framework - v7.4 by doxygen 1.5.3