SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
input_format_concept.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 
16 #include <fstream>
17 #include <string>
18 #include <vector>
19 
25 
26 namespace seqan3::detail
27 {
28 
39 template <typename format_type>
40 struct sequence_file_input_format_exposer : public format_type
41 {
42 public:
43 
44  // Can't use `using format_type::read_sequence_record` as it produces a hard failure in the format concept check
45  // for types that do not model the format concept, i.e. don't offer the proper read_sequence_record interface.
47  template <typename ...ts>
48  void read_sequence_record(ts && ...args)
49  {
50  format_type::read_sequence_record(std::forward<ts>(args)...);
51  }
52 };
53 
54 } // namespace seqan3::detail
55 
56 namespace seqan3
57 {
58 
69 template <typename t>
71 SEQAN3_CONCEPT sequence_file_input_format = requires (detail::sequence_file_input_format_exposer<t> & v,
72  std::ifstream & f,
73  sequence_file_input_options<dna5, false> & options,
75  std::string & id,
76  std::vector<phred42> & qual,
77  std::vector<qualified<dna5, phred42>> & seq_qual)
78 {
79  t::file_extensions;
80 
81  SEQAN3_RETURN_TYPE_CONSTRAINT(v.read_sequence_record(f, options, seq, id, qual), std::same_as, void);
82  SEQAN3_RETURN_TYPE_CONSTRAINT(v.read_sequence_record(f, options, seq_qual, id, seq_qual), std::same_as, void);
83  SEQAN3_RETURN_TYPE_CONSTRAINT(v.read_sequence_record(f, options, std::ignore, std::ignore, std::ignore),
84  std::same_as, void);
85 };
87 
125 
127 } // namespace seqan3
128 
129 namespace seqan3::detail
130 {
131 
137 template <typename t>
138 constexpr bool is_type_list_of_sequence_file_input_formats_v = false;
139 
145 template <typename ...ts>
146 constexpr bool is_type_list_of_sequence_file_input_formats_v<type_list<ts...>> =
148 
154 template <typename t>
155 SEQAN3_CONCEPT type_list_of_sequence_file_input_formats = is_type_list_of_sequence_file_input_formats_v<t>;
156 } // namespace seqan3::detail
qualified.hpp
Provides quality alphabet composites.
fstream
std::string
seqan3::type_list
meta::list< types... > type_list
Type that contains multiple types, an alias for meta::list.
Definition: type_list.hpp:31
vector
seqan3::seq
constexpr sequenced_policy seq
Global execution policy object for sequenced execution policy.
Definition: execution.hpp:54
dna5.hpp
Provides seqan3::dna5, container aliases and string literals.
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SEQAN3_RETURN_TYPE_CONSTRAINT
#define SEQAN3_RETURN_TYPE_CONSTRAINT(expression, concept_name,...)
Same as writing {expression} -> concept_name<type1[, ...]> in a concept definition.
Definition: platform.hpp:57
input_options.hpp
Provides seqan3::sequence_file_input_options.
sequence_file_input_format
The generic concept for sequence file in formats.
phred42.hpp
Provides seqan3::phred42 quality scores.
type_list.hpp
Provides seqan3::type_list.
std::ifstream
string