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

lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize > Class Template Reference

A basic vector. More...

#include <LSTLSVectorCrtp.h>

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

List of all members.

Public Member Functions

LSE_CALL CSVectorCrtp (const CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize > &_vcSource)
const _tType &LSE_CALL operator[] (LSUINT32 _ui32Index) const
_tType &LSE_CALL operator[] (LSUINT32 _ui32Index)
CSVectorCrtp< _tDerivedType,
_tType, _tDataType,
_uAllocSize > &LSE_CALL 
operator= (const CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize > &_vcOther)
LSVOID LSE_CALL Reset ()
LSVOID LSE_CALL ResetNoDealloc ()
LSVOID LSE_CALL Trash ()
LSBOOL LSE_CALL Allocate (LSUINT32 _ui32Total)
_tDataType LSE_CALL GetAllocated () const
LSBOOL LSE_CALL Resize (LSUINT32 _ui32Total)
LSBOOL LSE_CALL ResizeOver (LSUINT32 _ui32Total)
LSBOOL LSE_CALL Push (const _tType &_tVal)
LSVOID LSE_CALL Pop ()
LSVOID LSE_CALL PopNoDealloc ()
LSBOOL LSE_CALL Insert (const _tType &_tVal, LSUINT32 _ui32Index)
LSBOOL LSE_CALL Append (const _tType *_ptValues, _tDataType _tTotal)
LSVOID LSE_CALL Remove (LSUINT32 _ui32Index)
LSVOID LSE_CALL RemoveNoDealloc (LSUINT32 _ui32Index)
LSVOID LSE_CALL RemoveRange (LSUINT32 _ui32Index, LSUINT32 _ui32Total)
LSVOID LSE_CALL RemoveRangeNoDealloc (LSUINT32 _ui32Index, LSUINT32 _ui32Total)
_tDataType LSE_CALL Length () const
LSVOID LSE_CALL Snap ()

Protected Member Functions

LSVOID LSE_CALL Construct (_tDataType _tIndex)
LSVOID LSE_CALL Destroy (_tDataType _tIndex)

Protected Attributes

_tType * m_ptData
_tDataType m_tLen
_tDataType m_tAllocated

Detailed Description

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

A basic vector.

Class CSVectorCrtp Description: A basic vector.


Member Function Documentation

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSBOOL LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _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:
_ui32TotalThe new number of items to be allocated.
Returns:
Returns false if the memory could not be allocated. In this case, the list is not modified.

Reimplemented in lstl::CVector< _tType, _tDataType, _uAllocSize >, lstl::CVectorPoD< _tType, _tDataType, _uAllocSize >, lstl::CVector< LSTL_PAIR, LSUINT32, 1024UL >, lstl::CVector< _tStringType, LSUINT32, 32UL >, lstl::CVector< _tMappedType, LSUINT16, 1024UL >, lstl::CVectorPoD< _tDataType, LSUINT32, _uAllocSize >, and lstl::CVectorPoD< wchar_t, LSUINT32, 32 >.

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSBOOL LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::Append ( const _tType *  _ptValues,
_tDataType  _tTotal 
) [inline]

Append an array of values to the end of the vector.

Parameters:
_ptValuesThe values to append.
_tTotalThe number of values to append.
Returns:
Returns true if there was enough memory to perform the operation.

Reimplemented in lstl::CStringBase< _tDerived, _tDataType, _uAllocSize >, and lstl::CStringBase< CWString, wchar_t >.

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::Construct ( _tDataType  _tIndex) [inline, protected]

Secret way of constructing items.

Parameters:
_tIndexThe index of the item to construct.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::Destroy ( _tDataType  _tIndex) [inline, protected]

Secret way of destroying items. No error checking.

Parameters:
_tIndexThe index of the item to destruct.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
_tDataType LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::GetAllocated ( ) const [inline]

Get the number of items allocated.

Returns:
Returns the number of allocated items.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSBOOL LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _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 in lstl::CVector< _tType, _tDataType, _uAllocSize >, lstl::CVector< LSTL_PAIR, LSUINT32, 1024UL >, lstl::CVector< _tStringType, LSUINT32, 32UL >, and lstl::CVector< _tMappedType, LSUINT16, 1024UL >.

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
_tDataType LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::Length ( ) const [inline]

