OGLplus  (0.59.0) a C++ wrapper for rendering APIs

eagine::memory::buffer Class Reference

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.
 

Detailed Description

Reallocatable owning byte buffer.

See also
block

Member Function Documentation

◆ capacity()

auto eagine::memory::buffer::capacity ( ) const -> span_size_t
inlinenoexcept

Returns the capacity of this buffer.

See also
reserve
resize

Referenced by eagine::memory::buffer_pool::eat(), and reserve().

◆ clear()

auto eagine::memory::buffer::clear ( ) -> auto&
inline

◆ empty()

auto eagine::memory::buffer::empty ( ) const
inlinenoexcept

Indicates that the buffer is empty.

See also
size
capacity

◆ enlarge_by()

auto eagine::memory::buffer::enlarge_by ( span_size_t  inc_size) -> auto&
inline

Enlarges the buffer by the specified number of bytes.

See also
size
resize
reserve
ensure

◆ ensure()

auto eagine::memory::buffer::ensure ( span_size_t  new_size) -> auto&
inline

Ensure that the buuffer has at least the specified size in bytes.

See also
size
resize
reserve
enlarge_by

◆ free()

void eagine::memory::buffer::free ( )
inline

Deallocates the buffer.

See also
size
resize
reserve
clear
Postcondition
empty() && capacity() == 0

◆ reserve()

auto eagine::memory::buffer::reserve ( span_size_t  new_size) -> auto&
inline

Pre-allocate the specified number of bytes.

See also
capacity
resize

Referenced by resize().

◆ resize()

auto eagine::memory::buffer::resize ( span_size_t  new_size) -> auto&
inline

◆ size()

auto eagine::memory::buffer::size ( ) const -> span_size_t
inlinenoexcept

The documentation for this class was generated from the following file:

Copyright © 2015-2021 Matúš Chochlík.
<chochlik -at -gmail.com>
Documentation generated on Tue Apr 13 2021 by Doxygen (version 1.8.17).