SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
shape.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 
14 #pragma once
15 
17 
18 namespace seqan3
19 {
20 
24 struct ungapped
25 {
27  uint8_t value;
28 };
29 
34 {
36  uint64_t value;
37 };
38 
59 class shape : public dynamic_bitset<58>
60 {
61 public:
65  constexpr shape() noexcept = default;
66  constexpr shape(shape const &) noexcept = default;
67  constexpr shape(shape &&) noexcept = default;
68  constexpr shape & operator=(shape const &) noexcept = default;
69  constexpr shape & operator=(shape &&) noexcept = default;
70  ~shape() noexcept = default;
71 
86  constexpr shape(ungapped k) noexcept : dynamic_bitset<58>((1ULL << k.value) - 1)
87  {
88  assert(k.value > 0);
89  }
90 
105  constexpr shape(bin_literal const literal) noexcept : dynamic_bitset<58>(literal.value)
106  {
107  assert(front() == 1); // First position must be 1, e.g. no 0111 shape
108  assert(back() == 1); // Last position must be 1, e.g. no 1110 shape
109  }
111 };
112 
113 inline namespace literals
114 {
115 
124 constexpr shape operator""_shape(unsigned long long const value)
125 {
126  return shape{bin_literal{value}};
127 }
129 
130 } // inline namespace literals
131 
132 }// namespace seqan3
A constexpr bitset implementation with dynamic size at compile time.
Definition: dynamic_bitset.hpp:54
constexpr reference back() noexcept
Returns the last element.
Definition: dynamic_bitset.hpp:1180
constexpr reference front() noexcept
Returns the first element.
Definition: dynamic_bitset.hpp:1150
A class that defines which positions of a pattern to hash.
Definition: shape.hpp:60
constexpr shape(bin_literal const literal) noexcept
Construct from a given seqan3::bin_literal.
Definition: shape.hpp:105
constexpr shape() noexcept=default
Defaulted.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
A strong type of underlying type uint64_t that represents the shape in binary representation.
Definition: shape.hpp:34
uint64_t value
The shape in binary representation.
Definition: shape.hpp:36
A strong type of underlying type uint8_t that represents the ungapped shape size.
Definition: shape.hpp:25
uint8_t value
The ungapped shape size.
Definition: shape.hpp:27
A constexpr bitset implementation with dynamic size at compile time.