dip::ExternalInterface that allocates aligned data.
The class is designed as a singleton:
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
alignment, and returns an aligned pointer within that oversized block.
- Support for external interfaces.
- 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
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.
alignmentis in bytes.