|
AdsLib
|
#include <Frame.h>
Public Member Functions | |
| Frame (size_t length, const void *data=nullptr) | |
| Frame. More... | |
| uint8_t | operator[] (size_t index) const |
| operator [] bytewise access to the frame bytes More... | |
| size_t | capacity () const |
| capacity More... | |
| Frame & | clear () |
| clear Reset internal buffer to an empty frame More... | |
| Frame & | limit (size_t newSize) |
| limit If the frame is reused as a response buffer, call limit() to lock the frames state and limit its size to the length of the response More... | |
| Frame & | reset (size_t newSize=4096) |
| reset Prepare the frame to be reused as a response buffer More... | |
| const uint8_t * | data () const |
| data More... | |
| template<typename T > | |
| T | pop () |
| template<typename T > | |
| T | pop_letoh () |
| Frame & | prepend (const void *const data, const size_t size) |
| prepend prepend <data> in front of the frame More... | |
| template<class T > | |
| Frame & | prepend (const T &header) |
| uint8_t * | rawData () const |
| rawData Reuse the frame as response buffer, use with care! More... | |
| Frame & | remove (size_t numBytes) |
| remove remove <numBytest> from the beginning of the frame More... | |
| template<class T > | |
| T | remove () |
| size_t | size () const |
| size More... | |
Copyright (c) 2015 - 2022 Beckhoff Automation GmbH & Co. KG
| Frame::Frame | ( | size_t | length, |
| const void * | data = nullptr |
||
| ) |
| length | number of bytes preallocated in the internale buffer |
| data,if | not null this frame will be initialized with <lenght> number of bytes from <data> |
Copyright (c) 2015 - 2022 Beckhoff Automation GmbH & Co. KG
| size_t Frame::capacity | ( | ) | const |
capacity
| Frame & Frame::clear | ( | ) |
clear Reset internal buffer to an empty frame
| const uint8_t * Frame::data | ( | ) | const |
data
| Frame & Frame::limit | ( | size_t | newSize | ) |
limit If the frame is reused as a response buffer, call limit() to lock the frames state and limit its size to the length of the response
| newSize | length of the response |
| uint8_t Frame::operator[] | ( | size_t | index | ) | const |
operator [] bytewise access to the frame bytes
| index | should be within the frames bounds! |
|
inline |
remove sizeof(T) bytes from the beginning of the frame and return them interpreted as T. If frame is to short to fit a T, we silently return a default initialized T.
|
inline |
remove sizeof(T) bytes from the beginning of the frame and return them interpreted as T in little endian byte order (result is in host order).
|
inline |
prepend a header of type <T>
| Frame & Frame::prepend | ( | const void *const | data, |
| const size_t | size | ||
| ) |
prepend prepend <data> in front of the frame
| data | |
| size | number of bytes in <data> |
| uint8_t * Frame::rawData | ( | ) | const |
rawData Reuse the frame as response buffer, use with care!
|
inline |
remove header of type <T> from the beginning of the frame
| Frame & Frame::remove | ( | size_t | numBytes | ) |
remove remove <numBytest> from the beginning of the frame
| numBytes |
| Frame & Frame::reset | ( | size_t | newSize = 4096 | ) |
reset Prepare the frame to be reused as a response buffer
| newSize | expected size of the response |
| size_t Frame::size | ( | ) | const |
size