// Copyright (C) 2022 Jérôme "Lynix" Leclercq (lynix680@gmail.com) // This file is part of the "Nazara Engine - Utility module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_UTILITY_BUFFER_HPP #define NAZARA_UTILITY_BUFFER_HPP #include #include #include #include #include namespace Nz { class Buffer; using BufferFactory = std::function(BufferType type, UInt64 size, BufferUsageFlags usage, const void* initialData)>; class NAZARA_UTILITY_API Buffer { public: inline Buffer(DataStorage storage, BufferType type, UInt64 size, BufferUsageFlags usage); Buffer(const Buffer&) = delete; Buffer(Buffer&&) = delete; virtual ~Buffer(); std::shared_ptr CopyContent(const BufferFactory& bufferFactory); virtual bool Fill(const void* data, UInt64 offset, UInt64 size) = 0; inline UInt64 GetSize() const; inline DataStorage GetStorage() const; inline BufferType GetType() const; inline BufferUsageFlags GetUsageFlags() const; virtual void* Map(UInt64 offset, UInt64 size) = 0; virtual bool Unmap() = 0; Buffer& operator=(const Buffer&) = delete; Buffer& operator=(Buffer&&) = delete; private: BufferType m_type; BufferUsageFlags m_usage; DataStorage m_storage; UInt64 m_size; }; } #include #endif // NAZARA_UTILITY_BUFFER_HPP