#include <buffer.h>
For bigger data (>100k) using a std::vector< uint8_t > has a high overhead when resizing (>1ms). This buffer just memcpy's elements, i.e., it should be used on PODs only since the copy constructor or assignment operator is not called on the copied elements.
Definition at line 25 of file buffer.h.
Public Member Functions | |
| void | clear () |
| Flush the buffer, deleting all data. | |
| Buffer (Buffer &from) | |
| Copy constructor - transfers ownership! | |
| const Buffer & | operator= (Buffer &from) |
| Assignment operator. | |
| T & | operator[] (const size_t position) |
| const T & | operator[] (const size_t position) const |
| void | resize (const uint64_t newSize) |
| Ensure that the buffer contains at least newSize elements, retains existing data. | |
| void | reserve (const uint64_t newSize) |
| Ensure that the buffer contains at least newSize elements, deletes existing data. | |
| void | append (const T *addData, const uint64_t addSize) |
| Append addSize elements to the buffer, increasing its size. | |
| void | append (const T &element) |
| Append one elements to the buffer, increasing its size. | |
| void | replace (const void *newData, const uint64_t newSize) |
| Replace the existing data. | |
| void | swap (Buffer &buffer) |
| Swap the buffer contents. | |
| uint64_t | getMaxSize () const |
Public Attributes | |
| T * | data |
| A pointer to the data. | |
| uint64_t | size |
| The number of valid items in data. | |
| void eq::base::Buffer< T >::clear | ( | ) | [inline] |
| void eq::base::Buffer< T >::append | ( | const T * | addData, | |
| const uint64_t | addSize | |||
| ) | [inline] |
| void eq::base::Buffer< T >::append | ( | const T & | element | ) | [inline] |
| void eq::base::Buffer< T >::replace | ( | const void * | newData, | |
| const uint64_t | newSize | |||
| ) | [inline] |
Replace the existing data.
Definition at line 107 of file buffer.h.
Referenced by eq::base::Buffer< pollfd >::operator=().
| uint64_t eq::base::Buffer< T >::getMaxSize | ( | ) | const [inline] |
| T* eq::base::Buffer< T >::data |
A pointer to the data.
Definition at line 137 of file buffer.h.
Referenced by eq::net::FullMasterCM::addSlave(), eq::base::Buffer< pollfd >::append(), eq::base::Buffer< pollfd >::Buffer(), eq::base::Buffer< pollfd >::clear(), eq::net::DataOStream::disable(), eq::net::DataOStream::flush(), eq::base::Buffer< pollfd >::operator=(), eq::base::Buffer< pollfd >::replace(), eq::net::DataOStream::resend(), eq::base::Buffer< pollfd >::reserve(), eq::base::Buffer< pollfd >::resize(), eq::net::ConnectionSet::select(), and eq::base::Buffer< pollfd >::swap().
| uint64_t eq::base::Buffer< T >::size |
The number of valid items in data.
Definition at line 139 of file buffer.h.
Referenced by eq::net::FullMasterCM::addSlave(), eq::base::Buffer< pollfd >::append(), eq::base::Buffer< pollfd >::Buffer(), eq::base::Buffer< pollfd >::clear(), eq::net::DataOStream::disable(), eq::net::DataOStream::disableSave(), eq::net::DataOStream::enableSave(), eq::net::DataOStream::flush(), eq::base::Buffer< pollfd >::operator=(), eq::base::Buffer< pollfd >::replace(), eq::net::DataOStream::resend(), eq::base::Buffer< pollfd >::reserve(), eq::base::Buffer< pollfd >::resize(), eq::net::ConnectionSet::select(), and eq::base::Buffer< pollfd >::swap().
0.6 by
1.5.5