Raptor
4.0.0-rc.1
A fast and space-efficient pre-filter
Loading...
Searching...
No Matches
formatted_index_size.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2026 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2026 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
10
#pragma once
11
12
#include <
cassert
>
13
#include <
cstddef
>
14
#include <
filesystem
>
15
#include <
string
>
16
17
#include <
raptor/argument_parsing/formatted_bytes.hpp
>
18
19
namespace
raptor
20
{
21
22
[[nodiscard]]
inline
size_t
index_size_in_KiB(
std::filesystem::path
const
& index_path, uint8_t
const
parts)
23
{
24
size_t
index_size_in_bytes{};
25
if
(parts == 1u)
26
{
27
index_size_in_bytes =
std::filesystem::file_size
(index_path);
28
}
29
else
30
{
31
for
(
size_t
part = 0u; part < parts; ++part)
32
{
33
index_size_in_bytes +=
std::filesystem::file_size
(index_path.
string
() +
"_"
+
std::to_string
(part));
34
}
35
}
36
37
return
index_size_in_bytes >> 10;
38
}
39
40
[[nodiscard]]
inline
std::string
formatted_index_size(
std::filesystem::path
const
& index_path, uint8_t
const
parts)
41
{
42
return
formatted_bytes(index_size_in_KiB(index_path, parts) << 10);
43
}
44
45
}
// namespace raptor
std::string
cassert
cstddef
std::filesystem::file_size
T file_size(T... args)
filesystem
formatted_bytes.hpp
Provides raptor::formatted_bytes.
std::filesystem::path
string
std::to_string
T to_string(T... args)
Hide me
Version:
raptor
argument_parsing
formatted_index_size.hpp
Generated on Sat Oct 31 2026 18:12:17 for Raptor by
1.10.0