/*
 * Copyright (C) 2025-2026 Intel Corporation
 *
 * SPDX-License-Identifier: MIT
 *
 */

#include "shared/source/utilities/pool_allocators.h"

#include "shared/source/helpers/non_copyable_or_moveable.h"
#include "shared/source/utilities/generic_pool_allocator.inl"

#include <type_traits>

namespace NEO {

#define INSTANTIATE_POOL_ALLOCATOR(Traits)                                                                                                                    \
    static_assert(std::is_nothrow_move_constructible_v<GenericPool<Traits>>, "Pools live in std::vector and have a deleted copy ctor, so vector reallocation" \
                                                                             "requires a noexcept move ctor - otherwise it fails to compile.");               \
    static_assert(NEO::NonCopyable<GenericPool<Traits>>);                                                                                                     \
    template class AbstractBuffersAllocator<GenericPool<Traits>, GraphicsAllocation>;                                                                         \
    template class GenericPoolAllocator<Traits>

INSTANTIATE_POOL_ALLOCATOR(TimestampPoolTraits);
INSTANTIATE_POOL_ALLOCATOR(GlobalSurfacePoolTraits);
INSTANTIATE_POOL_ALLOCATOR(ConstantSurfacePoolTraits);

#undef INSTANTIATE_POOL_ALLOCATOR

#define INSTANTIATE_VIEW_POOL_ALLOCATOR(Traits)                                                                                                                   \
    static_assert(std::is_nothrow_move_constructible_v<GenericViewPool<Traits>>, "Pools live in std::vector and have a deleted copy ctor, so vector reallocation" \
                                                                                 "requires a noexcept move ctor - otherwise it fails to compile.");               \
    static_assert(NEO::NonCopyable<GenericViewPool<Traits>>);                                                                                                     \
    template class AbstractBuffersAllocator<GenericViewPool<Traits>, GraphicsAllocation>;                                                                         \
    template class GenericViewPoolAllocator<Traits>

INSTANTIATE_VIEW_POOL_ALLOCATOR(CommandBufferPoolTraits);
INSTANTIATE_VIEW_POOL_ALLOCATOR(LinearStreamPoolTraits);
INSTANTIATE_VIEW_POOL_ALLOCATOR(InternalHeapPoolTraits);

#undef INSTANTIATE_VIEW_POOL_ALLOCATOR

} // namespace NEO
