40 lines
1.1 KiB
C++
40 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <optional>
|
|
#include <tuple>
|
|
|
|
#include "assets/dynamic_data_stores/dynamic_point_cloud_store.hpp"
|
|
#include "util/uix.hpp"
|
|
#include "util/string_lookup.hpp"
|
|
#include "util/id_type.hpp"
|
|
#include "util/result.hpp"
|
|
|
|
template<typename C, class... Loaders>
|
|
class base_dynamic_loader
|
|
{
|
|
public:
|
|
using loader_id_type = ztu::id_type_for<base_dynamic_loader, ztu::u32>;
|
|
|
|
explicit base_dynamic_loader(C enabled_components);
|
|
|
|
[[nodiscard]] std::optional<loader_id_type> find_loader(std::string_view name);
|
|
|
|
[[nodiscard]] static consteval std::optional<loader_id_type> find_loader_static(std::string_view name);
|
|
|
|
template<loader_id_type ID>
|
|
auto& get_loader();
|
|
|
|
protected:
|
|
|
|
template<typename F>
|
|
ztu::result<dynamic_point_cloud_store::id_type> invoke_with_matching_loader(loader_id_type loader_id, F&& f);
|
|
|
|
std::tuple<Loaders...> m_loaders{};
|
|
ztu::string_lookup<loader_id_type> m_loader_id_lookup{};
|
|
C m_enabled_components{ 0 };
|
|
};
|
|
|
|
#define INCLUDE_BASE_DYNAMIC_LOADER_IMPLEMENTATION
|
|
#include "assets/dynamic_data_loaders/generic/base_dynamic_loader.ipp"
|
|
#undef INCLUDE_BASE_DYNAMIC_LOADER_IMPLEMENTATION
|