Thrill
0.1
|
BufferRef represents a reference to a memory area as pointer and valid length.
It is not deallocated or otherwise managed. This class can be used to pass around references to BufferBuilder and BufferReader objects.
Definition at line 33 of file buffer_ref.hpp.
#include <buffer_ref.hpp>
Public Member Functions | |
BufferRef (const BufferBuilder &bb) | |
Constructor, assign memory area from BufferBuilder. More... | |
BufferRef (const void *data, size_t size) | |
Constructor, assign memory area from pointer and length. More... | |
BufferRef (const std::string &str) | |
Constructor, assign memory area from string, does NOT copy. More... | |
BufferRef (const Buffer &b) | |
Constructor, assign memory area from net::Buffer, does NOT copy! More... | |
const void * | data () const |
Return a pointer to the currently kept memory area. More... | |
bool | operator!= (const BufferRef &br) const noexcept |
Compare contents of two BufferRefs. More... | |
bool | operator== (const BufferRef &br) const noexcept |
Compare contents of two BufferRefs. More... | |
size_t | size () const |
Return the currently valid length in bytes. More... | |
Buffer | ToBuffer () |
Explicit conversion to Buffer MOVING the memory ownership. More... | |
std::string | ToString () const |
Explicit conversion to std::string (copies memory of course). More... | |
Protected Types | |
using | Byte = unsigned char |
type used to store the bytes More... | |
Protected Attributes | |
const Byte * | data_ |
Allocated buffer pointer. More... | |
size_t | size_ |
Size of valid data. More... | |
|
protected |
type used to store the bytes
Definition at line 37 of file buffer_ref.hpp.
|
inlineexplicit |
Constructor, assign memory area from BufferBuilder.
Definition at line 47 of file buffer_ref.hpp.
|
inline |
Constructor, assign memory area from pointer and length.
Definition at line 52 of file buffer_ref.hpp.
|
inlineexplicit |
Constructor, assign memory area from string, does NOT copy.
Definition at line 57 of file buffer_ref.hpp.
Constructor, assign memory area from net::Buffer, does NOT copy!
Definition at line 63 of file buffer_ref.hpp.
|
inline |
Return a pointer to the currently kept memory area.
Definition at line 68 of file buffer_ref.hpp.
References BufferRef::data_.
|
inlinenoexcept |
Compare contents of two BufferRefs.
Definition at line 95 of file buffer_ref.hpp.
References BufferRef::operator==().
|
inlinenoexcept |
Compare contents of two BufferRefs.
Definition at line 89 of file buffer_ref.hpp.
Referenced by BufferRef::operator!=().
|
inline |
Return the currently valid length in bytes.
Definition at line 72 of file buffer_ref.hpp.
References BufferRef::size_.
|
inline |
Explicit conversion to Buffer MOVING the memory ownership.
Definition at line 80 of file buffer_ref.hpp.
References Buffer::Acquire(), and BufferRef::data_.
|
inline |
Explicit conversion to std::string (copies memory of course).
Definition at line 76 of file buffer_ref.hpp.
|
protected |
Allocated buffer pointer.
Definition at line 40 of file buffer_ref.hpp.
Referenced by BufferRef::data(), BufferReader::Get(), BufferReader::GetBufferRef(), BufferReader::IsNull(), BufferReader::Read(), and BufferRef::ToBuffer().
|
protected |
Size of valid data.
Definition at line 43 of file buffer_ref.hpp.
Referenced by BufferReader::available(), BufferReader::empty(), BufferRef::size(), and BufferReader::Size().