A "pretty printer" for most SeqAn data structures and related types. More...
#include <seqan3/core/detail/debug_stream_type.hpp>
Public Types | |
| using | fmtflags = decltype(std::declval< std::basic_ostream< char_t > >().flags()) |
| This type is std::ios_base::fmtflags. | |
Public Member Functions | |
Constructor, destructor and assignment. | |
The standard functions are explicitly defaulted. | |
| debug_stream_type ()=default | |
| Defaulted. | |
| debug_stream_type (debug_stream_type const &)=default | |
| Defaulted. | |
| debug_stream_type (debug_stream_type &&)=default | |
| Defaulted. | |
| debug_stream_type & | operator= (debug_stream_type const &)=default |
| Defaulted. | |
| debug_stream_type & | operator= (debug_stream_type &&)=default |
| Defaulted. | |
| ~debug_stream_type ()=default | |
| Defaulted. | |
| constexpr | debug_stream_type (std::basic_ostream< char_t > &out) |
| Construction from an output stream. | |
Miscelleneous | |
| void | set_underlying_stream (std::basic_ostream< char_t > &out) |
| Change the underlying output stream. More... | |
Format flags (std::ios_base::fmtflags) | |
std::ios_base::fmtflags that modify the stream's behaviour. | |
| fmtflags | flags () const |
| Retrieve the format flags from the stream. | |
| fmtflags | flags (fmtflags const flgs) |
| Replace the current flags on the stream with the given argument. | |
| void | setf (fmtflags const flag) |
| Set the format flag(s) on the stream (current flags are ORed with the argument). | |
| void | unsetf (fmtflags const flag) |
| Unset the format flag(s) on the stream. | |
| debug_stream_type & | operator<< (fmtflags const flag) |
| Set the format flag(s) on the stream (current flags are ORed with the argument). | |
Format flags (seqan3::fmtflags2) | |
SeqAn specific debug flags for the debug stream. | |
| fmtflags2 | flags2 () const |
| Retrieve the format flags from the stream. | |
| fmtflags2 | flags2 (fmtflags2 flgs) |
| Replace the current flags on the stream with the given argument. | |
| void | setf (fmtflags2 const flag) |
| Set the format flag(s) on the stream (current flags are ORed with the argument). | |
| void | unsetf (fmtflags2 const flag) |
| Unset the format flag(s) on the stream. | |
| debug_stream_type & | operator<< (fmtflags2 const flag) |
| Set the format flag(s) on the stream (current flags are ORed with the argument). | |
Related Functions | |
(Note that these are not member functions.) | |
| template<typename char_t , detail::matrix alignment_matrix_t> | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, alignment_matrix_t &&matrix) |
| An alignment matrix can be printed to the seqan3::debug_stream. More... | |
| template<typename char_t , typename coordinate_type > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, coordinate_type &&c) |
| A seqan3::alignment_coordinate can be printed to the seqan3::debug_stream. More... | |
| template<typename char_t > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, detail::trace_directions const trace) |
| All trace_directions can be printed as ascii or as utf8 to the seqan3::debug_stream. More... | |
| template<typename char_t , typename tuple_t > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, tuple_t &&t) |
| All tuples can be printed by printing their elements separately. More... | |
| template<typename char_t , typename alignment_result_t > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &stream, alignment_result_t &&result) |
| Streams the seqan3::alignment_result to the seqan3::debug_stream. More... | |
| template<typename char_t > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &stream, sam_flag const flag) |
| Overload for the seqan3::sam_flags. More... | |
| template<typename char_t , typename search_result_t > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &stream, search_result_t &&result) |
| Print the seqan3::search_result to seqan3::debug_stream. More... | |
Formatted output overloads | |
| template<typename char_t , typename option_type > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, option_type &&op) |
| A type (e.g. an enum) can be made debug streamable by customizing the seqan3::enumeration_names. More... | |
| template<typename char_t , alphabet alphabet_t> | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, alphabet_t &&l) |
| All alphabets can be printed to the seqan3::debug_stream by their char representation. More... | |
| template<typename char_t > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, mask const l) |
| Overload for the seqan3::mask alphabet. More... | |
| template<typename char_t > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, std::nullopt_t arg) |
| Make std::nullopt_t printable. More... | |
| template<typename char_t , typename optional_type > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, optional_type &&arg) |
| A std::optional can be printed by printing its value or nothing if valueless. More... | |
| template<typename char_t , std::ranges::input_range rng_t> | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, rng_t &&r) |
| All input ranges can be printed to the seqan3::debug_stream element-wise (if their elements are printable). More... | |
| template<typename char_t , typename variant_type > | |
| debug_stream_type< char_t > & | operator<< (debug_stream_type< char_t > &s, variant_type &&v) |
| A std::variant can be printed by visiting the stream operator for the corresponding type. More... | |
Formatted output | |
| debug_stream_type & | operator<< (std::ostream &(*fp)(std::ostream &)) |
| This overloads enables forwarding std::endl and other manipulators. | |
| template<typename other_char_t , typename t > | |
| debug_stream_type< other_char_t > & | operator<< (debug_stream_type< other_char_t > &s, t &&v) |
| Forwards to the underlying stream object. | |
A "pretty printer" for most SeqAn data structures and related types.
A global instance of this type exists as seqan3::debug_stream. You can stream to it as you would to std::cout or std::cerr, but the debug stream has special overloads that make certain types streamable (that are not streamable to std::cout). Additionally some data structures are visualised more elaborately via the debug stream and there are extra flags to configure it (seqan3::fmtflags2).
Simple usage:
Changing flags:
See seqan3::fmtflags2 for more details.
|
inline |
Change the underlying output stream.
| out | Reference to the new output stream. |
The actual underlying stream that is printed to defaults to std::cerr, but can be changed via this function. You can set any kind of output stream, e.g. a std::ostringstream or a std::ofstream if you want to write to a file, but please be aware that the debug_stream never takes ownership of the underlying stream so you need to take special care that its object lifetime does not end before the debug_stream's.
In the case where you wish to print to some stream object locally, instead create you own debug stream:
|
related |
An alignment matrix can be printed to the seqan3::debug_stream.
| alignment_matrix_t | Type of the alignment matrix to be printed; must model seqan3::detail::matrix. |
| s | The seqan3::debug_stream. |
| matrix | The alignment matrix. |
This prints out an alignment matrix which can be a score matrix or a trace matrix.
|
related |
All alphabets can be printed to the seqan3::debug_stream by their char representation.
| alphabet_t | Type of the alphabet to be printed; must model seqan3::alphabet. |
| s | The seqan3::debug_stream. |
| l | The alphabet letter. |
|
related |
A seqan3::alignment_coordinate can be printed to the seqan3::debug_stream.
| coordinate_type | The alignment coordinate type. |
| [in] | s | The seqan3::debug_stream. |
| [in] | c | The alignment coordinate to print. |
Prints the alignment coordinate as a tuple.
|
related |
All trace_directions can be printed as ascii or as utf8 to the seqan3::debug_stream.
| s | The seqan3::debug_stream. |
| trace | The trace direction. |
The following table shows the printed symbol of a particular seqan3::detail::trace_directions:
| trace direction | utf8 | ascii |
|---|---|---|
| seqan3::detail::trace_directions::none | ↺ | N |
| seqan3::detail::trace_directions::diagonal | ↖ | D |
| seqan3::detail::trace_directions::up_open | ↑ | U |
| seqan3::detail::trace_directions::up | ⇡ | u |
| seqan3::detail::trace_directions::left_open | ← | L |
| seqan3::detail::trace_directions::left | ⇠ | l |
|
related |
Overload for the seqan3::mask alphabet.
| char_t | Type char type of the debug_stream. |
| s | The seqan3::debug_stream. |
| l | The mask alphabet letter. |
|
related |
A type (e.g. an enum) can be made debug streamable by customizing the seqan3::enumeration_names.
| option_type | Type of the enum to be printed. |
| s | The seqan3::debug_stream. |
| op | The value to print. |
This searches the seqan3::enumeration_names of the respective type for the value op and prints the respective string if found or '<UNKNOWN_VALUE>' if the value cannot be found in the map.
|
related |
A std::optional can be printed by printing its value or nothing if valueless.
| optional_type | The type of the optional. |
| [in] | s | The seqan3::debug_stream. |
| [in] | arg | The std::optional. |
|
related |
All input ranges can be printed to the seqan3::debug_stream element-wise (if their elements are printable).
| rng_t | Type of the range to be printed; must model std::ranges::input_range. |
| s | The seqan3::debug_stream. |
| r | The input range. |
If the element type models seqan3::alphabet (and is not an unsigned integer), the range is printed just as if it were a string, i.e. std::vector<dna4>{'C'_dna4, 'G'_dna4, 'A'_dna4} is printed as "CGA".
In all other cases the elements are comma separated and the range is enclosed in brackets, i.e. std::vector<int>{3, 1, 33, 7} is printed as "[3,1,33,7]".
|
related |
Make std::nullopt_t printable.
| optional_type | This is std::nullopt_t. |
| [in] | s | The seqan3::debug_stream. |
| [in] | arg | This is std::nullopt. |
|
related |
All tuples can be printed by printing their elements separately.
| tuple_t | Type of the tuple to be printed; must model seqan3::tuple_like. |
| s | The seqan3::debug_stream. |
| t | The tuple. |
|
related |
A std::variant can be printed by visiting the stream operator for the corresponding type.
| variant_type | The type of the variant. |
| [in] | s | The seqan3::debug_stream. |
| [in] | v | The variant. |
Note that in case the variant is valueless(_by_exception), nothing is printed.
|
related |
Streams the seqan3::alignment_result to the seqan3::debug_stream.
| char_t | The underlying character type of the seqan3::debug_stream_type. |
| alignment_result_t | A type specialisation of seqan3::alignment_result. |
| [in,out] | stream | The output stream. |
| [in] | result | The alignment result to print. |
|
related |
Overload for the seqan3::sam_flags.
| char_t | Type char type of the debug_stream. |
| stream | The seqan3::debug_stream. |
| flag | The flag to print. |
|
related |
Print the seqan3::search_result to seqan3::debug_stream.
| char_t | The underlying character type of the seqan3::debug_stream_type. |
| search_result_t | A specialization of seqan3::search_result. |
| stream | The stream. |
| result | The search result to print. |