BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bslstl::BidirectionalNodePool< VALUE, ALLOCATOR > Class Template Reference

#include <bslstl_bidirectionalnodepool.h>

Public Types

typedef Pool::AllocatorType AllocatorType
 Alias for the allocator type defined by SimplePool.
 
typedef AllocatorTraits::size_type size_type
 Alias for the size_type of the allocator defined by SimplePool.
 

Public Member Functions

 BidirectionalNodePool (const ALLOCATOR &allocator)
 
 BidirectionalNodePool (bslmf::MovableRef< BidirectionalNodePool > original)
 
 ~BidirectionalNodePool ()=default
 
void adopt (bslmf::MovableRef< BidirectionalNodePool > pool)
 
AllocatorTypeallocator ()
 
bslalg::BidirectionalLinkcloneNode (const bslalg::BidirectionalLink &original)
 
void deleteNode (bslalg::BidirectionalLink *linkNode)
 
template<class... Args>
bslalg::BidirectionalLinkemplaceIntoNewNode (Args &&... arguments)
 
bslalg::BidirectionalLinkmoveIntoNewNode (bslalg::BidirectionalLink *original)
 
void release ()
 
void reserveNodes (size_type numNodes)
 
void swapRetainAllocators (BidirectionalNodePool &other)
 
void swapExchangeAllocators (BidirectionalNodePool &other)
 
const AllocatorTypeallocator () const
 

Detailed Description

template<class VALUE, class ALLOCATOR>
class bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >

This class provides methods for creating and destroying nodes using the appropriate allocator-traits of the (template parameter) type ALLOCATOR.

See bslstl_bidirectionalnodepool

Member Typedef Documentation

◆ AllocatorType

template<class VALUE , class ALLOCATOR >
typedef Pool::AllocatorType bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::AllocatorType

◆ size_type

template<class VALUE , class ALLOCATOR >
typedef AllocatorTraits::size_type bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::size_type

Constructor & Destructor Documentation

◆ BidirectionalNodePool() [1/2]

template<class VALUE , class ALLOCATOR >
bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::BidirectionalNodePool ( const ALLOCATOR &  allocator)
inlineexplicit

Create a BidirectionalNodePool object that will use the specified allocator to supply memory for allocated node objects. If the (template parameter) ALLOCATOR is bsl::allocator, then allocator shall be convertible to bslma::Allocator *.

◆ BidirectionalNodePool() [2/2]

template<class VALUE , class ALLOCATOR >
bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::BidirectionalNodePool ( bslmf::MovableRef< BidirectionalNodePool< VALUE, ALLOCATOR > >  original)
inline

Create a bidirectional node-pool, adopting all outstanding memory allocations associated with the specified original node-pool, that will use the allocator associated with original to supply memory for allocated node objects. original is left in a valid but unspecified state.

◆ ~BidirectionalNodePool()

template<class VALUE , class ALLOCATOR >
bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::~BidirectionalNodePool ( )
default

Destroy the memory pool maintained by this object, releasing all memory used by the nodes of the type BidirectionalNode<VALUE> in the pool. Any memory allocated for the nodesvalueattribute of the (template parameter) typeVALUEwill be leaked unless the nodes are explicitly destroyed via thedestroyNode` method.

Member Function Documentation

◆ adopt()

template<class VALUE , class ALLOCATOR >
void bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::adopt ( bslmf::MovableRef< BidirectionalNodePool< VALUE, ALLOCATOR > >  pool)
inline

Adopt all outstanding memory allocations associated with the specified node pool. The behavior is undefined unless this pool uses the same allocator as that associated with pool. The behavior is also undefined unless this pool is in the default-constructed state.

◆ allocator() [1/2]

template<class VALUE , class ALLOCATOR >
SimplePool< bslalg::BidirectionalNode< VALUE >, ALLOCATOR >::AllocatorType & bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::allocator ( )
inline

Return a reference providing modifiable access to the allocator supplying memory for the memory pool maintained by this object. The behavior is undefined if the allocator used by this object is changed with this method. Note that this method provides modifiable access to enable a client to call non-const methods on the allocator.

◆ allocator() [2/2]

template<class VALUE , class ALLOCATOR >
const SimplePool< bslalg::BidirectionalNode< VALUE >, ALLOCATOR >::AllocatorType & bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::allocator ( ) const
inline

Return a reference providing non-modifiable access to the allocator supplying memory for the memory pool maintained by this object.

◆ cloneNode()

template<class VALUE , class ALLOCATOR >
bslalg::BidirectionalLink * bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::cloneNode ( const bslalg::BidirectionalLink original)
inline

Allocate a node of the type BidirectionalNode<VALUE>, and copy-construct an object of the (template parameter) type VALUE having the same value as the specified original at the value attribute of the node. Return the address of the node. Note that the next and prev attributes of the returned node will be uninitialized.

◆ deleteNode()

template<class VALUE , class ALLOCATOR >
void bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::deleteNode ( bslalg::BidirectionalLink linkNode)

Destroy the VALUE attribute of the specified linkNode and return the memory footprint of linkNode to this pool for potential reuse. The behavior is undefined unless node refers to a bslalg::BidirectionalNode<VALUE> that was allocated by this pool.

◆ emplaceIntoNewNode()

template<class VALUE , class ALLOCATOR >
template<class... Args>
bslalg::BidirectionalLink * bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::emplaceIntoNewNode ( Args &&...  arguments)
inline

Allocate a node of the type BidirectionalNode<VALUE>, and construct in-place an object of the (template parameter) type VALUE with the specified constructor arguments. Return the address of the node. Note that the next and prev attributes of the returned node will be uninitialized.

◆ moveIntoNewNode()

template<class VALUE , class ALLOCATOR >
bslalg::BidirectionalLink * bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::moveIntoNewNode ( bslalg::BidirectionalLink original)
inline

Allocate a node of the type BidirectionalNode<VALUE>, and move-construct an object of the (template parameter) type VALUE with the (explicitly moved) value indicated by the value attribute of the specified original link. Return the address of the node. Note that the next and prev attributes of the returned node will be uninitialized. Also note that the value attribute of original is left in a valid but unspecified state.

◆ release()

template<class VALUE , class ALLOCATOR >
void bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::release ( )
inline

Relinquish all memory currently allocated with the memory pool maintained by this object.

◆ reserveNodes()

template<class VALUE , class ALLOCATOR >
void bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::reserveNodes ( size_type  numNodes)
inline

Add to this pool sufficient memory to satisfy memory requests for at least the specified numNodes before the pool replenishes. The additional memory is added irrespective of the amount of free memory when called. The behavior is undefined unless 0 < numNodes.

◆ swapExchangeAllocators()

template<class VALUE , class ALLOCATOR >
void bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::swapExchangeAllocators ( BidirectionalNodePool< VALUE, ALLOCATOR > &  other)
inline

Efficiently exchange the nodes and the allocator of this object with those of the specified other object. This method provides the no-throw exception-safety guarantee.

◆ swapRetainAllocators()

template<class VALUE , class ALLOCATOR >
void bslstl::BidirectionalNodePool< VALUE, ALLOCATOR >::swapRetainAllocators ( BidirectionalNodePool< VALUE, ALLOCATOR > &  other)
inline

Efficiently exchange the nodes of this object with those of the specified other object. This method provides the no-throw exception-safety guarantee. The behavior is undefined unless allocator() == other.allocator().


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