SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
shape.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 
57 class shape : public dynamic_bitset<58>
58 {
59 public:
63  constexpr shape() noexcept = default;
64  constexpr shape(shape const &) noexcept = default;
65  constexpr shape(shape &&) noexcept = default;
66  constexpr shape & operator=(shape const &) noexcept = default;
67  constexpr shape & operator=(shape &&) noexcept = default;
68  ~shape() noexcept = default;
69 
84  constexpr shape(ungapped k) noexcept : dynamic_bitset<58>((1ULL << k.value) - 1)
85  {
86  assert(k.value > 0);
87  }
88 
103  constexpr shape(bin_literal const literal) noexcept : dynamic_bitset<58>(literal.value)
104  {
105  assert(front() == 1); // First position must be 1, e.g. no 0111 shape
106  assert(back() == 1); // Last position must be 1, e.g. no 1110 shape
107  }
109 };
110 
116 constexpr shape operator""_shape(unsigned long long const value)
117 {
118  return shape{bin_literal{value}};
119 }
120 
121 }// namespace seqan3
seqan3::shape::shape
constexpr shape(bin_literal const literal) noexcept
Construct from a given seqan3::bin_literal.
Definition: shape.hpp:103
seqan3::shape
A class that defines what positions of a pattern to hash.
Definition: shape.hpp:57
seqan3::dynamic_bitset
A constexpr bitset implementation with dynamic size at compile time.
Definition: dynamic_bitset.hpp:49
seqan3::ungapped
A strong type of underlying type uint8_t that represents the ungapped shape size.
Definition: shape.hpp:24
seqan3::bin_literal
A strong type of underlying type uint64_t that represents the shape in binary representation.
Definition: shape.hpp:33
seqan3::ungapped::value
uint8_t value
The ungapped shape size.
Definition: shape.hpp:27
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:36
seqan3::shape::shape
constexpr shape() noexcept=default
Defaulted.
seqan3::shape::shape
constexpr shape(ungapped k) noexcept
Construct an ungapped shape from a given size.
Definition: shape.hpp:84
seqan3::dynamic_bitset< 58 >::front
constexpr reference front() noexcept
Returns the first element.
Definition: dynamic_bitset.hpp:1047
seqan3::shape::operator=
constexpr shape & operator=(shape const &) noexcept=default
Defaulted.
seqan3::dynamic_bitset< 58 >::back
constexpr reference back() noexcept
Returns the last element.
Definition: dynamic_bitset.hpp:1075
seqan3::bin_literal::value
uint64_t value
The shape in binary representation.
Definition: shape.hpp:36
seqan3::shape::~shape
~shape() noexcept=default
Defaulted.
dynamic_bitset.hpp
A constexpr bitset implementation with dynamic size at compile time.