xrpld
Loading...
Searching...
No Matches
xrpl::SlabAllocatorSet< Type > Class Template Reference

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

#include <SlabAllocator.h>

Collaboration diagram for xrpl::SlabAllocatorSet< Type >:

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 ()=default
std::uint8_tallocate (std::size_t extra) noexcept
 Returns a suitably aligned pointer, if one is available.
bool deallocate (std::uint8_t *ptr) noexcept
 Returns the memory block to the allocator.

Private Attributes

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

Detailed Description

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

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

Definition at line 282 of file SlabAllocator.h.

Constructor & Destructor Documentation

◆ SlabAllocatorSet() [1/3]

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

Definition at line 310 of file SlabAllocator.h.

◆ SlabAllocatorSet() [2/3]

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

◆ SlabAllocatorSet() [3/3]

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

◆ ~SlabAllocatorSet()

template<typename Type>
xrpl::SlabAllocatorSet< Type >::~SlabAllocatorSet ( )
default

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ allocate()

template<typename Type>
std::uint8_t * xrpl::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 356 of file SlabAllocator.h.

◆ deallocate()

template<typename Type>
bool xrpl::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 378 of file SlabAllocator.h.

Member Data Documentation

◆ allocators_

template<typename Type>
boost::container::static_vector<SlabAllocator<Type>, 64> xrpl::SlabAllocatorSet< Type >::allocators_ {}
private

Definition at line 286 of file SlabAllocator.h.

◆ maxSize_

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

Definition at line 288 of file SlabAllocator.h.