10 #ifndef _EMBEDDED_RPC__MESSAGE_BUFFER_H_ 11 #define _EMBEDDED_RPC__MESSAGE_BUFFER_H_ 13 #include "erpc_common.h" 55 MessageBuffer(uint8_t *buffer, uint16_t length) : m_buf(buffer), m_len(length), m_used(0) {}
67 void set(uint8_t *buffer, uint16_t length)
79 uint8_t *
get(void) {
return m_buf; }
86 const uint8_t *
get(void)
const {
return m_buf; }
100 uint16_t
getUsed(
void)
const {
return m_used; }
107 uint16_t
getFree(
void)
const {
return m_len - m_used; }
157 operator uint8_t *(void) {
return m_buf; }
162 operator const uint8_t *(void)
const {
return m_buf; }
176 const uint8_t &
operator[](
int index)
const {
return m_buf[index]; }
179 uint8_t *
volatile m_buf;
180 uint16_t
volatile m_len;
181 uint16_t
volatile m_used;
195 Cursor(
void) : m_buffer(), m_pos(NULL) {}
231 uint8_t *
get(void) {
return m_pos; }
240 const uint8_t *
get(void)
const {
return m_pos; }
247 uint16_t
getRemaining(
void)
const {
return m_buffer.getLength() - (uint16_t)(m_pos - m_buffer.get()); }
254 uint16_t
getRemainingUsed(
void)
const {
return m_buffer.getUsed() - (uint16_t)(m_pos - m_buffer.get()); }
281 operator uint8_t *(void) {
return m_pos; }
286 operator const uint8_t *(void)
const {
return m_pos; }
309 Cursor &operator+=(uint16_t n);
318 Cursor &operator-=(uint16_t n);
382 virtual bool createServerBuffer(
void);
407 #endif // _EMBEDDED_RPC__MESSAGE_BUFFER_H_ erpc_status_t read(uint16_t offset, void *data, uint32_t length)
This function read data from local buffer.
Definition: erpc_message_buffer.cpp:38
erpc_status_t copy(const MessageBuffer *other)
This function copy given message buffer to local instance.
Definition: erpc_message_buffer.cpp:84
Cursor(MessageBuffer &buffer)
Constructor.
Definition: erpc_message_buffer.hpp:204
enum _erpc_status erpc_status_t
Type used for all status and error return values.
Definition: erpc_common.h:85
MessageBuffer(void)
Constructor.
Definition: erpc_message_buffer.hpp:45
uint8_t & operator[](int index)
Array operator return value of buffer at given index.
Definition: erpc_message_buffer.hpp:169
uint16_t getUsed(void) const
This function returns length of used space of buffer.
Definition: erpc_message_buffer.hpp:100
Cursor within a MessageBuffer.
Definition: erpc_message_buffer.hpp:187
uint16_t getRemainingUsed(void) const
Return remaining space from used of current buffer.
Definition: erpc_message_buffer.hpp:254
uint16_t getRemaining(void) const
Return remaining free space in current buffer.
Definition: erpc_message_buffer.hpp:247
uint16_t getLength(void) const
This function returns length of buffer.
Definition: erpc_message_buffer.hpp:93
uint16_t getFree(void) const
This function returns length of free space of buffer.
Definition: erpc_message_buffer.hpp:107
Represents a memory buffer containing a message.
Definition: erpc_message_buffer.hpp:37
Definition: erpc_arbitrated_client_manager.hpp:25
void swap(MessageBuffer *other)
This function swap message buffer attributes between given instance and local instance.
Definition: erpc_message_buffer.cpp:97
uint8_t * get(void)
This function returns pointer to buffer to read/write.
Definition: erpc_message_buffer.hpp:79
void setUsed(uint16_t used)
This function sets length of used space of buffer.
Definition: erpc_message_buffer.cpp:31
MessageBuffer(uint8_t *buffer, uint16_t length)
Constructor.
Definition: erpc_message_buffer.hpp:55
Abstract interface for message buffer factory.
Definition: erpc_message_buffer.hpp:344
erpc_status_t write(uint16_t offset, const void *data, uint32_t length)
This function write data to local buffer.
Definition: erpc_message_buffer.cpp:61
Cursor(void)
Constructor.
Definition: erpc_message_buffer.hpp:195
const uint8_t & operator[](int index) const
Array operator return value of buffer at given index.
Definition: erpc_message_buffer.hpp:176