WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
wpi::memory::joint_allocator Class Reference

A RawAllocator that uses the additional joint memory for its allocation. More...

#include <wpi/memory/joint_allocator.hpp>

Public Member Functions

template<typename T >
 joint_allocator (joint_type< T > &j) noexcept
 
 joint_allocator (const joint_allocator &other) noexcept=default
 
joint_allocatoroperator= (const joint_allocator &other) noexcept=default
 
void * allocate_node (std::size_t size, std::size_t alignment)
 
void deallocate_node (void *ptr, std::size_t size, std::size_t) noexcept
 

Friends

bool operator== (const joint_allocator &lhs, const joint_allocator &rhs) noexcept
 

Detailed Description

A RawAllocator that uses the additional joint memory for its allocation.

It is somewhat limited and allows only allocation once. All joint allocators for an object share the joint memory and must not be used in multiple threads. The memory it returns is owned by a joint_ptr and will be destroyed through it.

Constructor & Destructor Documentation

◆ joint_allocator() [1/2]

template<typename T >
wpi::memory::joint_allocator::joint_allocator ( joint_type< T > & j)
inlinenoexcept
Effects:
Creates it using the joint memory of the given object.

◆ joint_allocator() [2/2]

wpi::memory::joint_allocator::joint_allocator ( const joint_allocator & other)
defaultnoexcept

Member Function Documentation

◆ allocate_node()

void * wpi::memory::joint_allocator::allocate_node ( std::size_t size,
std::size_t alignment )
inline
Effects:
Allocates a node with given properties.
Returns:
A pointer to the new node.
Throws:
out_of_fixed_memory exception if this function has been called for a second time or the joint memory block is exhausted.

◆ deallocate_node()

void wpi::memory::joint_allocator::deallocate_node ( void * ptr,
std::size_t size,
std::size_t  )
inlinenoexcept
Effects:
Deallocates the node, if possible.
Note
It is only possible if it was the last allocation.

◆ operator=()

joint_allocator & wpi::memory::joint_allocator::operator= ( const joint_allocator & other)
defaultnoexcept

Friends And Related Symbol Documentation

◆ operator==

bool operator== ( const joint_allocator & lhs,
const joint_allocator & rhs )
friend

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