SeqAn3
3.4.0
The Modern C++ library for sequence analysis.
Toggle main menu visibility
Loading...
Searching...
No Matches
trace_directions.hpp
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
3
// SPDX-License-Identifier: BSD-3-Clause
4
9
10
#pragma once
11
12
#include <
array
>
13
#include <
string_view
>
14
15
#include <
seqan3/core/add_enum_bitwise_operators.hpp
>
16
#include <
seqan3/core/debug_stream/debug_stream_type.hpp
>
17
#include <
seqan3/core/detail/template_inspection.hpp
>
18
19
namespace
seqan3::detail
20
{
21
29
enum struct
trace_directions : uint8_t
30
{
32
none = 0b0'0000,
34
diagonal = 0b0'0001,
36
up_open = 0b0'0110,
38
up = 0b0'0100,
40
left_open = 0b1'1000,
42
left = 0b1'0000,
44
carry_up_open = 0b0'0010,
46
carry_left_open = 0b0'1000
47
};
48
49
}
// namespace seqan3::detail
50
51
namespace
seqan3
52
{
57
template
<>
58
inline
constexpr
bool
add_enum_bitwise_operators<seqan3::detail::trace_directions> =
true
;
60
76
template
<>
77
struct
trace_directions_printer
<detail::trace_directions>
78
{
79
private
:
81
static
constexpr
std::array<std::string_view, 32>
unicode{
82
"↺"
,
"↖"
,
"↑"
,
"↖↑"
,
"⇡"
,
"↖⇡"
,
"↑⇡"
,
"↖↑⇡"
,
"←"
,
"↖←"
,
"↑←"
,
"↖↑←"
,
"⇡←"
,
"↖⇡←"
,
"↑⇡←"
,
"↖↑⇡←"
,
83
"⇠"
,
"↖⇠"
,
"↑⇠"
,
"↖↑⇠"
,
"⇡⇠"
,
"↖⇡⇠"
,
"↑⇡⇠"
,
"↖↑⇡⇠"
,
"←⇠"
,
"↖←⇠"
,
"↑←⇠"
,
"↖↑←⇠"
,
"⇡←⇠"
,
"↖⇡←⇠"
,
"↑⇡←⇠"
,
"↖↑⇡←⇠"
};
84
86
static
constexpr
std::array<std::string_view, 32>
csv{
87
"N"
,
"D"
,
"U"
,
"DU"
,
"u"
,
"Du"
,
"Uu"
,
"DUu"
,
"L"
,
"DL"
,
"UL"
,
"DUL"
,
"uL"
,
"DuL"
,
"UuL"
,
"DUuL"
,
88
"l"
,
"Dl"
,
"Ul"
,
"DUl"
,
"ul"
,
"Dul"
,
"Uul"
,
"DUul"
,
"Ll"
,
"DLl"
,
"ULl"
,
"DULl"
,
"uLl"
,
"DuLl"
,
"UuLl"
,
"DUuLl"
};
89
90
public
:
101
template
<
typename
stream_t>
102
requires
detail::is_type_specialisation_of_v<stream_t, debug_stream_type>
103
constexpr
void
operator()
(stream_t & stream, detail::trace_directions
const
trace)
const
104
{
105
print_impl(stream, stream.flags2(), trace);
106
}
107
117
template
<
typename
stream_t>
118
constexpr
void
operator()
(stream_t & stream, detail::trace_directions
const
trace)
const
119
{
120
print_impl(stream,
fmtflags2::none
, trace);
121
}
122
123
private
:
130
template
<
typename
stream_t>
131
constexpr
void
print_impl(stream_t & stream,
fmtflags2
const
flag
, detail::trace_directions
const
trace)
const
132
{
133
bool
const
is_unicode = (
flag
&
fmtflags2::utf8
) ==
fmtflags2::utf8
;
134
auto
const
& trace_dir = is_unicode ? unicode : csv;
135
136
stream << trace_dir[static_cast<size_t>(trace)];
137
}
138
};
139
140
}
// namespace seqan3
add_enum_bitwise_operators.hpp
Provides seqan3::add_enum_bitwise_operators.
array
debug_stream_type.hpp
Provides seqan3::debug_stream and related types.
seqan3::fmtflags2
fmtflags2
Flags that change the behaviour of the seqan3::debug_stream.
Definition
debug_stream_type.hpp:32
seqan3::fmtflags2::utf8
@ utf8
Enables use of non-ASCII UTF8 characters in formatted output.
Definition
debug_stream_type.hpp:34
seqan3::fmtflags2::none
@ none
No flag is set.
Definition
debug_stream_type.hpp:33
seqan3::field::flag
@ flag
The alignment flag (bit information), uint16_t value.
Definition
record.hpp:84
seqan3
The main SeqAn3 namespace.
Definition
aligned_sequence_concept.hpp:26
string_view
seqan3::trace_directions_printer< detail::trace_directions >::operator()
constexpr void operator()(stream_t &stream, detail::trace_directions const trace) const
Prints the trace directions into the given stream.
Definition
trace_directions.hpp:103
seqan3::trace_directions_printer< detail::trace_directions >::operator()
constexpr void operator()(stream_t &stream, detail::trace_directions const trace) const
Prints the trace directions into the given stream.
Definition
trace_directions.hpp:118
seqan3::trace_directions_printer
Definition
default_printer.hpp:50
template_inspection.hpp
Provides type traits for working with templates.
Hide me
Version:
seqan3
alignment
matrix
detail
trace_directions.hpp
Generated on
for SeqAn3 by
1.17.0