19#include <hibf/layout/prefixes.hpp>
29namespace seqan::hibf::layout
42 friend auto operator<=>(
max_bin const &,
max_bin const &) =
default;
45 template <
typename stream_type>
47 friend stream_type & operator<<(stream_type & stream,
max_bin const &
object)
49 stream << prefix::layout_header << prefix::layout_lower_level <<
'_';
50 auto it =
object.previous_TB_indices.
begin();
51 auto end =
object.previous_TB_indices.end();
59 stream <<
" " << prefix::layout_fullest_technical_bin_idx <<
object.id;
68 size_t storage_TB_id{};
69 size_t number_of_technical_bins{};
75 template <
typename stream_type>
77 friend stream_type & operator<<(stream_type & stream,
user_bin const &
object)
79 stream <<
object.idx <<
'\t';
80 for (
auto bin :
object.previous_TB_indices)
82 stream <<
object.storage_TB_id <<
'\t';
83 for ([[maybe_unused]]
auto && elem :
object.previous_TB_indices)
85 stream <<
object.number_of_technical_bins;
158 template <
typename stream_type, std::same_as<diagnostic> diagnostic_t>
160 friend stream_type &
operator<<(stream_type & stream, diagnostic_t
const &
object)
231 size_t top_level_max_bin_id{};
235 bool operator==(layout
const &)
const =
default;
254 template <
typename parse_context_t>
259 throw std::format_error{
"seqan::hibf::layout::layout::diagnostic does not support format specifications."};
266 template <
typename format_context_t>
270 if (diagnostic.
level > severity::error)
271 throw std::format_error{
"Invalid seqan::hibf::layout::layout::diagnostic::severity."};
275 "[HIBF LAYOUT {}] {}",
The configuration used to build an (H)IBF.
Definition config.hpp:76
A finding of seqan::hibf::layout::layout::validate.
Definition layout.hpp:112
code
The kind of finding. The errors are listed roughly in the order the checks are run.
Definition layout.hpp:123
@ user_bin_out_of_range
A user bin index is not below config.number_of_user_bins.
@ duplicate_max_bin
max_bins contains more than one entry for an IBF.
@ invalid_max_bin
A max bin is neither a merged bin nor a user bin's first technical bin.
@ empty_technical_bins
An IBF has empty technical bins between its used technical bins.
@ empty_layout
The layout contains no user bins.
@ missing_user_bin
A user bin index is missing from the layout.
@ unexpected_empty_bins
An IBF does not end with the empty TBs config.empty_bin_fraction implies.
@ overlapping_technical_bins
Within an IBF, a technical bin is used more than once.
@ missing_max_bin
max_bins contains no entry for a lower-level IBF.
@ technical_bin_overflow
An IBF would have more than 2^64 - 64 technical bins.
@ technical_bin_exceeds_tmax
An IBF, with its empty bins, exceeds next_multiple_of_64(tmax) TBs.
@ max_bin_without_ibf
max_bins contains an entry for an IBF that does not exist.
@ top_level_max_bin_entry
max_bins contains an entry for the top-level IBF.
@ max_bin_exceeds_root
A max bin spans more than next_multiple_of_64(#TBs of the Root-IBF) TBs.
@ no_technical_bins
A user bin occupies zero technical bins.
@ single_bin_ibf
A lower-level IBF only contains a single user bin or merged bin.
@ duplicate_user_bin
A user bin index occurs more than once.
code what
Definition layout.hpp:147
std::optional< size_t > technical_bin
The affected technical bin of ibf, if any.
Definition layout.hpp:151
severity
How grave a finding is.
Definition layout.hpp:115
std::optional< std::vector< size_t > > ibf
The merged bins on the path to the affected IBF, empty for the Root-IBF. std::nullopt: no IBF.
Definition layout.hpp:149
friend stream_type & operator<<(stream_type &stream, diagnostic_t const &object)
Prints [HIBF LAYOUT <SEVERITY>] <message>, like std::format("{}", object).
Definition layout.hpp:160
std::string message
A human-readable description.
Definition layout.hpp:152
severity level
How grave the finding is.
Definition layout.hpp:146
The layout.
Definition layout.hpp:36
static void throw_on_error(diagnostic const &finding)
The default diagnostic handler of seqan::hibf::layout::layout::validate.
size_t number_of_levels() const
Returns the number of levels of the described HIBF.
bool validate(config const &config, diagnostic_handler const &handler=throw_on_error) const
Checks whether the layout describes a consistent HIBF for the given configuration.