MySQL  8.0.21
Source Code Documentation
aligned_memory< T_Type, T_Align_to > Class Template Referenceabstract

Abstract class to manage an object that is aligned to specified number of bytes. More...

#include <ut0new.h>

Inheritance diagram for aligned_memory< T_Type, T_Align_to >:
aligned_array_pointer< T_Type, T_Align_to > aligned_pointer< T_Type, T_Align_to >

Public Member Functions

virtual ~aligned_memory ()
 
virtual void destroy ()=0
 
 operator T_Type * () const
 Allows casting to managed objects type to use it directly. More...
 
T_Type * operator-> () const
 Allows referencing the managed object as this was a normal pointer. More...
 

Protected Member Functions

bool is_object_empty () const
 Checks if no object is currently being managed. More...
 
T_Type * allocate (size_t size)
 Allocates memory for a new object and prepares aligned address for the object. More...
 
void free_memory ()
 Releases memory used to store the object. More...
 

Private Attributes

T_Type * m_object = nullptr
 Stores pointer to aligned object memory. More...
 
void * m_memory = nullptr
 Stores pointer to memory used to allocate the object. More...
 

Detailed Description

template<typename T_Type, size_t T_Align_to>
class aligned_memory< T_Type, T_Align_to >

Abstract class to manage an object that is aligned to specified number of bytes.

Template Parameters
T_Typetype of the object that is going to be managed
T_Align_tonumber of bytes to align to

Constructor & Destructor Documentation

◆ ~aligned_memory()

template<typename T_Type, size_t T_Align_to>
virtual aligned_memory< T_Type, T_Align_to >::~aligned_memory ( )
inlinevirtual

Member Function Documentation

◆ allocate()

template<typename T_Type, size_t T_Align_to>
T_Type* aligned_memory< T_Type, T_Align_to >::allocate ( size_t  size)
inlineprotected

Allocates memory for a new object and prepares aligned address for the object.

Parameters
[in]sizeNumber of bytes to be delivered for the aligned object. Number of bytes actually allocated will be higher.

◆ destroy()

template<typename T_Type, size_t T_Align_to>
virtual void aligned_memory< T_Type, T_Align_to >::destroy ( )
pure virtual

◆ free_memory()

template<typename T_Type, size_t T_Align_to>
void aligned_memory< T_Type, T_Align_to >::free_memory ( )
inlineprotected

Releases memory used to store the object.

◆ is_object_empty()

template<typename T_Type, size_t T_Align_to>
bool aligned_memory< T_Type, T_Align_to >::is_object_empty ( ) const
inlineprotected

Checks if no object is currently being managed.

◆ operator T_Type *()

template<typename T_Type, size_t T_Align_to>
aligned_memory< T_Type, T_Align_to >::operator T_Type * ( ) const
inline

Allows casting to managed objects type to use it directly.

◆ operator->()

template<typename T_Type, size_t T_Align_to>
T_Type* aligned_memory< T_Type, T_Align_to >::operator-> ( ) const
inline

Allows referencing the managed object as this was a normal pointer.

Member Data Documentation

◆ m_memory

template<typename T_Type, size_t T_Align_to>
void* aligned_memory< T_Type, T_Align_to >::m_memory = nullptr
private

Stores pointer to memory used to allocate the object.

◆ m_object

template<typename T_Type, size_t T_Align_to>
T_Type* aligned_memory< T_Type, T_Align_to >::m_object = nullptr
private

Stores pointer to aligned object memory.


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