Mistake on this page?
Report an issue in GitHub or email us
Public Member Functions
ByteBuffer Class Reference

Public Member Functions

 ByteBuffer (uint32_t size=0)
 Create a byte buffer of the given size. More...
 
 ~ByteBuffer ()
 Delete this byte buffer. More...
 
void resize (uint32_t size)
 Set the size of the buffer. More...
 
void push (uint8_t data)
 Add a single byte to this buffer. More...
 
void write (uint8_t *data, uint32_t size)
 Write a block of data to this ByteBuffer. More...
 
uint8_t pop ()
 Remove a byte from this buffer. More...
 
void read (uint8_t *data, uint32_t size)
 Read a block of data from this ByteBuffer into a buffer pointed by 'data'. More...
 
uint32_t size ()
 Return the number bytes in this byte buffer. More...
 
uint32_t free ()
 Return the number of additional bytes this buffer can hold. More...
 
bool full ()
 Check if this byte buffer is full. More...
 
bool empty ()
 Check if this byte buffer is empty. More...
 

Detailed Description

Definition at line 28 of file ByteBuffer.h.

Constructor & Destructor Documentation

ByteBuffer ( uint32_t  size = 0)

Create a byte buffer of the given size.

Parameters
sizeNumber of bytes this buffer can hold
~ByteBuffer ( )

Delete this byte buffer.

Member Function Documentation

bool empty ( )

Check if this byte buffer is empty.

Returns
true if empty, false otherwise
uint32_t free ( )

Return the number of additional bytes this buffer can hold.

Returns
Number of free bytes
bool full ( )

Check if this byte buffer is full.

Returns
true if full, false otherwise
uint8_t pop ( )

Remove a byte from this buffer.

Returns
data byte
void push ( uint8_t  data)

Add a single byte to this buffer.

There must be enough space in the buffer or the behavior is undefined.

Parameters
databyte to add
void read ( uint8_t *  data,
uint32_t  size 
)

Read a block of data from this ByteBuffer into a buffer pointed by 'data'.

There must be enough data in the ByteBuffer or the behavior is undefined.

Parameters
dataBlock of data to read
sizeSize of data to read
void resize ( uint32_t  size)

Set the size of the buffer.

Buffer contents are reset.

Parameters
sizeNew buffer size
uint32_t size ( )

Return the number bytes in this byte buffer.

Returns
Number of used bytes
void write ( uint8_t *  data,
uint32_t  size 
)

Write a block of data to this ByteBuffer.

There must be enough space in the ByteBuffer or the behavior is undefined.

Parameters
dataBlock of data to write
sizeSize of data to write
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.