Raptor
A fast and space-efficient pre-filter
All Classes Namespaces Files Functions Variables Macros Pages Concepts
load_index.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <chrono>
13#include <fstream>
14
16#include <raptor/index.hpp>
17
18namespace raptor
19{
20
21namespace detail
22{
23
24template <typename index_t>
25void load_index(index_t & index, std::filesystem::path const & path)
26{
27 std::ifstream is{path, std::ios::binary};
28 cereal::BinaryInputArchive iarchive{is};
29
30 iarchive(index);
31}
32
33} // namespace detail
34
35template <typename index_t>
36void load_index(index_t & index, search_arguments const & arguments, size_t const part)
37{
38 std::filesystem::path index_file{arguments.index_file};
39 index_file += "_" + std::to_string(part);
40 arguments.load_index_timer.start();
41 detail::load_index(index, index_file);
42 arguments.load_index_timer.stop();
43}
44
45template <typename index_t>
46void load_index(index_t & index, search_arguments const & arguments)
47{
48 arguments.load_index_timer.start();
49 detail::load_index(index, arguments.index_file);
50 arguments.load_index_timer.stop();
51}
52
53} // namespace raptor
Provides raptor::raptor_index.
Provides raptor::search_arguments.
T to_string(T... args)
Hide me