BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION > Class Template Reference

#include <bdlma_localbufferedobject.h>

Public Types

enum  { k_BUFFER_SIZE = t_BUFFER_SIZE }
 
typedef t_TYPE value_type
 
typedef bsl::allocator allocator_type
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (LocalBufferedObject, BloombergLP::bslmf::UsesAllocatorArgT)
 
template<class... ARGS>
 LocalBufferedObject (BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args)
 
template<class... ARGS>
 LocalBufferedObject (bsl::allocator_arg_t, allocator_type allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args)
 
 ~LocalBufferedObject ()
 
template<class t_ANY_TYPE >
bsl::enable_if< BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE(t_TYPE, BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)), LocalBufferedObject >::type & operator= (BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE) value)
 Assign the object held by this container to the specified value.
 
value_typeoperator-> ()
 
value_typeoperator* ()
 
template<class... ARGS>
void emplace (BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args)
 
const value_typeoperator-> () const
 
const value_typeoperator* () const
 
allocator_type get_allocator () const
 
template<class... ARGS>
 LocalBufferedObject (bsl::allocator_arg_t, bsl::allocator<> allocator, BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)... args)
 

Detailed Description

template<class t_TYPE, bsl::size_t t_BUFFER_SIZE = 1024, bool t_DISABLE_DESTRUCTION = false>
class bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >

This class contains an object of type t_TYPE and a local sequential allocator with an arena size of t_BUFFER_SIZE, from which the t_TYPE object allocates memory, in a single object. The t_DISABLE_DESTRUCTION template parameter can be used to prevent this class from calling ~t_TYPE() in cases where it is known that t_TYPE manages no resources other than memory, since the memory will be adequately managed by the local sequential allocator.

See bdlma_localbufferedobject

Member Typedef Documentation

◆ allocator_type

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE = 1024, bool t_DISABLE_DESTRUCTION = false>
typedef bsl::allocator bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::allocator_type

◆ value_type

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE = 1024, bool t_DISABLE_DESTRUCTION = false>
typedef t_TYPE bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::value_type

Member Enumeration Documentation

◆ anonymous enum

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE = 1024, bool t_DISABLE_DESTRUCTION = false>
anonymous enum
Enumerator
k_BUFFER_SIZE 

Constructor & Destructor Documentation

◆ LocalBufferedObject() [1/3]

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
template<class... ARGS>
bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::LocalBufferedObject ( BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)...  args)
inlineexplicit

Create a value_type object using the specified args that will allocate memory from a sequential allocator based on a local stack buffer of (template parameter) t_BUFFER_SIZE size; if local stack memory is exhausted, use the default allocator to supply additional heap memory.

◆ LocalBufferedObject() [2/3]

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE = 1024, bool t_DISABLE_DESTRUCTION = false>
template<class... ARGS>
bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::LocalBufferedObject ( bsl::allocator_arg_t  ,
allocator_type  allocator,
BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)...  args 
)

Create a value_type object using the specified args that will allocate memory from a sequential allocator based on a local stack buffer of (template parameter) t_BUFFER_SIZE size; if local stack memory is exhausted, use the specified allocator to supply additional heap memory.

◆ ~LocalBufferedObject()

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::~LocalBufferedObject ( )
inline

Destroy this object and free any memory it uses, and if the (template parameter) t_DISABLE_DESTRUCTION is true, do this without calling the destructor of value_type (see t_DISABLE_DESTRUCTION template parameter in the component doc).

◆ LocalBufferedObject() [3/3]

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE = 1024, bool t_DISABLE_DESTRUCTION = false>
template<class... ARGS>
bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::LocalBufferedObject ( bsl::allocator_arg_t  ,
bsl::allocator<>  allocator,
BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)...  args 
)
inline

Member Function Documentation

◆ BSLMF_NESTED_TRAIT_DECLARATION()

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE = 1024, bool t_DISABLE_DESTRUCTION = false>
bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::BSLMF_NESTED_TRAIT_DECLARATION ( LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >  ,
BloombergLP::bslmf::UsesAllocatorArgT   
)

◆ emplace()

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
template<class... ARGS>
void bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::emplace ( BSLS_COMPILERFEATURES_FORWARD_REF(ARGS)...  args)

Destroy the value_type object unless t_DISABLE_DESTRUCTION is true, then release all allocated memory, the re-construct a new value_type object using the specified args and using the sequential allocator based on the local stack buffer.

◆ get_allocator()

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
bsl::allocator bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::get_allocator ( ) const
inline

Return the alloctor passed at construction, used to provide heap memory after the local stack buffer is exhausted. Note that this is not the arena allocator contained in this object.

◆ operator*() [1/2]

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
t_TYPE & bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::operator* ( )
inline

Return a reference providing modifiable access to the underlying t_TYPE object.

◆ operator*() [2/2]

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
const t_TYPE & bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::operator* ( ) const
inline

Return a reference providing const access to the underlying t_TYPE object.

◆ operator->() [1/2]

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
t_TYPE * bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::operator-> ( )
inline

Return a pointer providing modifiable access to the underlying t_TYPE object.

◆ operator->() [2/2]

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
const t_TYPE * bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::operator-> ( ) const
inline

Return a pointer providing const access to the underlying t_TYPE object.

◆ operator=()

template<class t_TYPE , bsl::size_t t_BUFFER_SIZE, bool t_DISABLE_DESTRUCTION>
template<class t_ANY_TYPE >
bsl::enable_if< BDLMA_LOCAL_BUFFERED_VALUE_IS_ASSIGNABLE(t_TYPE, BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)), LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION > >::type & bdlma::LocalBufferedObject< t_TYPE, t_BUFFER_SIZE, t_DISABLE_DESTRUCTION >::operator= ( BSLS_COMPILERFEATURES_FORWARD_REF(t_ANY_TYPE)  value)

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