Program Listing for File nxoc_parser.hpp

Return to documentation for file (inexor/vulkan-renderer/io/nxoc_parser.hpp)

#pragma once

#include "inexor/vulkan-renderer/io/octree_parser.hpp"

#include <cstdint>
#include <memory>
#include <utility>

// forward declaration
namespace inexor::vulkan_renderer::world {
class Cube;
} // namespace inexor::vulkan_renderer::world

// forward declaration
namespace inexor::vulkan_renderer::io {
class ByteStream;
} // namespace inexor::vulkan_renderer::io

namespace inexor::vulkan_renderer::io {

class NXOCParser : public OctreeParser {
private:
    static constexpr std::uint32_t LATEST_VERSION{0};

    template <std::size_t version>
    [[nodiscard]] ByteStream serialize_impl(std::shared_ptr<const world::Cube> cube);
    template <std::size_t version>
    [[nodiscard]] std::shared_ptr<world::Cube> deserialize_impl(const ByteStream &stream);

public:
    [[nodiscard]] ByteStream serialize(std::shared_ptr<const world::Cube> cube, std::uint32_t version) final;
    [[nodiscard]] std::shared_ptr<world::Cube> deserialize(const ByteStream &stream) final;
};
} // namespace inexor::vulkan_renderer::io