Get the number of elements in the array.

Returns:
Returns the number of items in the array.

Reimplemented in lstl::CStringBase< _tDerived, _tDataType, _uAllocSize >, and lstl::CStringBase< CWString, wchar_t >.

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
CSVectorCrtp<_tDerivedType, _tType, _tDataType, _uAllocSize>& LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::operator= ( const CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize > &  _vcOther) [inline]

Copy the vector and every item in it to a new vector. Each item is duplicated in the new vector.

Parameters:
_vcOtherThe source vector.
Returns:
Returns this vector, which contains a copy of every item in the source vector.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
_tType& LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::operator[] ( LSUINT32  _ui32Index) [inline]

Give rapid array access.

Parameters:
_ui32IndexThe index of the item to get.
Returns:
Returns a reference to the item at the given index.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
const _tType& LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::operator[] ( LSUINT32  _ui32Index) const [inline]

Give rapid array access.

Parameters:
_ui32IndexThe index of the item to get.
Returns:
Returns a constant reference to the item at the given index.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::Pop ( ) [inline]

Remove from the end of the array.

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::PopNoDealloc ( ) [inline]

Remove an item from the end of the array without resizing if the array is less than double sized.

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSBOOL LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::Push ( const _tType &  _tVal) [inline]

Add to the end of the array. Item is copied via copy constructor.

Parameters:
_tValThe value to push.
Returns:
Returns false if memory could not be allocated. In this case, the list is not modified.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::Remove ( LSUINT32  _ui32Index) [inline]

Remove an element.

Parameters:
_ui32IndexThe index of the item to remove.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::RemoveNoDealloc ( LSUINT32  _ui32Index) [inline]

Remove an element without reallocating.

Parameters:
_ui32IndexThe index of the item to remove.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::RemoveRange ( LSUINT32  _ui32Index,
LSUINT32  _ui32Total 
) [inline]

Remove elements.

Parameters:
_ui32IndexThe start index of the items to be removed.
_ui32TotalThe number of items to remove.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _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 in lstl::CVector< _tType, _tDataType, _uAllocSize >, lstl::CVector< LSTL_PAIR, LSUINT32, 1024UL >, lstl::CVector< _tStringType, LSUINT32, 32UL >, and lstl::CVector< _tMappedType, LSUINT16, 1024UL >.

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

Reset the list without deallocating the whole buffer.

Reimplemented in lstl::CStringBase< _tDerived, _tDataType, _uAllocSize >, and lstl::CStringBase< CWString, wchar_t >.

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

Resize the array.

Parameters:
_ui32TotalThe new total of items in the array.
Returns:
Returns false if the memory could not be allocated. In this case, the list is not modified.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSBOOL LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::ResizeOver ( LSUINT32  _ui32Total) [inline]

Resize the array with a little over-allocation if necessary.

Parameters:
_ui32TotalThe new total of items in the array.
Returns:
Returns false if the memory could not be allocated. In this case, the list is not modified.
template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
LSVOID LSE_CALL lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::Snap ( ) [inline]

Snap it to the size of the list. This removes allocated space beyond the actual length of the array.

Reimplemented in lstl::CStringBase< _tDerived, _tDataType, _uAllocSize >, and lstl::CStringBase< CWString, wchar_t >.

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

Trash the list without freeing the memory. Calls destructors 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.

Reimplemented in lstl::CStringBase< _tDerived, _tDataType, _uAllocSize >, lstl::CVector< _tType, _tDataType, _uAllocSize >, lstl::CStringBase< CWString, wchar_t >, lstl::CVector< LSTL_PAIR, LSUINT32, 1024UL >, lstl::CVector< _tStringType, LSUINT32, 32UL >, and lstl::CVector< _tMappedType, LSUINT16, 1024UL >.


Member Data Documentation

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
_tType* lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::m_ptData [protected]

Array of data.

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
_tDataType lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::m_tAllocated [protected]

Amount allocated.

template<typename _tDerivedType, typename _tType, typename _tDataType = LSUINT16, unsigned _uAllocSize = 512UL>
_tDataType lstl::CSVectorCrtp< _tDerivedType, _tType, _tDataType, _uAllocSize >::m_tLen [protected]

Length of the list.


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