SeqAn3  3.0.0
The Modern C++ library for sequence analysis.
trace_directions.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2019, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2019, Knut Reinert & MPI für molekulare Genetik
4 // This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5 // shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6 // -----------------------------------------------------------------------------------------------------
7 
13 #pragma once
14 
17 
18 namespace seqan3::detail
19 {
20 
26 enum struct trace_directions : uint8_t
27 {
29  none = 0b00000,
31  diagonal = 0b00001,
33  up = 0b00010,
35  left = 0b00100,
37  up_open = 0b01000,
39  left_open = 0b10000
40 };
41 
42 } // namespace seqan3::detail
43 
44 namespace seqan3
45 {
48 template <>
49 constexpr bool add_enum_bitwise_operators<seqan3::detail::trace_directions> = true;
50 } // namespace seqan3
51 
52 namespace seqan3
53 {
54 
60 inline debug_stream_type & operator<<(debug_stream_type & s, detail::trace_directions const trace)
61 {
62  static char const * unicode[8]{"↺", "↖", "↑", "↖↑", "←", "↖←", "↑←", "↖↑←"};
63  static char const * csv[8]{"N", "D", "U", "DU", "L", "DL", "UL", "DUL"};
64 
65  bool is_unicode = (s.flags2() & fmtflags2::utf8) == fmtflags2::utf8;
66  auto const & trace_dir = is_unicode ? unicode : csv;
67 
68  s << trace_dir[static_cast<size_t>(trace) % 8u];
69  return s;
70 }
71 
72 } // namespace seqan3
Provides seqan3::add_enum_bitwise_operators.
debug_stream_type & operator<<(debug_stream_type &s, detail::trace_directions const trace)
All trace_directions can be printed as ascii or as utf8 to the seqan3::debug_stream.
Definition: trace_directions.hpp:60
Enables use of non-ASCII UTF8 characters in formatted output.
Definition: debug_stream.hpp:40
T left(T... args)
No flag is set.
Definition: debug_stream.hpp:39
The main SeqAn3 namespace.
fmtflags2 flags2() const
Retrieve the format flags from the stream.
Definition: debug_stream.hpp:203
Definition: aligned_sequence_concept.hpp:35
A "pretty printer" for most SeqAn data structures and related types.
Definition: debug_stream.hpp:78
Provides seqan3::debug_stream and related types.