SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
seqan3::record< field_types, field_ids > Struct Template Reference

The class template that file records are based on; behaves like an std::tuple. More...

#include <seqan3/io/record.hpp>

+ Inheritance diagram for seqan3::record< field_types, field_ids >:

Public Types

using base_type = detail::transfer_template_args_onto_t< field_types, std::tuple >
 A specialisation of std::tuple.
 

Public Member Functions

void clear ()
 (Re-)Initialise all tuple elements with {}.
 
Constructors, destructor and assignment
 record ()=default
 Defaulted.
 
 record (record const &)=default
 Defaulted.
 
recordoperator= (record const &)=default
 Defaulted.
 
 record (record &&)=default
 Defaulted.
 
recordoperator= (record &&)=default
 Defaulted.
 
 ~record ()=default
 Defaulted.
 

Related Functions

(Note that these are not member functions.)

Free function get() interface for seqan3::record based on seqan3::field.

This is the tuple interface via seqan3::field, e.g. get<field::seq>(tuple).

template<field f, typename field_types , typename field_ids >
auto & get (record< field_types, field_ids > &r)
 Free function get() for seqan3::record based on seqan3::field.
 
template<field f, typename field_types , typename field_ids >
auto const & get (record< field_types, field_ids > const &r)
 
template<field f, typename field_types , typename field_ids >
auto && get (record< field_types, field_ids > &&r)
 
template<field f, typename field_types , typename field_ids >
auto const && get (record< field_types, field_ids > const &&r)
 
Requirements for seqan3::tuple_like

You can expect these (meta-)functions on all types that implement seqan3::tuple_like.

size_t tuple_size_v
 A unary type trait that holds the number of elements in the tuple. More...
 
 tuple_elment_t
 A transformation trait that holds the type of elements in the tuple. More...
 
auto && get (type &&val)
 Return the i-th element of the tuple. More...
 
Requirements for std::totally_ordered

You can expect these functions on all types that implement std::totally_ordered.

bool operator< (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator<= (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator> (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
bool operator>= (type const &lhs, type const &rhs)
 Less-than, greater-than and -or-equal comparisons. More...
 
Requirements for std::equality_comparable

You can expect these functions on all types that implement std::Equality_comparable.

bool operator== (type const &lhs, type const &rhs)
 (In-)Equality comparison. More...
 
bool operator!= (type const &lhs, type const &rhs)
 (In-)Equality comparison. More...
 

Detailed Description

template<typename field_types, typename field_ids>
struct seqan3::record< field_types, field_ids >

The class template that file records are based on; behaves like an std::tuple.

Template Parameters
field_typesThe types of the fields in this record as a seqan3::type_list.
field_idsA seqan3::fields type with seqan3::field IDs corresponding to field_types.

This class template behaves just like an std::tuple, with the exception that it provides an additional get-interface that takes a seqan3::field identifier. The traditional get interfaces (via index and via type) are also supported, but discouraged, because accessing via seqan3::field is unambiguous and better readable.

Example

For input files this template is specialised automatically and provided by the file via its record_type member. For output files you my define it locally and pass instances of this to the output file's push_back().

This is how it works:

#include <string>
#include <vector>
int main()
{
using seqan3::operator""_dna4;
using seqan3::get;
// The order of the types below represent a mapping between the type and the key.
// record_type now mimics std::tuple<std::string, dna4_vector, std::vector<phred42>>,
// the order also depends on selected_ids
record_type my_record{};
get<1>(my_record) = "the most important sequence in the database"; // access via index
get<seqan3::field::seq>(my_record) = "ACGT"_dna4; // access via seqan3::field
get<std::string>(my_record) = "the least important sequence in the database"; // access via type
}

Friends And Related Function Documentation

◆ get() [1/4]

auto && get< i > ( type &&  val)
related

Return the i-th element of the tuple.

Template Parameters
iThe index of the element to return (of type size_t).
Parameters
[in,out]valThe tuple-like object to operate on.
Returns
The i-th value in the tuple.
Attention
This is a concept requirement, not an actual function (however types satisfying this concept will provide an implementation).
This constraint is not enforced since empty tuples are valid.

◆ get() [2/4]

template<field f, typename field_types , typename field_ids >
auto const & get ( record< field_types, field_ids > const &  r)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ get() [3/4]

template<field f, typename field_types , typename field_ids >
auto && get ( record< field_types, field_ids > &&  r)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ get() [4/4]

template<field f, typename field_types , typename field_ids >
auto const && get ( record< field_types, field_ids > const &&  r)
related

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ tuple_elment_t()

tuple_elment_t
related

A transformation trait that holds the type of elements in the tuple.

Template Parameters
iIndex of the queried element type.
typeThe tuple-like type.
Attention
This is a concept requirement, not an actual function (however types satisfying this concept will provide an implementation).
This constraint is not enforced since empty tuples are valid.

◆ tuple_size_v()

size_t tuple_size_v
related

A unary type trait that holds the number of elements in the tuple.

Template Parameters
typeThe tuple-like type.
Attention
This is a concept requirement, not an actual function (however types satisfying this concept will provide an implementation).

The documentation for this struct was generated from the following file: