Reallocatable owning byte buffer. More...
#include <eagine/memory/buffer.hpp>
Public Types | |
using | size_type = typename block::size_type |
Buffer size type. | |
using | pointer = typename block::pointer |
Pointer type. | |
Public Member Functions | |
buffer (span_size_t align) | |
Constructor with explicit alignment specification. | |
buffer () | |
Default constructor. | |
buffer (buffer &&temp) noexcept | |
Move constructor. | |
auto | operator= (buffer &&temp) noexcept -> buffer & |
Move assignment operator. | |
buffer (const buffer &)=delete | |
Not copyable. | |
auto | operator= (const buffer &)=delete |
Not copy assignable. | |
auto | addr () const noexcept |
Returns the memory address of the start of the allocated space. | |
auto | data () const noexcept -> pointer |
Returns the pointer to the start of the allocated space. | |
auto | size () const noexcept -> span_size_t |
Returns the size of the buffer in bytes. More... | |
auto | empty () const noexcept |
Indicates that the buffer is empty. More... | |
auto | capacity () const noexcept -> span_size_t |
Returns the capacity of this buffer. More... | |
auto | reserve (span_size_t new_size) -> auto & |
Pre-allocate the specified number of bytes. More... | |
auto | resize (span_size_t new_size) -> auto & |
Resizes the buffer to the specified number of bytes. More... | |
auto | ensure (span_size_t new_size) -> auto & |
Ensure that the buuffer has at least the specified size in bytes. More... | |
auto | enlarge_by (span_size_t inc_size) -> auto & |
Enlarges the buffer by the specified number of bytes. More... | |
auto | clear () -> auto & |
Clears the buffer. More... | |
void | free () |
Deallocates the buffer. More... | |
operator block () noexcept | |
Implicit conversion to block. | |
operator const_block () const noexcept | |
Implicit conversion to const_block. | |
Reallocatable owning byte buffer.
|
inlinenoexcept |
Returns the capacity of this buffer.
Referenced by eagine::memory::buffer_pool::eat(), and reserve().
|
inline |
Clears the buffer.
Referenced by eagine::msgbus::stored_message::clear_data(), and eagine::msgbus::stored_message::fetch_all_from().
|
inlinenoexcept |
|
inline |
|
inline |
Ensure that the buuffer has at least the specified size in bytes.
|
inline |
|
inline |
|
inline |
Resizes the buffer to the specified number of bytes.
Referenced by clear(), enlarge_by(), ensure(), eagine::memory::buffer_pool::get(), eagine::istream_data_source::pop(), and eagine::istream_data_source::top().
|
inlinenoexcept |
Returns the size of the buffer in bytes.
Referenced by empty(), enlarge_by(), ensure(), eagine::msgbus::posix_mqueue_connection::max_data_size(), eagine::istream_data_source::pop(), and eagine::istream_data_source::top().