MySQL  8.0.21
Source Code Documentation
aligned_array_pointer< T_Type, T_Align_to > Class Template Reference

Manages an array of objects. More...

#include <ut0new.h>

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

Public Member Functions

void create (size_t size)
 Allocates aligned memory for new objects. More...
 
void destroy ()
 Deallocates memory of array created earlier. More...
 
T_Type & operator[] (size_t index) const
 Accesses specified index in the allocated array. More...
 
- Public Member Functions inherited from aligned_memory< T_Type, T_Align_to >
virtual ~aligned_memory ()
 
 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...
 

Private Attributes

size_t m_size
 Size of the allocated array. More...
 

Additional Inherited Members

- Protected Member Functions inherited from aligned_memory< T_Type, T_Align_to >
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...
 

Detailed Description

template<typename T_Type, size_t T_Align_to = ut::INNODB_CACHE_LINE_SIZE>
class aligned_array_pointer< T_Type, T_Align_to >

Manages an array of objects.

The first element 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

Member Function Documentation

◆ create()

template<typename T_Type, size_t T_Align_to = ut::INNODB_CACHE_LINE_SIZE>
void aligned_array_pointer< T_Type, T_Align_to >::create ( size_t  size)
inline

Allocates aligned memory for new objects.

Objects must be trivially constructible and destructible.

Parameters
[in]sizeNumber of elements to allocate.

◆ destroy()

template<typename T_Type, size_t T_Align_to = ut::INNODB_CACHE_LINE_SIZE>
void aligned_array_pointer< T_Type, T_Align_to >::destroy ( )
inlinevirtual

Deallocates memory of array created earlier.

Implements aligned_memory< T_Type, T_Align_to >.

◆ operator[]()

template<typename T_Type, size_t T_Align_to = ut::INNODB_CACHE_LINE_SIZE>
T_Type& aligned_array_pointer< T_Type, T_Align_to >::operator[] ( size_t  index) const
inline

Accesses specified index in the allocated array.

Parameters
[in]indexindex of element in array to get reference to

Member Data Documentation

◆ m_size

template<typename T_Type, size_t T_Align_to = ut::INNODB_CACHE_LINE_SIZE>
size_t aligned_array_pointer< T_Type, T_Align_to >::m_size
private

Size of the allocated array.


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