8#include "wrap_endian.h"
17 Frame(
size_t length,
const void*
data =
nullptr);
61 const uint8_t*
data()
const;
68 template<
typename T> T
pop()
72 value = *
reinterpret_cast<T*
>(m_Pos);
84 return bhf::ads::letoh(pop<T>());
101 return prepend(&header,
sizeof(T));
124 const auto p = m_Pos;
136 std::unique_ptr<uint8_t[]> m_Data;
139 size_t m_OriginalSize;
const uint8_t * data() const
data
Definition: Frame.cpp:41
Frame & reset(size_t newSize=4096)
reset Prepare the frame to be reused as a response buffer
Definition: Frame.cpp:53
size_t size() const
size
Definition: Frame.cpp:100
Frame & clear()
clear Reset internal buffer to an empty frame
Definition: Frame.cpp:36
size_t capacity() const
capacity
Definition: Frame.cpp:31
T pop_letoh()
Definition: Frame.h:82
uint8_t operator[](size_t index) const
operator [] bytewise access to the frame bytes
Definition: Frame.cpp:26
T pop()
Definition: Frame.h:68
Frame & prepend(const void *const data, const size_t size)
prepend prepend <data> in front of the frame
Definition: Frame.cpp:70
Frame & prepend(const T &header)
Definition: Frame.h:99
Frame & limit(size_t newSize)
limit If the frame is reused as a response buffer, call limit() to lock the frames state and limit it...
Definition: Frame.cpp:46
T remove()
Definition: Frame.h:122
uint8_t * rawData() const
rawData Reuse the frame as response buffer, use with care!
Definition: Frame.cpp:89