XBee API operation library for mbed

Embed: (wiki syntax)

« Back to documentation index

BufferedArray Class Reference

BufferedArray Class Reference

Represent a generic, dynamic-length raw binary data buffer. More...

#include <BufferedArray.h>

Inherited by APIFrame.

Public Member Functions

unsigned char * gets ()
 Get the raw data.
unsigned char * gets (unsigned long position)
 Get the raw data from a specific location.
unsigned char get (unsigned long position)
 Get 1 byte data from a specific location.
int getPosition ()
 Get the current index.
void setPosition (unsigned long position)
 Set the index within the max length of raw data.
void allocate (unsigned long length)
 Reset the raw data.
void rewind ()
 Reset the position and does not affect the content of the data.
void set (unsigned char value)
 Write 8-bit data into current posiston and increase by 1.
void sets (const unsigned char *value, unsigned long offset, unsigned long length)
 Write array of data into current posiston, and increase by the lenght.
void set (unsigned long position, unsigned char value)
 Write 8-bit data into specific posiston and deos not affect the current position.
void sets (unsigned long position, const unsigned char *value, unsigned long offset, unsigned long length)
 Write array of data into specific posiston and deos not affect the current position.

Protected Attributes

unsigned int expandSize
 initial size and automatically increase length.
unsigned char * data
 Raw data.
unsigned long index
 Current index of the data, could also used as data lendth.
unsigned long max
 Max data size that the raw data can hold.

Detailed Description

Represent a generic, dynamic-length raw binary data buffer.

Definition at line 9 of file BufferedArray.h.


Member Function Documentation

void allocate ( unsigned long  length )

Reset the raw data.

Parameters:
lengthcurrent max size for the raw data

Reimplemented in APIFrame.

Definition at line 56 of file BufferedArray.cpp.

unsigned char get ( unsigned long  position )

Get 1 byte data from a specific location.

Parameters:
positionwhere to retrieve
Returns:
unsigned char.

Definition at line 39 of file BufferedArray.cpp.

int getPosition (  )

Get the current index.

Returns:
unsigned char array.

Definition at line 44 of file BufferedArray.cpp.

unsigned char * gets (  )

Get the raw data.

Returns:
unsigned char array.

Definition at line 29 of file BufferedArray.cpp.

unsigned char * gets ( unsigned long  position )

Get the raw data from a specific location.

Parameters:
positionwhere to retrieve
Returns:
unsigned char array.

Definition at line 34 of file BufferedArray.cpp.

void rewind (  )

Reset the position and does not affect the content of the data.

Parameters:
lengthcurrent max size for the raw data

Reimplemented in APIFrame.

Definition at line 70 of file BufferedArray.cpp.

void set ( unsigned char  value )

Write 8-bit data into current posiston and increase by 1.

Parameters:
valuesigle byte

Reimplemented in APIFrame.

Definition at line 92 of file BufferedArray.cpp.

void set ( unsigned long  position,
unsigned char  value 
)

Write 8-bit data into specific posiston and deos not affect the current position.

Parameters:
positionwhere to write
valuesigle byte

Reimplemented in APIFrame.

Definition at line 84 of file BufferedArray.cpp.

void setPosition ( unsigned long  position )

Set the index within the max length of raw data.

Parameters:
positionwhere to begin read and write

Definition at line 49 of file BufferedArray.cpp.

void sets ( unsigned long  position,
const unsigned char *  value,
unsigned long  offset,
unsigned long  length 
)

Write array of data into specific posiston and deos not affect the current position.

Parameters:
positionwhere to write
valuearray of byte
offsetstart point of the data
lengthlength to write

Reimplemented in APIFrame.

Definition at line 107 of file BufferedArray.cpp.

void sets ( const unsigned char *  value,
unsigned long  offset,
unsigned long  length 
)

Write array of data into current posiston, and increase by the lenght.

Parameters:
valuearray of byte
offsetstart point of the data
lengthlength to write

Reimplemented in APIFrame.

Definition at line 98 of file BufferedArray.cpp.


Field Documentation

unsigned char* data [protected]

Raw data.

Definition at line 16 of file BufferedArray.h.

unsigned int expandSize [protected]

initial size and automatically increase length.

Definition at line 13 of file BufferedArray.h.

unsigned long index [protected]

Current index of the data, could also used as data lendth.

Definition at line 19 of file BufferedArray.h.

unsigned long max [protected]

Max data size that the raw data can hold.

Definition at line 22 of file BufferedArray.h.