| eRPC API Reference Rev. 1.8.1 NXP Semiconductors

- Main Page
- API Reference
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Member Functions | List of all members
erpc::MessageBuffer Class Reference
Infrastructure » Serialization

Represents a memory buffer containing a message. More...

`#include <erpc_message_buffer.h>`

## Classes
class | Cursor
| Cursor within a MessageBuffer. More...

## Public Member Functions
| MessageBuffer (void)
| Constructor. More...
| MessageBuffer (uint8_t *buffer, uint16_t length)
| Constructor. More...
void | set (uint8_t *buffer, uint16_t length)
| This function set new buffer and his length. More...
uint8_t * | get (void)
| This function returns pointer to buffer to read/write. More...
const uint8_t * | get (void) const
| This function returns pointer to buffer to read/write. More...
uint16_t | getLength (void) const
| This function returns length of buffer. More...
uint16_t | getUsed (void) const
| This function returns length of used space of buffer. More...
uint16_t | getFree (void) const
| This function returns length of free space of buffer. More...
void | setUsed (uint16_t used)
| This function sets length of used space of buffer. More...
erpc_status_t | read (uint16_t offset, void *data, uint32_t length)
| This function read data from local buffer. More...
erpc_status_t | write (uint16_t offset, const void *data, uint32_t length)
| This function write data to local buffer. More...
erpc_status_t | copy (const MessageBuffer *other)
| This function copy given message buffer to local instance. More...
void | swap (MessageBuffer *other)
| This function swap message buffer attributes between given instance and local instance. More...
| operator uint8_t * (void)
| Casting operator return local buffer.
| operator const uint8_t * (void) const
| Casting operator return local buffer.
uint8_t & | operator[] (int index)
| Array operator return value of buffer at given index. More...
const uint8_t & | operator[] (int index) const
| Array operator return value of buffer at given index. More...

## Detailed Description

Represents a memory buffer containing a message.

The MessageBuffer object does not own the buffer memory. It simply provides an interface to accessing that memory in a convenient manner.

## Constructor & Destructor Documentation

erpc::MessageBuffer::MessageBuffer | ( | void |  | ) |
| inline

Constructor.

This function initializes object attributes.

erpc::MessageBuffer::MessageBuffer | ( | uint8_t * | buffer,
|  | uint16_t | length
| ) |  |
| inline

Constructor.

This function initializes object attributes.

Parameters

  [in] | buffer | Pointer to buffer.
  [in] | length | Length of buffer.

## Member Function Documentation

void erpc::MessageBuffer::set | ( | uint8_t * | buffer,
|  | uint16_t | length
| ) |  |
| inline

This function set new buffer and his length.

This function set buffer to read/write data.

Parameters

  [in] | buffer | Pointer to another buffer to read/write data.
  [in] | length | Length of buffer.

uint8_t* erpc::MessageBuffer::get | ( | void |  | ) |
| inline

This function returns pointer to buffer to read/write.

Returns
  Pointer to buffer to read/write.

const uint8_t* erpc::MessageBuffer::get | ( | void |  | ) | const
| inline

This function returns pointer to buffer to read/write.

Returns
  Pointer to buffer to read/write.

uint16_t erpc::MessageBuffer::getLength | ( | void |  | ) | const
| inline

This function returns length of buffer.

Returns
  Length of buffer.

uint16_t erpc::MessageBuffer::getUsed | ( | void |  | ) | const
| inline

This function returns length of used space of buffer.

Returns
  Length of used space of buffer.

uint16_t erpc::MessageBuffer::getFree | ( | void |  | ) | const
| inline

This function returns length of free space of buffer.

Returns
  Length of free space of buffer.

void erpc::MessageBuffer::setUsed | ( | uint16_t | used | ) |
| inline

This function sets length of used space of buffer.

Parameters

  [in] | used | Length of used space of buffer.

erpc_status_t MessageBuffer::read | ( | uint16_t | offset,
|  | void * | data,
|  | uint32_t | length
| ) |  |

This function read data from local buffer.

Parameters

  [in] | offset | Offset in local buffer.
  [in,out] | data | Given buffer to save read data.
  [in] | length | Length of data to read.

Returns
  Status from reading data.

erpc_status_t MessageBuffer::write | ( | uint16_t | offset,
|  | const void * | data,
|  | uint32_t | length
| ) |  |

This function write data to local buffer.

Parameters

  [in] | offset | Offset in local buffer.
  [in,out] | data | Given buffer from which are copied data.
  [in] | length | Length of data to write.

Returns
  Status from reading data.

erpc_status_t MessageBuffer::copy | ( | const MessageBuffer * | other | ) |

This function copy given message buffer to local instance.

Parameters

  [in] | other | MesageBuffer to copy.

Returns
  Status from reading data.

void MessageBuffer::swap | ( | MessageBuffer * | other | ) |

This function swap message buffer attributes between given instance and local instance.

Parameters

  [in] | other | MesageBuffer to swap.

uint8_t& erpc::MessageBuffer::operator[] | ( | int | index | ) |
| inline

Array operator return value of buffer at given index.

Parameters

  [in] | index | Index in buffer.

const uint8_t& erpc::MessageBuffer::operator[] | ( | int | index | ) | const
| inline

Array operator return value of buffer at given index.

Parameters

  [in] | index | Index in buffer.

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

- erpc_message_buffer.h
- erpc_message_buffer.cpp