Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE > Class Template Reference
Inheritance diagram for Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >:

Public Member Functions

 CArrayWithExternalBuffer (void *buffer, INDEXTYPE capacity)
 
void MustNotNull () const
 
void MustNull () const
 
bool IsNull () const
 
void Init (void *buffer, INDEXTYPE capacity)
 
void Uninit ()
 
void ShareTo (CArrayWithExternalBuffer &dest) const
 
- Public Member Functions inherited from Proud::CFastArray< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >
 CFastArray ()
 
 CFastArray (const TYPE *data, INDEXTYPE count)
 
 CFastArray (const CFastArray &src)
 
void SetGrowPolicy (GrowPolicy val)
 
GrowPolicy GetGrowPolicy ()
 
void SetMinCapacity (INDEXTYPE newCapacity)
 
void SetCapacity (INDEXTYPE newCapacity)
 
void SuspendShrink ()
 
void OnRecycle ()
 
void OnDrop ()
 
void SetCount (INDEXTYPE newVal)
 
void AddCount (INDEXTYPE addLength)
 
void resize (INDEXTYPE sz)
 for STL compatibility
 
INDEXTYPE GetCapacity () const
 
INDEXTYPE GetCount () const
 
INDEXTYPE size () const
 for STL compatibility
 
bool IsEmpty () const
 
void Clear ()
 
void ClearAndKeepCapacity ()
 
T_IN ElementAt (INDEXTYPE index) const
 
TYPE & ElementAt (INDEXTYPE index)
 
T_IN operator[] (INDEXTYPE index) const
 
TYPE & operator[] (INDEXTYPE index)
 
TYPE * GetData ()
 
const TYPE * GetData () const
 
void Add (T_IN value)
 
void push_back (T_IN value)
 
void Insert (INDEXTYPE indexAt, T_IN value)
 
void AddRange (const TYPE *data, INDEXTYPE count)
 
void InsertRange (INDEXTYPE indexAt, const TYPE *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 TYPE *from, INDEXTYPE fromCount)
 
void RemoveRange (INDEXTYPE index, INDEXTYPE count)
 
void RemoveAt (INDEXTYPE index)
 
bool RemoveOneByValue (T_IN value)
 
CFastArrayoperator= (const CFastArray &src)
 
INDEXTYPE FindByValue (T_IN value)
 
bool Contains (T_IN value)
 
bool Equals (const CFastArray &rhs) const
 
void clear ()
 for STL compatibility
 
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
iterator erase (iterator iter)
 
TYPE PopBack ()
 
void RemoveAndPullLast (INDEXTYPE index)
 

Additional Inherited Members

- Static Public Attributes inherited from Proud::CFastArray< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >
static const size_t TYPE_SIZE
 
- Protected Member Functions inherited from Proud::CFastArray< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >
void InitVars ()
 
void BoundCheck (INDEXTYPE index) const
 
- Protected Attributes inherited from Proud::CFastArray< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >
TYPE * m_Data
 
INDEXTYPE m_Length
 
INDEXTYPE m_Capacity
 
INDEXTYPE m_minCapacity
 
bool m_suspendShrink
 
GrowPolicy m_growPolicy
 

Detailed Description

template<typename TYPE, bool TYPE_IN_REF = true, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
class Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >

Allocation class that uses external buffer

Note: There must be NO previously allocated object within external buffer. In other words,it must be an initialized memory area since CArrayWithExternalBuffer will be initialized.

Parameters
TYPEAllocation type
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”.
INDEXTYPIt 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.

Member Function Documentation

template<typename TYPE, bool TYPE_IN_REF = true, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >::Init ( void *  buffer,
INDEXTYPE  capacity 
)
inline

TODO:translate needed. Set it up.

Parameters
bufferbuffer pointer
capacitybuffer size
template<typename TYPE, bool TYPE_IN_REF = true, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
bool Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >::IsNull ( ) const
inline

TODO:translate needed. It’s null now

template<typename TYPE, bool TYPE_IN_REF = true, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >::MustNotNull ( ) const
inline

TODO:translate needed. Generate an exception if null.

template<typename TYPE, bool TYPE_IN_REF = true, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >::MustNull ( ) const
inline

TODO:translate needed. Generate an exception if not null.

template<typename TYPE, bool TYPE_IN_REF = true, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >::ShareTo ( CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE > &  dest) const
inline

Shares data with dest.

template<typename TYPE, bool TYPE_IN_REF = true, bool RAWTYPE = false, typename INDEXTYPE = intptr_t>
void Proud::CArrayWithExternalBuffer< TYPE, TYPE_IN_REF, RAWTYPE, INDEXTYPE >::Uninit ( )
inline

TODO:translate needed. Initialize all member parameters.