AutoVector< T, Deallocator > Class Template Reference

Provides pointer management for vectors. More...

List of all members.

Public Member Functions

 AutoVector (simba_uint32 in_size)
 Constructor.
 AutoVector (AutoVector &in_rhs)
 Swap constructor. Ownership of pointers is transferred.
 AutoVector ()
 Constructor.
void DeleteClear ()
 Clear the contents of the list and delete them.
ParentIterator DeleteErase (ParentIterator in_toDeleteAndEraseBegin, const ParentIterator in_toDeleteAndEraseEnd)
 Delete & erase a range.
ParentIterator DeleteErase (ParentIterator in_toDeleteAndErase)
 Delete & erase an element.
void DeleteResize (simba_size_t in_size, T *in_value=NULL)
 Resizes the AutoVector.
AutoPtr< T, Deallocator > ReleaseOwnership (ParentIterator in_toRelease)
 Releases ownership of the item at the specified index. The value at that index will set to NULL.
AutoPtr< T, Deallocator > ReleaseOwnership (simba_size_t in_index)
 Releases ownership of the item at the specified index. The value at that index will set to NULL.
AutoPtr< T, Deallocator > ReleaseOwnership ()
 Releases ownership of the item at the back and pops back.
template<typename Iter >
void TakeOwnership (Iter in_first, const Iter in_end)
 Safely take ownership of the given range of objects by adding them to the end of this vector.
T * TakeOwnership (const AutoPtr< T, Deallocator > &in_previousOwner)
 Safely take ownership of the given object by adding it to the end of this vector.
T * TakeOwnership (AutoPtr< T, Deallocator > &in_previousOwner)
 Safely take ownership of the given object by adding it to the end of this vector.
T * TakeOwnership (T *in_unOwned)
 Safely take ownership of the given object by adding it to the end of this vector.
 ~AutoVector ()
 Destructor.

Detailed Description

template<class T, typename Deallocator = AutoPtr_DefaultDeallocator<T>>
class Simba::Support::AutoVector< T, Deallocator >

Provides pointer management for vectors.

Wraps the owned pointers to guarantee their automatic deletion when the vector goes out of scope.

This vector should only be used with pointer types, and will automatically delete the contain pointers when the vector goes out of scope.

We will protect against using NULL contained pointers with asserts to catch programmer errors. We will depend on callers using the new operator to throw exceptions on failure to protect at runtime.

Here are some guidelines for using the AutoVector.


Constructor & Destructor Documentation

AutoVector (  )  [inline, explicit]

Constructor.

AutoVector ( AutoVector< T, Deallocator > &  in_rhs  )  [inline]

Swap constructor. Ownership of pointers is transferred.

Parameters:
in_rhs The vector to swap with values with.
AutoVector ( simba_uint32  in_size  )  [inline]

Constructor.

Parameters:
in_size The size of the vector to create, with each element set to NULL.
~AutoVector (  )  [inline]

Destructor.


Member Function Documentation

void DeleteClear (  )  [inline]

Clear the contents of the list and delete them.

ParentIterator DeleteErase ( ParentIterator  in_toDeleteAndEraseBegin,
const ParentIterator  in_toDeleteAndEraseEnd 
) [inline]

Delete & erase a range.

ParentIterator DeleteErase ( ParentIterator  in_toDeleteAndErase  )  [inline]

Delete & erase an element.

void DeleteResize ( simba_size_t  in_size,
T *  in_value = NULL 
) [inline]

Resizes the AutoVector.

If the new size is smaller than the current size, elements beyond the new size are deleted.

Parameters:
in_size The new size of the vector. If this decreases the size of the vector, delete elements indexed greater than the new size.
in_value The value to initialize new elements of the vector with if the new size of the vector is greater than the current size. (OWN)
AutoPtr<T, Deallocator> ReleaseOwnership ( ParentIterator  in_toRelease  )  [inline]

Releases ownership of the item at the specified index. The value at that index will set to NULL.

Parameters:
in_index The index of the item for which to release ownership.
Returns:
The item at the specified index (OWN).
AutoPtr<T, Deallocator> ReleaseOwnership ( simba_size_t  in_index  )  [inline]

Releases ownership of the item at the specified index. The value at that index will set to NULL.

Parameters:
in_index The index of the item for which to release ownership.
Returns:
The item at the specified index (OWN).
AutoPtr<T, Deallocator> ReleaseOwnership (  )  [inline]

Releases ownership of the item at the back and pops back.

Returns:
The item at the specified back (OWN).
void TakeOwnership ( Iter  in_first,
const Iter  in_end 
) [inline]

Safely take ownership of the given range of objects by adding them to the end of this vector.

T* TakeOwnership ( const AutoPtr< T, Deallocator > &  in_previousOwner  )  [inline]

Safely take ownership of the given object by adding it to the end of this vector.

MAINTENANCE NOTE: Revisit this when we change the semantics of the AutoPtr copy constructor to not const-cast. NOTE: AutoPtrDeallocator must be the same as the Deallocator of this AutoVector.

Parameters:
in_previousOwner The object which currently owns the object to add to this vector.
Returns:
The pointer whose ownership was transferred.
T* TakeOwnership ( AutoPtr< T, Deallocator > &  in_previousOwner  )  [inline]

Safely take ownership of the given object by adding it to the end of this vector.

NOTE: If an exception occurs while adding the object to this vector, the previous owner will retain ownership. NOTE: AutoPtrDeallocator must be the same as the Deallocator of this AutoVector.

Parameters:
in_previousOwner The object which currently owns the object to add to this vector.
Returns:
The pointer whose ownership was transferred.
T* TakeOwnership ( T *  in_unOwned  )  [inline]

Safely take ownership of the given object by adding it to the end of this vector.

NOTE: Will delete in_unOwned if an exception occurs adding it to this collection.

Parameters:
in_unOwned A non-NULL pointer which is currently NOT OWNED by anything else. (OWN)
Returns:
The pointer whose ownership was transferred.

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

Generated on Wed May 17 14:21:18 2017 for SimbaEngine 10.1.3.1011 by simba