MySQL 9.1.0
Source Code Documentation
ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type > Struct Template Reference

Memory layout representation of metadata segment guaranteed by the inner workings of Aligned_alloc_impl. More...

#include <aligned_alloc.h>

Public Types

using meta_1_t = Meta_1_type
 Convenience types that we will be using to serialize necessary details into the metadata segment. More...
 
using meta_2_t = Meta_2_type
 
using unaligned_meta_2_t = meta_2_t
 

Static Public Member Functions

static void meta_1 (Aligned_alloc_impl::data_segment_ptr data, std::size_t meta_1_v) noexcept
 Bail out if we cannot fit the requested data size. More...
 
static void meta_2 (Aligned_alloc_impl::data_segment_ptr data, std::size_t meta_2_v) noexcept
 Helper function which stores user-provided detail into the META_2 field. More...
 
static meta_1_t meta_1 (Aligned_alloc_impl::data_segment_ptr data) noexcept
 Helper function which recovers the information user previously stored in META_1 field. More...
 
static meta_2_t meta_2 (Aligned_alloc_impl::data_segment_ptr data) noexcept
 Helper function which recovers the information user previously stored in META_2 field. More...
 

Static Public Attributes

static constexpr auto allocator_metadata_size
 Metadata size. More...
 
static constexpr auto max_metadata_size = Aligned_alloc_impl::metadata_size
 Max metadata size. More...
 

Static Private Member Functions

static meta_1_tptr_to_meta_1 (Aligned_alloc_impl::data_segment_ptr data) noexcept
 Helper accessor function to metadata (offset). More...
 
static unaligned_meta_2_tptr_to_meta_2 (Aligned_alloc_impl::data_segment_ptr data) noexcept
 Helper accessor function to metadata (data length). More...
 

Detailed Description

template<typename Meta_1_type, typename Meta_2_type>
struct ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >

Memory layout representation of metadata segment guaranteed by the inner workings of Aligned_alloc_impl.


| VARLEN | ALIGNED-ALLOC-META | ... DATA ... |

^ ^ | | | | | ptr returned by Aligned_alloc_impl

|

| META_2 | META_1 |

\ \ 0 \ \ alignof(max_align_t) - 1

VARLEN and ALIGNED-ALLOC-META are direct byproduct of Aligned_alloc_impl layout and guarantees.

VARLEN is the leftover variable-length segment that specialized implementations can further make use of by deducing its size from returned offset. Not used by this implementation.

ALIGNED-ALLOC-META is the segment which this abstraction is about. It can hold up to sizeof(META_1) + sizeof(META_2) bytes which is, due to Aligned_alloc_impl guarantees, at most alignof(max_align_t) bytes large. Providing larger data than supported is not possible and it is guarded through the means of static_assert. META_1 and META_2 fields can be arbitrarily sized meaning that they can even be of different sizes each.

DATA is an actual segment which will keep the user data.

Member Typedef Documentation

◆ meta_1_t

template<typename Meta_1_type , typename Meta_2_type >
using ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::meta_1_t = Meta_1_type

Convenience types that we will be using to serialize necessary details into the metadata segment.

◆ meta_2_t

template<typename Meta_1_type , typename Meta_2_type >
using ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::meta_2_t = Meta_2_type

◆ unaligned_meta_2_t

template<typename Meta_1_type , typename Meta_2_type >
using ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::unaligned_meta_2_t = meta_2_t

Member Function Documentation

◆ meta_1() [1/2]

template<typename Meta_1_type , typename Meta_2_type >
static meta_1_t ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::meta_1 ( Aligned_alloc_impl::data_segment_ptr  data)
inlinestaticnoexcept

Helper function which recovers the information user previously stored in META_1 field.

◆ meta_1() [2/2]

template<typename Meta_1_type , typename Meta_2_type >
static void ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::meta_1 ( Aligned_alloc_impl::data_segment_ptr  data,
std::size_t  meta_1_v 
)
inlinestaticnoexcept

Bail out if we cannot fit the requested data size.

Helper function which stores user-provided detail into the META_1 field.

◆ meta_2() [1/2]

template<typename Meta_1_type , typename Meta_2_type >
static meta_2_t ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::meta_2 ( Aligned_alloc_impl::data_segment_ptr  data)
inlinestaticnoexcept

Helper function which recovers the information user previously stored in META_2 field.

◆ meta_2() [2/2]

template<typename Meta_1_type , typename Meta_2_type >
static void ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::meta_2 ( Aligned_alloc_impl::data_segment_ptr  data,
std::size_t  meta_2_v 
)
inlinestaticnoexcept

Helper function which stores user-provided detail into the META_2 field.

◆ ptr_to_meta_1()

template<typename Meta_1_type , typename Meta_2_type >
static meta_1_t * ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::ptr_to_meta_1 ( Aligned_alloc_impl::data_segment_ptr  data)
inlinestaticprivatenoexcept

Helper accessor function to metadata (offset).

◆ ptr_to_meta_2()

template<typename Meta_1_type , typename Meta_2_type >
static unaligned_meta_2_t * ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::ptr_to_meta_2 ( Aligned_alloc_impl::data_segment_ptr  data)
inlinestaticprivatenoexcept

Helper accessor function to metadata (data length).

Member Data Documentation

◆ allocator_metadata_size

template<typename Meta_1_type , typename Meta_2_type >
constexpr auto ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::allocator_metadata_size
staticconstexpr
Initial value:
=
sizeof(meta_1_t) + sizeof(meta_2_t)
Meta_1_type meta_1_t
Convenience types that we will be using to serialize necessary details into the metadata segment.
Definition: aligned_alloc.h:279
Meta_2_type meta_2_t
Definition: aligned_alloc.h:280

Metadata size.

◆ max_metadata_size

template<typename Meta_1_type , typename Meta_2_type >
constexpr auto ut::detail::Aligned_alloc_metadata< Meta_1_type, Meta_2_type >::max_metadata_size = Aligned_alloc_impl::metadata_size
staticconstexpr

Max metadata size.


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