AudRecordLib
Public Member Functions
ScopedArray< Type > Class Template Reference

#include <scoped.h>

List of all members.

Public Member Functions

 ScopedArray (Type *data)
 ScopedArray (UINT elements)
 ScopedArray ()
 ~ScopedArray ()
Type * get () const
Type ** operator& ()
Type * operator* () const
void Init (Type *newData)
Type * Release ()
void Swap (ScopedArray &other)

Detailed Description

template<class Type>
class ScopedArray< Type >

Wrapper around a raw array

Template Parameters:
TypeThe types of objects that'll be stored in the array

Constructor & Destructor Documentation

template<class Type >
ScopedArray< Type >::ScopedArray ( Type *  data) [inline]

Construct an object with a preexisting array

Parameters:
dataA pointer that the object takes ownership of
template<class Type >
ScopedArray< Type >::ScopedArray ( UINT  elements) [inline]

Construct an object by creating a new sized array

Parameters:
elementsThe size of the new array
template<class Type >
ScopedArray< Type >::ScopedArray ( ) [inline]

Construct an object to an uninitialized state.

Init() can be used to initialise the array

template<class Type >
ScopedArray< Type >::~ScopedArray ( ) [inline]

Frees the array memory using delete


Member Function Documentation

template<class Type >
Type* ScopedArray< Type >::get ( ) const [inline]

Retrieves the array pointer

The function asserts that the object is initialised before returning the pointer

Returns:
The objects data pointer
template<class Type >
void ScopedArray< Type >::Init ( Type *  newData) [inline]

Initialises an uninitialised object

The function asserts that the object hasn't been initialised

Parameters:
newDataA pointer that the object takes ownership of. Must have been returned by operator new
template<class Type >
Type** ScopedArray< Type >::operator& ( ) [inline]

Retrieves a pointer to the array pointer

The function asserts that the object has not already been initialised before returning the pointer. Allowing this can lead to memory leaks

Returns:
A pointer to the objects data pointer
template<class Type >
Type* ScopedArray< Type >::operator* ( ) const [inline]

Retrieves the array pointer

The function asserts that the object is initialised before returning the pointer

Returns:
The objects data pointer
template<class Type >
Type* ScopedArray< Type >::Release ( ) [inline]

Releases the object's ownership of the stored pointer

Turns the object back to an uninitialised state. The caller is then responsible for deleting the array when it is no longer required

Returns:
The stored array pointer
template<class Type >
void ScopedArray< Type >::Swap ( ScopedArray< Type > &  other) [inline]

Swaps the pointers stored in two disperate objects

Parameters:
otherThe object to swap this objects pointer with

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Defines