Classes | Public Member Functions | Friends | List of all members
Proud::CFastArray< T, RAWTYPE, INDEXTYPE > Class Template Reference

Classes

class  const_iterator
 
class  iterator
 

Public Member Functions

void UseFastHeap (CFastHeap *heap)
 
CFastHeapGetFastHeap () const
 
 CFastArray ()
 
 CFastArray (const T *data, INDEXTYPE count)
 
 CFastArray (const CFastArray &src)
 
bool UsingFastAllocator () const
 
void SetGrowPolicy (GrowPolicy val)
 
GrowPolicy GetGrowPolicy ()
 
void SetMinCapacity (INDEXTYPE newCapacity)
 
void SetCapacity (INDEXTYPE newCapacity)
 
void SetCount (INDEXTYPE newVal)
 
INDEXTYPE GetCapacity () const
 
INDEXTYPE GetCount () const
 
void Clear ()
 
void ClearAndKeepCapacity ()
 
 __declspec (property(get=GetCount)) INDEXTYPE Count
 
const T & ElementAt (INDEXTYPE index) const
 
T & ElementAt (INDEXTYPE index)
 
const T & operator[] (INDEXTYPE index) const
 
T & operator[] (INDEXTYPE index)
 
T * GetData ()
 
const T * GetData () const
 
void Add (const T &value)
 
void Insert (INDEXTYPE indexAt, const T &value)
 
void AddRange (const T *data, INDEXTYPE count)
 
void InsertRange (INDEXTYPE indexAt, const T *data, INDEXTYPE count)
 
void CopyRangeTo (CFastArray &dest, INDEXTYPE srcOffset, INDEXTYPE count) const
 
void CopyTo (CFastArray &dest) const
 
void CopyFrom (const CFastArray &src)
 
void CopyFrom (const T *from, INDEXTYPE fromCount)
 
void RemoveRange (INDEXTYPE index, INDEXTYPE count)
 
void RemoveAt (INDEXTYPE index)
 
bool RemoveOneByValue (const T &value)
 
CFastArrayoperator= (const CFastArray &src)
 
INDEXTYPE FindByValue (const T &value)
 
bool Equals (const CFastArray &rhs) const
 
void clear ()
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
iterator erase (iterator iter)
 
PopBack ()
 
void RemoveAndPullLast (intptr_t index)
 

Friends

class iterator
 
class const_iterator
 

Detailed Description

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
class Proud::CFastArray< T, RAWTYPE, INDEXTYPE >

Array class

Performance increase function for primitive type

Major characteristics

Parameters
TClause type of array
RAWTYPETo check if the type is safe even if array element is processed as “raw memory copy”. int is safe but std.string is not safe. In case element type of array is not related to constructor, destructor and copy assignment operator, you can set it as “true”. If setting it as “true”, constructor, destructor and copy assignment will not be called for progression of construction, destruction and copy of array element that internally occurs when inserting & deleting & changing size. Therefore, processing speed will be improved. Default is “false”.
INDEXTYPEIt is strongly recommended to use the maximum size of array and one of index types like int32,int64 and intPtr. Casting load between int32 and int64 should be considered, so using the appropriate one is recommended. For example, packet size should be int32 because it does not exceed 2GB and if it is only for local process, intPtr is recommended. int64 is appropriate when int32 cannot deal with accurate value like network statistics.

Constructor & Destructor Documentation

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::CFastArray ( )
inline

Default constructor

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::CFastArray ( const T *  data,
INDEXTYPE  count 
)
inline

TODO:translate needed. Constructor that duplicates external data

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::CFastArray ( const CFastArray< T, RAWTYPE, INDEXTYPE > &  src)
inline

TODO:translate needed. Constructor that duplicates external data

