namespace axl::mem

namespace mem {

// typedefs

typedef DirectAllocator StdAllocator;
typedef ZeroAllocator StdZeroAllocator;
typedef Allocate<DirectAllocator> StdAllocate;
typedef Allocate<ZeroAllocator> StdZeroAllocate;
typedef Free<DirectAllocator> StdFree;

// structs

struct Block;
struct TrackerBlockHdr;

// classes

template <typename BaseAllocator>
class Allocate;

template <typename T>
class CppDelete;

class DirectAllocator;

template <typename T>
class ExecutableBlockArena;

template <typename BaseAllocator>
class Free;

template <typename T>
class Pool;

template <typename T>
class StdDelete;

class Tracker;

template <typename BaseAllocator>
class TrackingAllocate;

template <typename BaseAllocator>
class TrackingAllocator;

template <typename BaseAllocator>
class TrackingFree;

class ZeroAllocator;

// global functions

void*
allocateExecutablePages(size_t size);

bool
freeExecutablePages(
    void* p,
    size_t size
    );

template <typename T>
void
stdDelete(T* p);

size_t
getScatterGatherSize(
    const Block* blockArray,
    size_t blockCount
    );

size_t
copyScatterGather(
    void* buffer,
    const Block* blockArray,
    size_t blockCount
    );

size_t
safeCopyScatterGather(
    void* buffer,
    size_t bufferSize,
    const Block* blockArray,
    size_t blockCount
    );

void
addTrackerBlock(TrackerBlockHdr* hdr);

void
removeTrackerBlock(TrackerBlockHdr* hdr);

} // namespace mem