3.8.0
Freundlich's C++ toolkit
Classes | Public Types | Public Member Functions
fcppt::container::buffer::object< T, A > Class Template Reference

Detailed Description

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

Member Typedef Documentation

◆ allocator_type

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

◆ const_iterator

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

◆ const_pointer

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

◆ const_reference

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

◆ pointer

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

◆ size_type

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

◆ value_type

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

Constructor & Destructor Documentation

◆ object() [1/3]

template<typename T , typename A >
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 >
fcppt::container::buffer::object< T, A >::object ( size_type  write_sz,
 
)

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 >
fcppt::container::buffer::object< T, A >::object ( object< T, A > &&  )
noexcept

◆ ~object()

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

Member Function Documentation

◆ begin()

template<typename T , typename A >
const_iterator fcppt::container::buffer::object< T, A >::begin ( ) const
noexcept

The beginning of the read area.

◆ end()

template<typename T , typename A >
const_iterator fcppt::container::buffer::object< T, A >::end ( ) const
noexcept

The end of the read area.

◆ get_allocator()

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

◆ operator=()

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

◆ operator[]()

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

The read area at a given position.

◆ read_data()

template<typename T , typename A >
const_pointer fcppt::container::buffer::object< T, A >::read_data ( ) const
noexcept

The beginning of the read area.

◆ read_data_end()

template<typename T , typename A >
const_pointer fcppt::container::buffer::object< T, A >::read_data_end ( ) const
noexcept

The end of the read area.

◆ read_size()

template<typename T , typename A >
size_type fcppt::container::buffer::object< T, A >::read_size ( ) const
noexcept

The size of the read area.

◆ release()

template<typename T , typename A >
fcppt::container::raw_vector::rep<A> fcppt::container::buffer::object< T, A >::release ( )
noexcept

Releases the storage.

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

◆ resize_write_area()

template<typename T , typename A >
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 >
void fcppt::container::buffer::object< T, A >::swap ( object< T, A > &  )
noexcept

◆ write_data()

template<typename T , typename A >
pointer fcppt::container::buffer::object< T, A >::write_data ( )
noexcept

The beginning of the write area.

◆ write_data_end()

template<typename T , typename A >
pointer fcppt::container::buffer::object< T, A >::write_data_end ( )
noexcept

The end of the write area.

◆ write_size()

template<typename T , typename A >
size_type fcppt::container::buffer::object< T, A >::write_size ( ) const
noexcept

The size of the write area.

◆ written()

template<typename T , typename A >
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.