AutoDeque< T, Deallocator > Class Template Reference

Provides pointer management for deque. More...

List of all members.

Public Member Functions

template<typename Iter >
 AutoDeque (Iter in_first, Iter in_last)
 Constructor.
 AutoDeque (simba_uint32 in_size)
 Constructor.
 AutoDeque ()
 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 AutoDeque.
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 > ReleaseOwnershipBack ()
 Releases ownership of the item at the back and pops back.
AutoPtr< T, Deallocator > ReleaseOwnershipFront ()
 Releases ownership of the item at the back and pops front.
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 deque.
T * TakeOwnership (const AutoPtr< T, Deallocator > &in_previousOwner)
 Safely take ownership of the given object by adding it to the end of this deque.
T * TakeOwnership (AutoPtr< T, Deallocator > &in_previousOwner)
 Safely take ownership of the given object by adding it to the end of this deque.
T * TakeOwnership (T *in_unOwned)
 Safely take ownership of the given object by adding it to the end of this deque.
 ~AutoDeque ()
 Destructor.

Detailed Description

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

Provides pointer management for deque.

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

This deque should only be used with pointer types, and will automatically delete the contain pointers when the deque 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 AutoDeque.


Constructor & Destructor Documentation

AutoDeque (  )  [inline, explicit]

Constructor.

AutoDeque ( simba_uint32  in_size  )  [inline]

Constructor.

Parameters:
in_size The size of the deque to create, with each element set to NULL.
AutoDeque ( Iter  in_first,
Iter  in_last 
) [inline]

Constructor.

Parameters:
in_first Iterator to the first element.
in_last Iterator to the last element.
~AutoDeque (  )  [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 AutoDeque.

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 deque. If this decreases the size of the deque, delete elements indexed greater than the new size.
in_value The value to initialize new elements of the deque with if the new size of the deque 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> ReleaseOwnershipBack (  )  [inline]

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

Returns:
The item at the specified back (OWN).
AutoPtr<T, Deallocator> ReleaseOwnershipFront (  )  [inline]

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

Returns:
The item at the specified front (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 deque.

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

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

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 AutoDeque.

Parameters:
in_previousOwner The object which currently owns the object to add to this deque.
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 deque.

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

Parameters:
in_previousOwner The object which currently owns the object to add to this deque.
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 deque.

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