rippled
Classes | Public Member Functions | Private Attributes | List of all members
ripple::SlabAllocatorSet< Type > Class Template Reference

A collection of slab allocators of various sizes for a given type. More...

Collaboration diagram for ripple::SlabAllocatorSet< Type >:
Collaboration graph
[legend]

Classes

class  SlabConfig
 

Public Member Functions

constexpr SlabAllocatorSet (std::vector< SlabConfig > cfg)
 
 SlabAllocatorSet (SlabAllocatorSet const &other)=delete
 
SlabAllocatorSetoperator= (SlabAllocatorSet const &other)=delete
 
 SlabAllocatorSet (SlabAllocatorSet &&other)=delete
 
SlabAllocatorSetoperator= (SlabAllocatorSet &&other)=delete
 
 ~SlabAllocatorSet ()
 
std::uint8_tallocate (std::size_t extra) noexcept
 Returns a suitably aligned pointer, if one is available. More...
 
bool deallocate (std::uint8_t *ptr) noexcept
 Returns the memory block to the allocator. More...
 

Private Attributes

boost::container::static_vector< SlabAllocator< Type >, 64 > allocators_
 
std::size_t maxSize_ = 0
 

Detailed Description

template<typename Type>
class ripple::SlabAllocatorSet< Type >

A collection of slab allocators of various sizes for a given type.

Definition at line 314 of file SlabAllocator.h.

Constructor & Destructor Documentation

◆ SlabAllocatorSet() [1/3]

template<typename Type >
constexpr ripple::SlabAllocatorSet< Type >::SlabAllocatorSet ( std::vector< SlabConfig cfg)
constexpr

Definition at line 342 of file SlabAllocator.h.

◆ SlabAllocatorSet() [2/3]

template<typename Type >
ripple::SlabAllocatorSet< Type >::SlabAllocatorSet ( SlabAllocatorSet< Type > const &  other)
delete

◆ SlabAllocatorSet() [3/3]

template<typename Type >
ripple::SlabAllocatorSet< Type >::SlabAllocatorSet ( SlabAllocatorSet< Type > &&  other)
delete

◆ ~SlabAllocatorSet()

template<typename Type >
ripple::SlabAllocatorSet< Type >::~SlabAllocatorSet ( )

Definition at line 383 of file SlabAllocator.h.

Member Function Documentation

◆ operator=() [1/2]

template<typename Type >
SlabAllocatorSet& ripple::SlabAllocatorSet< Type >::operator= ( SlabAllocatorSet< Type > const &  other)
delete

◆ operator=() [2/2]

template<typename Type >
SlabAllocatorSet& ripple::SlabAllocatorSet< Type >::operator= ( SlabAllocatorSet< Type > &&  other)
delete

◆ allocate()

template<typename Type >
std::uint8_t* ripple::SlabAllocatorSet< Type >::allocate ( std::size_t  extra)
noexcept

Returns a suitably aligned pointer, if one is available.

Parameters
extraThe number of extra bytes, above and beyond the size of the object, that should be returned by the allocator.
Returns
a pointer to a block of memory, or nullptr if the allocator can't satisfy this request.

Definition at line 396 of file SlabAllocator.h.

◆ deallocate()

template<typename Type >
bool ripple::SlabAllocatorSet< Type >::deallocate ( std::uint8_t ptr)
noexcept

Returns the memory block to the allocator.

Parameters
ptrA pointer to a memory block.
Returns
true if this memory block belonged to one of the allocators in this set and has been released; false otherwise.

Definition at line 418 of file SlabAllocator.h.

Member Data Documentation

◆ allocators_

template<typename Type >
boost::container::static_vector<SlabAllocator<Type>, 64> ripple::SlabAllocatorSet< Type >::allocators_
private

Definition at line 318 of file SlabAllocator.h.

◆ maxSize_

template<typename Type >
std::size_t ripple::SlabAllocatorSet< Type >::maxSize_ = 0
private

Definition at line 320 of file SlabAllocator.h.