4.6.0
Freundlich's C++ toolkit
Loading...
Searching...
No Matches
fcppt::container::buffer::object< T, A > Class Template Reference

Detailed Description

template<typename T, typename A = std::allocator<T>>
class fcppt::container::buffer::object< T, A >

A contiguous container for uninitialized data that contains a write and a read area.

Template Parameters
TMust be a trivial type.
AThe allocator type.

See fcppt.container.buffer for more information.

Public Types

using value_type = T
 
using allocator_type = A
 
using size_type = typename std::allocator_traits<A>::size_type
 
using pointer = typename std::allocator_traits<A>::pointer
 
using const_pointer = typename std::allocator_traits<A>::const_pointer
 
using const_reference = T const &
 
using const_iterator = const_pointer
 

Public Member Functions

 object (size_type write_sz)
 Constructs an uninitialized buffer.
 
 object (size_type write_sz, A)
 Constructs an uninitialized buffer with custom allocator.
 
 object (object &&) noexcept
 
objectoperator= (object &&) noexcept
 
 ~object () noexcept
 
const_iterator begin () const noexcept
 The beginning of the read area.
 
const_iterator end () const noexcept
 The end of the read area.
 
const_reference operator[] (size_type) const noexcept
 The read area at a given position.
 
const_pointer read_data () const noexcept
 The beginning of the read area.
 
const_pointer read_data_end () const noexcept
 The end of the read area.
 
pointer write_data () noexcept
 The beginning of the write area.
 
pointer write_data_end () noexcept
 The end of the write area.
 
size_type read_size () const noexcept
 The size of the read area.
 
size_type write_size () const noexcept
 The size of the write area.
 
void written (size_type sz) noexcept
 Adds to the read area.
 
void resize_write_area (size_type sz)
 Resizes the write area.
 
allocator_type get_allocator () const
 
void swap (object &) noexcept
 
fcppt::container::raw_vector::rep< A > release () noexcept
 Releases the storage.
 

Member Typedef Documentation

◆ allocator_type

template<typename T , typename A = std::allocator<T>>
using fcppt::container::buffer::object< T, A >::allocator_type = A

◆ const_iterator

template<typename T , typename A = std::allocator<T>>
using fcppt::container::buffer::object< T, A >::const_iterator = const_pointer

◆ const_pointer

template<typename T , typename A = std::allocator<T>>
using fcppt::container::buffer::object< T, A >::const_pointer = typename std::allocator_traits<A>::const_pointer

◆ const_reference

template<typename T , typename A = std::allocator<T>>
using fcppt::container::buffer::object< T, A >::const_reference = T const &

◆ pointer

template<typename T , typename A = std::allocator<T>>
using fcppt::container::buffer::object< T, A >::pointer = typename std::allocator_traits<A>::pointer

◆ size_type

template<typename T , typename A = std::allocator<T>>
using fcppt::container::buffer::object< T, A >::size_type = typename std::allocator_traits<A>::size_type

◆ value_type

template<typename T , typename A = std::allocator<T>>
using fcppt::container::buffer::object< T, A >::value_type = T

Constructor & Destructor Documentation

◆ object() [1/3]

template<typename T , typename A = std::allocator<T>>
fcppt::container::buffer::object< T, A >::object ( size_type write_sz)
explicit

Constructs an uninitialized buffer.

Constructs a buffer with a write area of size sz.

◆ object() [2/3]

template<typename T , typename A = std::allocator<T>>
fcppt::container::buffer::object< T, A >::object ( size_type write_sz,
A  )

Constructs an uninitialized buffer with custom allocator.

Constructs a buffer with a write area of size sz.

◆ object() [3/3]

template<typename T , typename A = std::allocator<T>>
fcppt::container::buffer::object< T, A >::object ( object< T, A > && )
noexcept

◆ ~object()

template<typename T , typename A = std::allocator<T>>
fcppt::container::buffer::object< T, A >::~object ( )
noexcept

Member Function Documentation

◆ begin()

template<typename T , typename A = std::allocator<T>>
const_iterator fcppt::container::buffer::object< T, A >::begin ( ) const
nodiscardnoexcept

The beginning of the read area.

◆ end()

template<typename T , typename A = std::allocator<T>>
const_iterator fcppt::container::buffer::object< T, A >::end ( ) const
nodiscardnoexcept

The end of the read area.

◆ get_allocator()

template<typename T , typename A = std::allocator<T>>
allocator_type fcppt::container::buffer::object< T, A >::get_allocator ( ) const
nodiscard

◆ operator=()

template<typename T , typename A = std::allocator<T>>
object & fcppt::container::buffer::object< T, A >::operator= ( object< T, A > && )
noexcept

◆ operator[]()

template<typename T , typename A = std::allocator<T>>
const_reference fcppt::container::buffer::object< T, A >::operator[] ( size_type ) const
nodiscardnoexcept

The read area at a given position.

◆ read_data()

template<typename T , typename A = std::allocator<T>>
const_pointer fcppt::container::buffer::object< T, A >::read_data ( ) const
nodiscardnoexcept

The beginning of the read area.

◆ read_data_end()

template<typename T , typename A = std::allocator<T>>
const_pointer fcppt::container::buffer::object< T, A >::read_data_end ( ) const
nodiscardnoexcept

The end of the read area.

◆ read_size()

template<typename T , typename A = std::allocator<T>>
size_type fcppt::container::buffer::object< T, A >::read_size ( ) const
nodiscardnoexcept

The size of the read area.

◆ release()

template<typename T , typename A = std::allocator<T>>
fcppt::container::raw_vector::rep< A > fcppt::container::buffer::object< T, A >::release ( )
nodiscardnoexcept

Releases the storage.

See also
fcppt::container::buffer::to_raw_vector

◆ resize_write_area()

template<typename T , typename A = std::allocator<T>>
void fcppt::container::buffer::object< T, A >::resize_write_area ( size_type sz)

Resizes the write area.

Sets the size of the write area to sz.

◆ swap()

template<typename T , typename A = std::allocator<T>>
void fcppt::container::buffer::object< T, A >::swap ( object< T, A > & )
noexcept

◆ write_data()

template<typename T , typename A = std::allocator<T>>
pointer fcppt::container::buffer::object< T, A >::write_data ( )
nodiscardnoexcept

The beginning of the write area.

◆ write_data_end()

template<typename T , typename A = std::allocator<T>>
pointer fcppt::container::buffer::object< T, A >::write_data_end ( )
nodiscardnoexcept

The end of the write area.

◆ write_size()

template<typename T , typename A = std::allocator<T>>
size_type fcppt::container::buffer::object< T, A >::write_size ( ) const
nodiscardnoexcept

The size of the write area.

◆ written()

template<typename T , typename A = std::allocator<T>>
void fcppt::container::buffer::object< T, A >::written ( size_type sz)
noexcept

Adds to the read area.

Adds sz elements to the read area. This function should be called after data has been read into the write area.