Member Function Documentation

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::__declspec ( property(get=GetCount )

Array size

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::Add ( const T &  value)
inline

Add at the end

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::AddRange ( const T *  data,
INDEXTYPE  count 
)
inline

TODO:translate needed. Add array at the end of array

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
iterator Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::begin ( )
inline

Acts similar as same name method of STL

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
const_iterator Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::begin ( ) const
inline

Acts similar as same name method of STL

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::Clear ( )
inline

Clean up array. Same as ClearAndKeepCapacity

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::clear ( )
inline

Clean up

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::ClearAndKeepCapacity ( )
inline

Clean up array. Same as Clear

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::CopyRangeTo ( CFastArray< T, RAWTYPE, INDEXTYPE > &  dest,
INDEXTYPE  srcOffset,
INDEXTYPE  count 
) const
inline

TODO:translate needed. Change size of dest with count then copy a part of src or all with dest

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::CopyTo ( CFastArray< T, RAWTYPE, INDEXTYPE > &  dest) const
inline
Parameters
destcopy array to dest.
template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
const T& Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::ElementAt ( INDEXTYPE  index) const
inline

Array item that pointed by index

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
T& Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::ElementAt ( INDEXTYPE  index)
inline

Array item that pointed by index

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
iterator Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::end ( )
inline

Acts similar as same name method of STL

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
const_iterator Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::end ( ) const
inline

Acts similar as same name method of STL

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
bool Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::Equals ( const CFastArray< T, RAWTYPE, INDEXTYPE > &  rhs) const
inline
  • Note: This is a simple memory comparison. This is crucial.
    Parameters
    rhsChecks if this contains same as rhs
template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
iterator Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::erase ( iterator  iter)
inline

TODO:translate needed. Acts similar as same name method of STL

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
INDEXTYPE Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::FindByValue ( const T &  value)
inline
Parameters
valuecheck if there is an array that has the same value as “value”.
Returns
If there is the array that has the same value as “value”, the index is returned. If not found, -1 will be returned.
template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
INDEXTYPE Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::GetCapacity ( ) const
inline

TODO:translate needed.

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
INDEXTYPE Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::GetCount ( ) const
inline

Array size

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
T* Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::GetData ( )
inline

Gets array buffer pointer

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
const T* Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::GetData ( ) const
inline

Gets array buffer pointer

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
CFastHeap* Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::GetFastHeap ( ) const
inline

Gets designated fast heap. If not designated then returns NULL.

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
GrowPolicy Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::GetGrowPolicy ( )
inline

Getting existing grow policy

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::Insert ( INDEXTYPE  indexAt,
const T &  value 
)
inline

Move back item that pointed by indexAt then add value to place that pointed by indexAt

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::InsertRange ( INDEXTYPE  indexAt,
const T *  data,
INDEXTYPE  count 
)
inline

TODO:translate needed. Add array to middle of array. Move back part that pointed by indexAt then add to the gap

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
CFastArray& Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::operator= ( const CFastArray< T, RAWTYPE, INDEXTYPE > &  src)
inline

Copy assignment operator

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
const T& Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::operator[] ( INDEXTYPE  index) const
inline

Array item that pointed by index

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
T& Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::operator[] ( INDEXTYPE  index)
inline

Array item that pointed by index

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
T Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::PopBack ( )
inline

TODO:translate needed.

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::RemoveAndPullLast ( intptr_t  index)
inline

TODO:translate needed. Moves the last clause to where index point then eliminates the last clause It is effective to use this instead of Remove to remove mid-part of a collection of no meaningful orders.

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::RemoveAt ( INDEXTYPE  index)
inline
Parameters
indexRemove index th item
template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
bool Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::RemoveOneByValue ( const T &  value)
inline
Parameters
valueSeek same value as value from the first then remove it
template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::RemoveRange ( INDEXTYPE  index,
INDEXTYPE  count 
)
inline

TODO:translate needed. Remove from index th list as many as count

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::SetCapacity ( INDEXTYPE  newCapacity)
inline

Balances the buffer(capacity) possessed by array

  • Capacity is only increased, not decreased.
template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::SetCount ( INDEXTYPE  newVal)
inline

TODO:translate needed. Balalnces the size of array

  • When this is done, capacity increases enough.
template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::SetGrowPolicy ( GrowPolicy  val)
inline

TODO:translate needed. grow policy setting

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::SetMinCapacity ( INDEXTYPE  newCapacity)
inline

TODO:translate needed.

template<typename T, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CFastArray< T, RAWTYPE, INDEXTYPE >::UseFastHeap ( CFastHeap heap)
inline

Option that allows to use fast heap

Parameters
heapWhen set the default value then it uses Fast heap of per-type unit. By designating CFastHeap object separately, it is possible to use fast heap of per-instance unit.