Image module
#include "diplib.h"
dip::AlignedAllocInterface class

dip::ExternalInterface that allocates aligned data.

Contents

The class is designed as a singleton: dip::AlignedAllocInterface::GetInstance returns a pointer to a unique instance. The alignment, in bytes, is passed to GetInstance as a template parameter.

For example, here we create an allocator that guarantees 64-byte alignment:

ExternalInterface* ei = dip::AlignedAllocInterface::GetInstance<64>();

Note: This interface is only suitable for allocating blocks of memory that are larger than the alignment size. Internally, the class allocates an oversized memory block padded with alignment, and returns an aligned pointer within that oversized block.

Base classes

class dip::ExternalInterface abstract
Support for external interfaces.

Functions

auto AllocateData(void*& origin, dip::DataType dataType, dip::UnsignedArray const& sizes, dip::IntegerArray& strides, dip::Tensor const& tensor, dip::sint& tensorStride) -> dip::DataSegment override
Called by dip::Image::Forge.
template<dip::uint alignment>
static auto GetInstance() -> dip::AlignedAllocInterface*
Singleton interface, templated in the alignment parameter. Only one instance is needed for each distinct alignment. alignment is in bytes.