63 lines
1.4 KiB
C++
63 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <unordered_map>
|
|
|
|
#include "util/uix.hpp"
|
|
#include "assets/data_stores/pose_store.hpp"
|
|
|
|
namespace assets
|
|
{
|
|
|
|
class pose_prefetch_lookup
|
|
{
|
|
public:
|
|
using index_type = ztu::u32;
|
|
using directory_lookup = std::unordered_map<std::filesystem::path, index_type>;
|
|
using directory_iterator = std::pair<directory_lookup::iterator, index_type>;
|
|
using index_lookup = std::vector<index_type>;
|
|
using index_iterator = index_lookup::iterator;
|
|
using lookup_type = std::vector<pose_store::id_type>;
|
|
using iterator = lookup_type::iterator;
|
|
|
|
void emplace(
|
|
const std::filesystem::path& directory,
|
|
index_type index,
|
|
pose_store::id_type id
|
|
);
|
|
|
|
void emplace_hint_dir(
|
|
directory_iterator directory_it,
|
|
index_type index,
|
|
pose_store::id_type id
|
|
);
|
|
|
|
void emplace_hint_dir_index(
|
|
directory_iterator directory_it,
|
|
index_iterator index_it,
|
|
index_type index,
|
|
pose_store::id_type id
|
|
);
|
|
|
|
std::pair<directory_iterator, bool> find_directory(
|
|
const std::filesystem::path& directory
|
|
);
|
|
|
|
std::pair<index_iterator, pose_store::id_type> find_index(
|
|
directory_iterator directory_it,
|
|
index_type index
|
|
);
|
|
|
|
directory_iterator emplace_dir(
|
|
directory_iterator directory_it,
|
|
const std::filesystem::path& directory
|
|
);
|
|
|
|
private:
|
|
directory_lookup m_directory_lookup;
|
|
index_lookup m_directory_indices; // count before indices, indices sorted per dir
|
|
lookup_type m_pose_ids; // offset by 1
|
|
};
|
|
|
|
}
|