rippled
Public Member Functions | Public Attributes | List of all members
ripple::SlabAllocator< Type >::SlabBlock Struct Reference

A block of memory that is owned by a slab allocator. More...

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

Public Member Functions

 SlabBlock (SlabBlock *next, std::uint8_t *data, std::size_t size, std::size_t item)
 
 ~SlabBlock ()
 
 SlabBlock (SlabBlock const &other)=delete
 
SlabBlockoperator= (SlabBlock const &other)=delete
 
 SlabBlock (SlabBlock &&other)=delete
 
SlabBlockoperator= (SlabBlock &&other)=delete
 
bool own (std::uint8_t const *p) const noexcept
 Determines whether the given pointer belongs to this allocator. More...
 
std::uint8_tallocate () noexcept
 
void deallocate (std::uint8_t *ptr) noexcept
 Return an item to this allocator's freelist. More...
 

Public Attributes

std::mutex m_
 
std::uint8_tl_ = nullptr
 
SlabBlocknext_
 
std::uint8_t const *const p_ = nullptr
 
const std::size_t size_
 

Detailed Description

template<typename Type>
struct ripple::SlabAllocator< Type >::SlabBlock

A block of memory that is owned by a slab allocator.

Definition at line 52 of file SlabAllocator.h.

Constructor & Destructor Documentation

◆ SlabBlock() [1/3]

template<typename Type >
ripple::SlabAllocator< Type >::SlabBlock::SlabBlock ( SlabBlock next,
std::uint8_t data,
std::size_t  size,
std::size_t  item 
)

Definition at line 69 of file SlabAllocator.h.

◆ ~SlabBlock()

template<typename Type >
ripple::SlabAllocator< Type >::SlabBlock::~SlabBlock ( )

Definition at line 89 of file SlabAllocator.h.

◆ SlabBlock() [2/3]

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

◆ SlabBlock() [3/3]

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

Member Function Documentation

◆ operator=() [1/2]

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

◆ operator=() [2/2]

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

◆ own()

template<typename Type >
bool ripple::SlabAllocator< Type >::SlabBlock::own ( std::uint8_t const *  p) const
noexcept

Determines whether the given pointer belongs to this allocator.

Definition at line 106 of file SlabAllocator.h.

◆ allocate()

template<typename Type >
std::uint8_t* ripple::SlabAllocator< Type >::SlabBlock::allocate ( )
noexcept

Definition at line 112 of file SlabAllocator.h.

◆ deallocate()

template<typename Type >
void ripple::SlabAllocator< Type >::SlabBlock::deallocate ( std::uint8_t ptr)
noexcept

Return an item to this allocator's freelist.

Parameters
ptrThe pointer to the chunk of memory being deallocated.
Note
This is a dangerous, private interface; the item being returned should belong to this allocator. Debug builds will check and assert if this is not the case. Release builds will not.

Definition at line 142 of file SlabAllocator.h.

Member Data Documentation

◆ m_

template<typename Type >
std::mutex ripple::SlabAllocator< Type >::SlabBlock::m_

Definition at line 55 of file SlabAllocator.h.

◆ l_

template<typename Type >
std::uint8_t* ripple::SlabAllocator< Type >::SlabBlock::l_ = nullptr

Definition at line 58 of file SlabAllocator.h.

◆ next_

template<typename Type >
SlabBlock* ripple::SlabAllocator< Type >::SlabBlock::next_

Definition at line 61 of file SlabAllocator.h.

◆ p_

template<typename Type >
std::uint8_t const* const ripple::SlabAllocator< Type >::SlabBlock::p_ = nullptr

Definition at line 64 of file SlabAllocator.h.

◆ size_

template<typename Type >
const std::size_t ripple::SlabAllocator< Type >::SlabBlock::size_

Definition at line 67 of file SlabAllocator.h.