|
HIBF 1.0.0-rc.1
|
The layout. More...
#include <hibf/layout/layout.hpp>
Classes | |
| struct | diagnostic |
| A finding of seqan::hibf::layout::layout::validate. More... | |
| struct | max_bin |
| struct | user_bin |
Public Member Functions | |
| void | clear () |
| size_t | number_of_levels () const |
| Returns the number of levels of the described HIBF. | |
| bool | operator== (layout const &) const =default |
| void | read_from (std::istream &stream) |
| void | write_to (std::ostream &stream) const |
Public Attributes | |
| std::vector< max_bin > | max_bins {} |
| size_t | top_level_max_bin_id {} |
| std::vector< user_bin > | user_bins {} |
Validation | |
| using | diagnostic_handler = std::function<void(diagnostic const &)> |
| Receives the findings of seqan::hibf::layout::layout::validate. | |
| 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. | |
| static void | throw_on_error (diagnostic const &finding) |
| The default diagnostic handler of seqan::hibf::layout::layout::validate. | |
The layout.
| using seqan::hibf::layout::layout::diagnostic_handler = std::function<void(diagnostic const &)> |
Receives the findings of seqan::hibf::layout::layout::validate.
The handler is called once per finding, in the order the checks run. Checking stops at the first error, so a handler receives at most one error, and warnings and notes only if there is no error. A handler may throw to abort the check; the layout is not modified.
seqan::hibf::layout::layout::validate uses seqan::hibf::layout::layout::throw_on_error by default. With an empty handler, it reports nothing and only returns whether the layout is valid.
seqan::hibf::layout::layout::throw_on_error only uses seqan::hibf::layout::layout::diagnostic::level and seqan::hibf::layout::layout::diagnostic::message. The other members are meant for user-defined handlers, for example, to filter by seqan::hibf::layout::layout::diagnostic::code or to locate the affected IBF.
Collect all findings:
Print all findings:
Ignore a kind of finding:
Treat warnings as errors:
Locate the affected IBF, user bin and technical bin:
| size_t seqan::hibf::layout::layout::number_of_levels | ( | ) | const |
Returns the number of levels of the described HIBF.
0 if there are no user bins, 1 if there is only the top-level IBF, and so on.Only the user bins are considered.
|
static |
The default diagnostic handler of seqan::hibf::layout::layout::validate.
| [in] | finding | The finding to handle. |
| std::invalid_argument | if finding is an error. The description is std::format("{}", finding). |
Prints warnings to std::cerr. Prints notes to std::cerr in debug builds of the library (without NDEBUG).
| bool seqan::hibf::layout::layout::validate | ( | config const & | config, |
| diagnostic_handler const & | handler = throw_on_error ) const |
Checks whether the layout describes a consistent HIBF for the given configuration.
| [in] | config | The configuration the layout was or will be used with. |
| [in] | handler | Called for each finding. May be empty. |
true if there is no error, false otherwise. | std::invalid_argument | describing the first error, if handler is the default, seqan::hibf::layout::layout::throw_on_error. |
The layout must contain each user bin index in [0, config.number_of_user_bins) exactly once. The user bins may be in any order.
The errors are checked first, roughly in the order of seqan::hibf::layout::layout::diagnostic::code. Checking stops at the first error. Warnings and notes are only reported if there is no error. They are reported per IBF, so a note about one IBF may precede a warning about another IBF. The build rounds the technical bins of each IBF, plus the empty bins for config.empty_bin_fraction, up to a multiple of 64. This number is compared to config.tmax, unless config.tmax is 0. The technical bins after the last used technical bin must be exactly the empty bins config.empty_bin_fraction implies, i.e., none if it is 0.