67 lines
1.2 KiB
C++
67 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
|
|
#include "assets/path_id_lookups.hpp"
|
|
#include "assets/data_stores/pose_list_store.hpp"
|
|
#include "assets/data/pose_list_data.hpp"
|
|
|
|
|
|
namespace assets
|
|
{
|
|
|
|
struct kitti_pose_parser
|
|
{
|
|
static constexpr auto name = std::string_view("kitti_pose");
|
|
using data_type = pose_list_data;
|
|
using store_type = pose_list_store;
|
|
using lookup_type = pose_list_id_lookup;
|
|
|
|
[[nodiscard]] std::error_code prefetch(
|
|
path_id_lookups& lookups
|
|
);
|
|
|
|
[[nodiscard]] std::error_code parse(
|
|
const path_id_lookups& lookups,
|
|
store_type& store,
|
|
bool pedantic = false
|
|
);
|
|
|
|
private:
|
|
static constexpr auto pose_filename = std::string_view{ "pose.txt" };
|
|
|
|
class parser_context
|
|
{
|
|
public:
|
|
parser_context(
|
|
store_type& m_store,
|
|
std::mutex& m_store_mutex
|
|
);
|
|
|
|
void operator()(lookup_type::const_pointer entry) noexcept;
|
|
|
|
protected:
|
|
void reset();
|
|
|
|
private:
|
|
store_type* m_store;
|
|
std::mutex* m_store_mutex;
|
|
data_type m_buffer{};
|
|
};
|
|
|
|
static std::error_code parse_file(
|
|
const std::filesystem::path& filename,
|
|
data_type &poses
|
|
);
|
|
|
|
static std::error_code parse_pose(
|
|
std::ifstream& in,
|
|
pose_data& pose
|
|
);
|
|
|
|
private:
|
|
std::vector<lookup_type::const_pointer> m_path_buffer;
|
|
};
|
|
|
|
}
|