"L. Spiro Engine"
Public Member Functions | Protected Attributes

lstl::CVector< _tType, _tDataType, _uAllocSize > Class Template Reference

A vector class that works on all types that follow the rule of 3. More...

#include <LSTLVector.h>

Inheritance diagram for lstl::CVector< _tType, _tDataType, _uAllocSize >:
lstl::CSVectorCrtp< CVector< _tType, _tDataType, _uAllocSize >, _tType, _tDataType, _uAllocSize > lstl::CVectorBase

List of all members.

Public Member Functions

LSE_CALL CVector (LSUINT32 _tTotal)
LSE_CALL CVector (CAllocator *_paAllocator)
LSE_CALL CVector (LSUINT32 _tTotal, CAllocator *_paAllocator)
LSE_CALL CVector (const CVector< _tType, _tDataType, _uAllocSize > &_vOther, CAllocator *_paAllocator=NULL)
LSBOOL LSE_CALL Allocate (LSUINT32 _ui32Total)
LSVOID LSE_CALL Reset ()
LSBOOL LSE_CALL Insert (const _tType &_tVal, LSUINT32 _ui32Index)
LSVOID LSE_CALL RemoveRangeNoDealloc (LSUINT32 _ui32Index, LSUINT32 _ui32Total)
LSVOID LSE_CALL SetAllocator (CAllocator *_paAllocator)
CAllocator *LSE_CALL GetAllocator ()
LSVOID LSE_CALL Trash ()

Protected Attributes

CAllocatorm_paOurAllocator

Detailed Description

template<typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
class lstl::CVector< _tType, _tDataType, _uAllocSize >

A vector class that works on all types that follow the rule of 3.

Class CVector Description: Extends the CSVectorCrtp class to mke it work properly with types that are not plain data. Use this for types that have a complicated destructor, copy constructor, and copy assignment operator.


Member Function Documentation

template<typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSBOOL LSE_CALL lstl::CVector< _tType, _tDataType, _uAllocSize >::Allocate ( LSUINT32  _ui32Total) [inline]

Allocate a given number of elements. If the allocation is less than what there already is, items are removed.

Parameters:
_ui32TotalNumber of elements to allocate.
Returns:
Returns true if there was enough memory to allocate the given amount of objects. If _ui32Total is 0, true is always returned.

Reimplemented from lstl::CSVectorCrtp< CVector< _tType, _tDataType, _uAllocSize >, _tType, _tDataType, _uAllocSize >.

template<typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSBOOL LSE_CALL lstl::CVector< _tType, _tDataType, _uAllocSize >::Insert ( const _tType &  _tVal,
LSUINT32  _ui32Index 
) [inline]

Insert an element.

Parameters:
_tValThe item to insert.
_ui32IndexThe index where the item is to be inserted.
Returns:
Returns false if memory could not be allocated. In this case, the list is not modified.

Reimplemented from lstl::CSVectorCrtp< CVector< _tType, _tDataType, _uAllocSize >, _tType, _tDataType, _uAllocSize >.

template<typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CVector< _tType, _tDataType, _uAllocSize >::RemoveRangeNoDealloc ( LSUINT32  _ui32Index,
LSUINT32  _ui32Total 
) [inline]

Remove elements without reallocating.

Parameters:
_ui32IndexThe start index of the items to be removed.
_ui32TotalThe number of items to remove.

Reimplemented from lstl::CSVectorCrtp< CVector< _tType, _tDataType, _uAllocSize >, _tType, _tDataType, _uAllocSize >.

template<typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CVector< _tType, _tDataType, _uAllocSize >::Reset ( ) [inline]
template<typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CVector< _tType, _tDataType, _uAllocSize >::Trash ( ) [inline]

Trash the list without freeing the memory. Calls .Trash() on objects and resets without freeing any memory. The memory is assumed to be free by another part of the application. For example, if the memory was allocated to a heap and the heap is to be freed at all once. After calling Trash(), the whole heap could be removed in full without creating a memory leak. After calling .Trash() on each object, the object's destructor is called. This can only be called if the objects in the list have a .Trash() method.

Reimplemented from lstl::CSVectorCrtp< CVector< _tType, _tDataType, _uAllocSize >, _tType, _tDataType, _uAllocSize >.


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