Thrill
0.1
|
Represents a FIXED length area of memory, which can be modified by appending integral data types via Put() and other basic operations.
Definition at line 38 of file fixed_buffer_builder.hpp.
#include <fixed_buffer_builder.hpp>
Public Member Functions | |
Data, Size, and Capacity Accessors | |
const Byte * | data () const |
Return a pointer to the currently kept memory area. More... | |
Byte * | data () |
Return a writeable pointer to the currently kept memory area. More... | |
size_t | size () const |
Return the currently used length in bytes. More... | |
size_t | capacity () const |
Return the currently allocated buffer capacity. More... | |
Buffer Growing, Clearing, and other Management | |
FixedBufferBuilder & | Clear () |
Clears the memory contents, does not deallocate the memory. More... | |
FixedBufferBuilder & | set_size (size_t n) |
std::string | ToString () const |
Explicit conversion to std::string (copies memory of course). More... | |
Appending Write Functions | |
FixedBufferBuilder & | Append (const void *data, size_t len) |
Append a memory range to the buffer. More... | |
FixedBufferBuilder & | AppendString (const std::string &s) |
template<typename Type > | |
FixedBufferBuilder & | Put (const Type &item) |
FixedBufferBuilder & | PutByte (Byte data) |
Put a single byte to the buffer (used via CRTP from ItemWriterToolsBase) More... | |
template<typename Type > | |
FixedBufferBuilder & | PutRaw (const Type &item) |
Access | |
iterator | begin () |
return mutable iterator to first element More... | |
const_iterator | begin () const |
return constant iterator to first element More... | |
iterator | end () |
return mutable iterator beyond last element More... | |
const_iterator | end () const |
return constant iterator beyond last element More... | |
reference | operator[] (size_t i) |
return the i-th position of the vector More... | |
Public Member Functions inherited from ItemWriterToolsBase< FixedBufferBuilder< Capacity > > | |
FixedBufferBuilder< Capacity > & | PutString (const char *data, size_t len) |
Put a string by saving it's length followed by the data itself. More... | |
FixedBufferBuilder< Capacity > & | PutString (const uint8_t *data, size_t len) |
Put a string by saving it's length followed by the data itself. More... | |
FixedBufferBuilder< Capacity > & | PutString (const std::string &str) |
Put a string by saving it's length followed by the data itself. More... | |
FixedBufferBuilder< Capacity > & | PutVarint (uint64_t v) |
Append a varint to the writer. More... | |
FixedBufferBuilder< Capacity > & | PutVarint32 (uint32_t v) |
Append a varint to the writer. More... | |
Private Types | |
using | Byte = unsigned char |
type used to store the bytes More... | |
using | const_iterator = const Byte * |
simple pointer iterators More... | |
using | const_reference = const Byte & |
simple pointer references More... | |
using | iterator = Byte * |
simple pointer iterators More... | |
using | reference = Byte & |
simple pointer references More... | |
Private Attributes | |
std::array< Byte, Capacity > | data_ |
Allocated buffer. More... | |
size_t | size_ = 0 |
Size of valid data. More... | |
|
private |
type used to store the bytes
Definition at line 43 of file fixed_buffer_builder.hpp.
|
private |
simple pointer iterators
Definition at line 48 of file fixed_buffer_builder.hpp.
|
private |
simple pointer references
Definition at line 52 of file fixed_buffer_builder.hpp.
simple pointer iterators
Definition at line 46 of file fixed_buffer_builder.hpp.
simple pointer references
Definition at line 50 of file fixed_buffer_builder.hpp.
|
inline |
Append a memory range to the buffer.
Definition at line 115 of file fixed_buffer_builder.hpp.
References FixedBufferBuilder< Capacity >::data(), and FixedBufferBuilder< Capacity >::size_.
Referenced by FixedBufferBuilder< Capacity >::AppendString().
|
inline |
Append to contents of a std::string, excluding the null (which isn't contained in the string size anyway).
Definition at line 127 of file fixed_buffer_builder.hpp.
References FixedBufferBuilder< Capacity >::Append().
|
inline |
return mutable iterator to first element
Definition at line 164 of file fixed_buffer_builder.hpp.
Referenced by FixedBufferBuilder< Capacity >::operator[]().
|
inline |
return constant iterator to first element
Definition at line 167 of file fixed_buffer_builder.hpp.
|
inline |
Return the currently allocated buffer capacity.
Definition at line 80 of file fixed_buffer_builder.hpp.
|
inline |
Clears the memory contents, does not deallocate the memory.
Definition at line 90 of file fixed_buffer_builder.hpp.
|
inline |
Return a pointer to the currently kept memory area.
Definition at line 65 of file fixed_buffer_builder.hpp.
Referenced by FixedBufferBuilder< Capacity >::Append(), and FixedBufferBuilder< Capacity >::PutByte().
|
inline |
Return a writeable pointer to the currently kept memory area.
Definition at line 70 of file fixed_buffer_builder.hpp.
|
inline |
return mutable iterator beyond last element
Definition at line 171 of file fixed_buffer_builder.hpp.
References FixedBufferBuilder< Capacity >::size_.
|
inline |
return constant iterator beyond last element
Definition at line 174 of file fixed_buffer_builder.hpp.
References FixedBufferBuilder< Capacity >::size_.
|
inline |
return the i-th position of the vector
Definition at line 178 of file fixed_buffer_builder.hpp.
References FixedBufferBuilder< Capacity >::begin().
|
inline |
Put (append) a single item of the template type T to the buffer. Be careful with implicit type conversions!
Definition at line 134 of file fixed_buffer_builder.hpp.
References FixedBufferBuilder< Capacity >::size_, and gen_data::value.
|
inline |
Put a single byte to the buffer (used via CRTP from ItemWriterToolsBase)
Definition at line 147 of file fixed_buffer_builder.hpp.
References FixedBufferBuilder< Capacity >::data().
|
inline |
Put (append) a single item of the template type T to the buffer. Be careful with implicit type conversions!
Definition at line 154 of file fixed_buffer_builder.hpp.
|
inline |
Set the valid bytes in the buffer, use if the buffer is filled directly.
Definition at line 97 of file fixed_buffer_builder.hpp.
|
inline |
Return the currently used length in bytes.
Definition at line 75 of file fixed_buffer_builder.hpp.
References FixedBufferBuilder< Capacity >::size_.
|
inline |
Explicit conversion to std::string (copies memory of course).
Definition at line 105 of file fixed_buffer_builder.hpp.
|
private |
Allocated buffer.
Definition at line 55 of file fixed_buffer_builder.hpp.
|
private |
Size of valid data.
Definition at line 58 of file fixed_buffer_builder.hpp.
Referenced by FixedBufferBuilder< Capacity >::Append(), FixedBufferBuilder< Capacity >::end(), FixedBufferBuilder< Capacity >::Put(), and FixedBufferBuilder< Capacity >::size().