eRPC API Reference  Rev. 1.12.0
NXP Semiconductors
erpc::MessageBuffer Class Reference

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

#include <erpc_message_buffer.hpp>

Public Member Functions

 MessageBuffer (void)
 Constructor. More...
 
 MessageBuffer (uint8_t *buffer, uint16_t length)
 Constructor. More...
 
 MessageBuffer (const MessageBuffer &buffer)
 
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]bufferPointer to buffer.
[in]lengthLength 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]bufferPointer to another buffer to read/write data.
[in]lengthLength 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 MessageBuffer::setUsed ( uint16_t  used)

This function sets length of used space of buffer.

Parameters
[in]usedLength 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]offsetOffset in local buffer.
[in,out]dataGiven buffer to save read data.
[in]lengthLength 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]offsetOffset in local buffer.
[in,out]dataGiven buffer from which are copied data.
[in]lengthLength 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]otherMesageBuffer 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]otherMesageBuffer to swap.
uint8_t& erpc::MessageBuffer::operator[] ( int  index)
inline

Array operator return value of buffer at given index.

Parameters
[in]indexIndex in buffer.
const uint8_t& erpc::MessageBuffer::operator[] ( int  index) const
inline

Array operator return value of buffer at given index.

Parameters
[in]indexIndex in buffer.

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