libjmmcg  build_2783
A C++ library containing an eclectic mix of useful, advanced components.
jmmcg::heap::memory_buffer< OST, El > Class Template Reference

A very simple custom allocator that allocates a contiguous block of uninitialised items on the heap. More...

#include <memory_buffer.hpp>

Public Types

enum  { stride =sizeof(element_type) }
 
typedef OST os_traits
 
typedef os_traits::exception_type exception_type
 
typedef El element_type
 The type of items to allocate, but not initialise. More...
 
typedef buff_info_t::second_type size_type
 
typedef unsigned const char * const_iterator
 
typedef unsigned char * iterator
 

Public Member Functions

 BOOST_MPL_ASSERT ((boost::mpl::greater< boost::mpl::int_< stride >, boost::mpl::int_< 0 >>))
 
 memory_buffer (size_type const num_objs) noexcept(false) FORCE_INLINE
 
 ~memory_buffer () noexcept(true) FORCE_INLINE
 
 memory_buffer (memory_buffer const &)=delete
 
 memory_buffer (memory_buffer &&)=delete
 
void operator= (memory_buffer const &)=delete
 
void operator= (memory_buffer &&)=delete
 
const_iterator data () const noexcept(true) FORCE_INLINE
 
iterator data () noexcept(true) FORCE_INLINE
 
size_type __fastcall max_size () const noexcept(true) FORCE_INLINE
 

Friends

tostream &__fastcall operator<< (tostream &os, memory_buffer const &t) noexcept(false)
 

Detailed Description

template<class OST, class El>
class jmmcg::heap::memory_buffer< OST, El >

A very simple custom allocator that allocates a contiguous block of uninitialised items on the heap.

Note that the items allocated are guaranteed not to be initialised.

Definition at line 76 of file memory_buffer.hpp.

Member Typedef Documentation

◆ const_iterator

template<class OST, class El>
typedef unsigned const char* jmmcg::heap::memory_buffer< OST, El >::const_iterator

Definition at line 104 of file memory_buffer.hpp.

◆ element_type

template<class OST, class El>
typedef El jmmcg::heap::memory_buffer< OST, El >::element_type

The type of items to allocate, but not initialise.

Definition at line 97 of file memory_buffer.hpp.

◆ exception_type

template<class OST, class El>
typedef os_traits::exception_type jmmcg::heap::memory_buffer< OST, El >::exception_type

Definition at line 96 of file memory_buffer.hpp.

◆ iterator

template<class OST, class El>
typedef unsigned char* jmmcg::heap::memory_buffer< OST, El >::iterator

Definition at line 105 of file memory_buffer.hpp.

◆ os_traits

template<class OST, class El>
typedef OST jmmcg::heap::memory_buffer< OST, El >::os_traits

Definition at line 95 of file memory_buffer.hpp.

◆ size_type

template<class OST, class El>
typedef buff_info_t::second_type jmmcg::heap::memory_buffer< OST, El >::size_type

Definition at line 103 of file memory_buffer.hpp.

Member Enumeration Documentation

◆ anonymous enum

template<class OST, class El>
anonymous enum
Enumerator
stride 

The sizeof(element_type) each item, specifically in bytes.

Definition at line 107 of file memory_buffer.hpp.

Constructor & Destructor Documentation

◆ memory_buffer() [1/3]

template<class OST, class El>
jmmcg::heap::memory_buffer< OST, El >::memory_buffer ( size_type const  num_objs)
inlineexplicitnoexcept
Parameters
num_objsThe number of the items to be allocated.

Definition at line 116 of file memory_buffer.hpp.

◆ ~memory_buffer()

template<class OST, class El>
jmmcg::heap::memory_buffer< OST, El >::~memory_buffer ( )
inlinenoexcept

Definition at line 129 of file memory_buffer.hpp.

◆ memory_buffer() [2/3]

template<class OST, class El>
jmmcg::heap::memory_buffer< OST, El >::memory_buffer ( memory_buffer< OST, El > const &  )
delete

◆ memory_buffer() [3/3]

template<class OST, class El>
jmmcg::heap::memory_buffer< OST, El >::memory_buffer ( memory_buffer< OST, El > &&  )
delete

Member Function Documentation

◆ BOOST_MPL_ASSERT()

template<class OST, class El>
jmmcg::heap::memory_buffer< OST, El >::BOOST_MPL_ASSERT ( (boost::mpl::greater< boost::mpl::int_< stride >, boost::mpl::int_< 0 >>)  )

◆ data() [1/2]

template<class OST, class El>
const_iterator jmmcg::heap::memory_buffer< OST, El >::data ( ) const
inlinenoexcept
Returns
Note the iterator returned is a byte-pointer.

Definition at line 141 of file memory_buffer.hpp.

◆ data() [2/2]

template<class OST, class El>
iterator jmmcg::heap::memory_buffer< OST, El >::data ( )
inlinenoexcept
Returns
Note the iterator returned is a byte-pointer.

Definition at line 147 of file memory_buffer.hpp.

◆ max_size()

template<class OST, class El>
size_type __fastcall jmmcg::heap::memory_buffer< OST, El >::max_size ( ) const
inlinenoexcept
Returns
The size of the buffer in number of items.

Definition at line 154 of file memory_buffer.hpp.

◆ operator=() [1/2]

template<class OST, class El>
void jmmcg::heap::memory_buffer< OST, El >::operator= ( memory_buffer< OST, El > &&  )
delete

◆ operator=() [2/2]

template<class OST, class El>
void jmmcg::heap::memory_buffer< OST, El >::operator= ( memory_buffer< OST, El > const &  )
delete

Friends And Related Function Documentation

◆ operator<<

template<class OST, class El>
tostream& __fastcall operator<< ( tostream os,
memory_buffer< OST, El > const &  t 
)
friend
Todo:
Implement using the advice given in "Standard C++ IOStreams and Locales" by A.Langer & K.Kreft, page 170.

Definition at line 162 of file memory_buffer.hpp.


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