SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
trace_directions.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2021, 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 
28 enum struct trace_directions : uint8_t
29 {
31  none = 0b00000,
33  diagonal = 0b00001,
35  up_open = 0b00010,
37  up = 0b00100,
39  left_open = 0b01000,
41  left = 0b10000
42 };
43 
44 } // namespace seqan3::detail
45 
46 namespace seqan3
47 {
52 template <>
53 constexpr bool add_enum_bitwise_operators<seqan3::detail::trace_directions> = true;
55 
74 template <typename char_t>
75 inline debug_stream_type<char_t> & operator<<(debug_stream_type<char_t> & s, detail::trace_directions const trace)
76 {
77  static char const * unicode[32]{ "↺", "↖", "↑", "↖↑", "⇡", "↖⇡", "↑⇡", "↖↑⇡",
78  "←", "↖←", "↑←", "↖↑←", "⇡←", "↖⇡←", "↑⇡←", "↖↑⇡←",
79  "⇠", "↖⇠", "↑⇠", "↖↑⇠", "⇡⇠", "↖⇡⇠", "↑⇡⇠", "↖↑⇡⇠",
80  "←⇠", "↖←⇠", "↑←⇠", "↖↑←⇠", "⇡←⇠", "↖⇡←⇠", "↑⇡←⇠", "↖↑⇡←⇠"};
81 
82  static char const * csv[32]{ "N", "D", "U", "DU", "u", "Du", "Uu", "DUu",
83  "L", "DL", "UL", "DUL", "uL", "DuL", "UuL", "DUuL",
84  "l", "Dl", "Ul", "DUl", "ul", "Dul", "Uul", "DUul",
85  "Ll", "DLl", "ULl", "DULl", "uLl", "DuLl", "UuLl", "DUuLl"};
86 
87  bool is_unicode = (s.flags2() & fmtflags2::utf8) == fmtflags2::utf8;
88  auto const & trace_dir = is_unicode ? unicode : csv;
89 
90  s << trace_dir[static_cast<size_t>(trace)];
91  return s;
92 }
93 
94 } // namespace seqan3
Provides seqan3::add_enum_bitwise_operators.
A "pretty printer" for most SeqAn data structures and related types.
Definition: debug_stream_type.hpp:76
fmtflags2 flags2() const
Retrieve the format flags from the stream.
Definition: debug_stream_type.hpp:199
Provides seqan3::debug_stream and related types.
debug_stream_type< char_t > & operator<<(debug_stream_type< char_t > &stream, alignment_t &&alignment)
Stream operator for alignments, which are represented as tuples of aligned sequences.
Definition: debug_stream_alignment.hpp:101
@ utf8
Enables use of non-ASCII UTF8 characters in formatted output.
Definition: debug_stream_type.hpp:33
@ none
No flag is set.
Definition: debug_stream_type.hpp:32
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29