Proud::ByteArrayPtr Class Reference
Inheritance diagram for Proud::ByteArrayPtr:

Public Member Functions

 ByteArrayPtr (const ByteArrayPtr &src)
 
ByteArrayPtroperator= (const ByteArrayPtr &src)
 
int GetCapacity () const
 
int GetCount () const
 
void MustNotNull () const
 
void MustNull () const
 
void SetCapacity (int length)
 
void SetCount (int length)
 
void AddCount (int length)
 
void Add (uint8_t data)
 
void AddRange (const uint8_t *data, int count)
 
void InsertRange (int indexAt, const uint8_t *data, int count)
 
void RemoveRange (int indexAt, int count)
 
void RemoveAt (int index)
 
void Clear ()
 
uint8_t * GetData ()
 
const uint8_t * GetData () const
 
ByteArrayPtr Clone ()
 
template<typename BYTEARRAYT >
void CopyRangeToT (BYTEARRAYT &dest, int srcOffset, int count) const
 
void CopyRangeTo (ByteArrayPtr &dest, int srcOffset, int count) const
 
void CopyRangeTo (ByteArray &dest, int srcOffset, int count) const
 
uint8_t & operator[] (int index)
 
const uint8_t operator[] (int index) const
 
GrowPolicy GetGrowPolicy () const
 
void SetGrowPolicy (GrowPolicy val)
 
void SetMinCapacity (int val)
 
void UseInternalBuffer ()
 
void UseExternalBuffer (uint8_t *buf, int capacity)
 
void UninitBuffer ()
 
bool IsNull () const
 
void MustInternalBuffer ()
 
bool Equals (const ByteArrayPtr &rhs) const
 
- Public Member Functions inherited from Proud::BiasManagedPointer< ByteArray, true >
 BiasManagedPointer (const BiasManagedPointer &src)
 
BiasManagedPointeroperator= (const BiasManagedPointer &src)
 

Static Public Attributes

static const size_t TYPE_SIZE = sizeof(uint8_t)
 

Additional Inherited Members

- Protected Member Functions inherited from Proud::BiasManagedPointer< ByteArray, true >
Tombstone * GetTombstone () const
 
void UninitTombstone ()
 
void InitTombstoneIfEmpty ()
 

Detailed Description

It is the form that smart pointer function has been added to ByteArray. It is very sensitive to conversion from 32 to 64 because of being used as the form of network packet, so its form is int32 (not intPtr). To avoid build error, this object has to override require method because ByreArray is inherit class instead of typedef.

Member Function Documentation

void Proud::ByteArrayPtr::Add ( uint8_t  data)
inline

TODO:translate needed. Add data in 1 byte unit

Parameters
dataByte to add data
void Proud::ByteArrayPtr::AddRange ( const uint8_t *  data,
int  count 
)
inline

TODO:translate needed. Add byte array data to the current array

Parameters
dataByte array pointer to add data
countSize of the count array
void Proud::ByteArrayPtr::Clear ( )
inline

Empty the array. The capacity does not change

ByteArrayPtr Proud::ByteArrayPtr::Clone ( )
inline

TODO:translate needed.

Returns
the copy of the array
void Proud::ByteArrayPtr::CopyRangeTo ( ByteArrayPtr dest,
int  srcOffset,
int  count 
) const
inline

TODO:translate needed. copy data to dest

Parameters
destByteArrayPtr to be copied
srcOffsetLocation of the original array to start copying
countSize of the array to be copied
void Proud::ByteArrayPtr::CopyRangeTo ( ByteArray dest,
int  srcOffset,
int  count 
) const
inline

TODO:translate needed. copy data to dest

Parameters
destByteArray to be copied
srcOffsetLocation of the original array to start copying
countSize of the array to be copied
template<typename BYTEARRAYT >
void Proud::ByteArrayPtr::CopyRangeToT ( BYTEARRAYT &  dest,
int  srcOffset,
int  count 
) const
inline

TODO:translate needed. copy data to dest

Parameters
destobject to be copied
srcOffsetLocation of the original array to start copying
countSize of the array to be copied
bool Proud::ByteArrayPtr::Equals ( const ByteArrayPtr rhs) const
inline

TODO:translate needed. Check to see if the content is the same as rhs

  • Caution: this is a simple comparison of memory. Use caution.
    Parameters
    rhsByteArrayPtr to be compared
    Returns
    true if the same, otherwise return false
uint8_t* Proud::ByteArrayPtr::GetData ( )
inline
Returns
the pointer of the data array.
const uint8_t* Proud::ByteArrayPtr::GetData ( ) const
inline

TODO:translate needed.

Returns
the const pointer of the data array.
GrowPolicy Proud::ByteArrayPtr::GetGrowPolicy ( ) const
inline
Returns
Weighted value when the array size of this object increases.
bool Proud::ByteArrayPtr::IsNull ( ) const
inline

TODO:translate needed.

Returns
true if null, otherwise return false.
void Proud::ByteArrayPtr::MustInternalBuffer ( )
inline

TODO:translate needed. Generate an exception if an internal buffer is not being used.

void Proud::ByteArrayPtr::RemoveAt ( int  index)
inline

TODO:translate needed. Remove one datum within the array

Parameters
indexIndex value of the array to be removed
void Proud::ByteArrayPtr::RemoveRange ( int  indexAt,
int  count 
)
inline

TODO:translate needed. Remove data

Parameters
indexAtIndex of the removed data
countNumber of the array to be removed
void Proud::ByteArrayPtr::SetCapacity ( int  length)
inline

TODO:translate needed.

Parameters
lengthCapacity size to change the length
void Proud::ByteArrayPtr::SetCount ( int  length)
inline

TODO:translate needed. Set the size of the array

Parameters
lengthSize of the array to change the length
void Proud::ByteArrayPtr::SetGrowPolicy ( GrowPolicy  val)
inline

TODO:translate needed. The weighted value type is set when the array size of this object increases. For more details, refer to GrowPolicy

Parameters
valThe weighted value type when increasing
void Proud::ByteArrayPtr::SetMinCapacity ( int  val)
inline

TODO:translate needed. Set the minimum buffer size. When the buffer (capacity) size increases, set it at least bigger than this size.

Parameters
valMinimum capacity size
void Proud::ByteArrayPtr::UninitBuffer ( )
inline

Call this method if you want to reuse UseInternalBuffer,UseExternalBuffer

void Proud::ByteArrayPtr::UseExternalBuffer ( uint8_t *  buf,
int  capacity 
)
inline

If you call this at the beginning, this object use external buffer

void Proud::ByteArrayPtr::UseInternalBuffer ( )
inline

TODO:translate needed. If you call this at the initial stage, generate and use an internal buffer