AudRecordLib
|
#include <scoped.h>
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) |
Wrapper around a raw array
Type | The types of objects that'll be stored in the array |
ScopedArray< Type >::ScopedArray | ( | Type * | data | ) | [inline] |
Construct an object with a preexisting array
data | A pointer that the object takes ownership of |
ScopedArray< Type >::ScopedArray | ( | UINT | elements | ) | [inline] |
Construct an object by creating a new sized array
elements | The size of the new array |
ScopedArray< Type >::ScopedArray | ( | ) | [inline] |
Construct an object to an uninitialized state.
Init() can be used to initialise the array
ScopedArray< Type >::~ScopedArray | ( | ) | [inline] |
Frees the array memory using delete
Type* ScopedArray< Type >::get | ( | ) | const [inline] |
Retrieves the array pointer
The function asserts that the object is initialised before returning the pointer
void ScopedArray< Type >::Init | ( | Type * | newData | ) | [inline] |
Initialises an uninitialised object
The function asserts that the object hasn't been initialised
newData | A pointer that the object takes ownership of. Must have been returned by operator new |
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
Type* ScopedArray< Type >::operator* | ( | ) | const [inline] |
Retrieves the array pointer
The function asserts that the object is initialised before returning the pointer
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
void ScopedArray< Type >::Swap | ( | ScopedArray< Type > & | other | ) | [inline] |
Swaps the pointers stored in two disperate objects
other | The object to swap this objects pointer with |