BByteArray Class Reference

#include <BByteArray.h>

List of all members.


Detailed Description

An ordered collection of Bytes.

Public Member Functions

void Add (const BByteArray &arr)
 Add data from another BByteArray object to the end of this BByteArray.
void Add (const void *pBytes, size_t len)
 Adds bytes from a buffer to the end of this BByteArray.
void Add (const Byte &val)
 Adds a Byte to the end of this BByteArray.
 BByteArray (const BByteArray &arr)
 Copy constructor.
 BByteArray (const void *pBytes, size_t len)
 Constructor.
 BByteArray (size_t num)
 Constructor.
 BByteArray ()
 Default constructor.
void Clear (void)
 Removes all data from this BByteArray.
void CopyToBuffer (Byte *pBuf, size_t startPos, size_t len) const
 Copy data from this BByteArray to a buffer.
BByteArray CopyToByteArray (size_t startPos, size_t len) const
 Copy bytes from this BByteArray to a new BByteAray object.
const ByteGetAt (size_t index) const
 Gets a Byte from this BByteArray.
ByteGetAt (size_t index)
 Gets a Byte from this BByteArray.
size_t GetCount (void) const
 Get the capacity of the byte array.
const ByteGetDataPtr (size_t index=0) const
 Provides read-only access to the internal data buffer.
 operator const Byte * (void) const
 Casts a BByteArray object to a const Byte pointer.
BByteArrayoperator+= (const BByteArray &arr)
 Appends the contents of a BByteArray object to the end of this BByteArray.
BByteArrayoperator+= (const Byte &val)
 Appends a Byte to the end of this BByteArray.
Byteoperator[] (size_t index)
 Gets a Byte from this BByteArray.
void Reserve (size_t num)
 Reserves space in the collection for the specified number of objects.
virtual ~BByteArray ()
 Destructor.

Protected Attributes

Bytem_bytes
 The contents of this BByteArray.
size_t m_capacity
 The maximum capacity of this BByteArray.
size_t m_nextPos
 The index at which new data can be added.

Constructor & Destructor Documentation

BByteArray (  ) 

Default constructor.

This constructor will create an empty collection.

BByteArray ( size_t  num  ) 

Constructor.

This constructor will create an empty collection, and it will reserve space for the specified number of Bytes.

Parameters:
num The initial number of Bytes for which space shall be reserved.

BByteArray ( const void *  pBytes,
size_t  len 
)

Constructor.

This will initialize the BByteArray using the supplied data.

Parameters:
pBytes Pointer to the buffer containing the data.
len The length of the buffer.

BByteArray ( const BByteArray arr  ) 

Copy constructor.

Parameters:
arr The BByteArray to copy.

virtual ~BByteArray (  )  [virtual]

Destructor.


Member Function Documentation

void Add ( const BByteArray arr  ) 

Add data from another BByteArray object to the end of this BByteArray.

Parameters:
arr The BByteArray to append to this BByteArray.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if there has not been a sufficient amount of space reserved in this BByteArray to contain the new data.

void Add ( const void *  pBytes,
size_t  len 
)

Adds bytes from a buffer to the end of this BByteArray.

Parameters:
pBytes Pointer to the buffer containing the data.
len The length of the buffer.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if there has not been a sufficient amount of space reserved in this BByteArray to contain the new data.

void Add ( const Byte val  ) 

Adds a Byte to the end of this BByteArray.

Parameters:
val The Byte to add to this BByteArray.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if there has not been a sufficient amount of space reserved in this BByteArray to contain the new Byte.

void Clear ( void   ) 

Removes all data from this BByteArray.

void CopyToBuffer ( Byte pBuf,
size_t  startPos,
size_t  len 
) const

Copy data from this BByteArray to a buffer.

Parameters:
pBuf The buffer to which data will be copied. This buffer must be allocated with at least len bytes.
startPos The position in the BByteArray to start copying.
len The number of bytes to copy.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if the startPos is not within the bounds of this BByteArray.

BByteArray CopyToByteArray ( size_t  startPos,
size_t  len 
) const

Copy bytes from this BByteArray to a new BByteAray object.

Parameters:
startPos The position in the BByteArray to start copying.
len The number of bytes to copy.
Returns:
The new BByteArray object containing the copied data.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if the startPos is not within the bounds of this BByteArray.

const Byte& GetAt ( size_t  index  )  const

Gets a Byte from this BByteArray.

Parameters:
index The zero-based index of the desired Byte.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if there is not a Byte at the specified index in this BByteArray.

Byte& GetAt ( size_t  index  ) 

Gets a Byte from this BByteArray.

Parameters:
index The zero-based index of the desired Byte.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if there is not a Byte at the specified index in this BByteArray.

size_t GetCount ( void   )  const [inline]

Get the capacity of the byte array.

This will return the amount of space that has been reserved in this BByteArray, not the number of bytes that have been added to the BByteArray.

Returns:
The total length of this BByteArray.

const Byte* GetDataPtr ( size_t  index = 0  )  const

Provides read-only access to the internal data buffer.

Parameters:
index The zero-based index of the desired Byte.
Returns:
Pointer to the data buffer.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if the specified index is outside the bounds of this BByteArray.

operator const Byte * ( void   )  const [inline]

Casts a BByteArray object to a const Byte pointer.

Returns:
A const pointer to the data buffer.

BByteArray& operator+= ( const BByteArray arr  ) 

Appends the contents of a BByteArray object to the end of this BByteArray.

Parameters:
arr The BByteArray object to append to this BByteArray.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if there has not been a sufficient amount of space reserved in this BByteArray to contain the new data.

BByteArray& operator+= ( const Byte val  ) 

Appends a Byte to the end of this BByteArray.

Parameters:
val The Byte to be appended to this BByteArray.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if there has not been a sufficient amount of space reserved in this BByteArray to contain the new Byte.

Byte& operator[] ( size_t  index  ) 

Gets a Byte from this BByteArray.

Parameters:
index The zero-based index of the desired Byte in this BByteArray.
Exceptions:
BIndexOutOfBoundsException This exception will be thrown if there is not a Byte at the specified index in this BByteArray.

void Reserve ( size_t  num  ) 

Reserves space in the collection for the specified number of objects.

Parameters:
num The number of objects to reserve space for.


Member Data Documentation

Byte* m_bytes [protected]

The contents of this BByteArray.

size_t m_capacity [protected]

The maximum capacity of this BByteArray.

size_t m_nextPos [protected]

The index at which new data can be added.


The documentation for this class was generated from the following file:

GeoTranslate 5.0 From Blue Marble Geographics