SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
auxiliary.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 
13 #pragma once
14 
15 #include <sstream>
16 #include <unordered_map>
17 #include <vector>
18 
23 #include <seqan3/std/concepts>
24 #include <seqan3/std/type_traits>
25 
26 namespace seqan3::custom
27 {
28 
49 template <typename t>
51 {}; // forward
52 
54 template <typename t>
55 struct argument_parsing<t const> : argument_parsing<t>
56 {};
57 
58 template <typename t>
59 struct argument_parsing<t &> : argument_parsing<t>
60 {};
61 
62 template <typename t>
63 struct argument_parsing<t const &> : argument_parsing<t>
64 {};
66 
67 } // seqan3::custom
68 
69 namespace seqan3::detail::adl_only
70 {
71 
73 template <typename t>
75 
82 template <typename option_t>
83 struct enumeration_names_fn
84 {
87  seqan3::is_constexpr_default_constructible_v<std::remove_cvref_t<option_t>>,
90 
92  SEQAN3_CPO_IMPL(0, (enumeration_names(v))) // ADL
93 
94 
95  template <typename dummy = int> // need to make this a template to enforce deferred initialisation
97  requires requires
98  {
99  { impl(priority_tag<1>{}, s_option_t{}, dummy{}) };
100  std::same_as<decltype(impl(priority_tag<1>{}, s_option_t{}, dummy{})),
102  }
104  auto operator()() const
105  {
106  return impl(priority_tag<1>{}, s_option_t{});
107  }
108 };
109 
110 } // namespace seqan3::detail::adl_only
111 
112 namespace seqan3
113 {
114 
151 template <typename option_type>
153  requires requires { { detail::adl_only::enumeration_names_fn<option_type>{}() }; }
155 inline auto const enumeration_names = detail::adl_only::enumeration_names_fn<option_type>{}();
157 
168 template <typename option_type>
170 SEQAN3_CONCEPT named_enumeration = requires
171 {
172  { seqan3::enumeration_names<option_type> };
173 };
175 
186 template <typename option_type>
191 
206 template <typename char_t, typename option_type>
210 inline debug_stream_type<char_t> & operator<<(debug_stream_type<char_t> & s, option_type && op)
211 {
212  for (auto & [key, value] : enumeration_names<option_type>)
213  {
214  if (op == value)
215  return s << key;
216  }
217 
218  return s << "<UNKNOWN_VALUE>";
219 }
221 
233 {
234  DEFAULT = 0,
235  REQUIRED = 1,
240  ADVANCED = 2,
244  HIDDEN = 4,
249 };
250 
262 struct argument_parser_meta_data // holds all meta information
263 {
297  unsigned man_page_section{1};
313 };
314 
315 } // namespace seqan3
sstream
seqan3::argument_parser_meta_data::citation
std::string citation
How users shall cite your application.
Definition: auxiliary.hpp:291
seqan3::option_spec
option_spec
Used to further specify argument_parser options/flags.
Definition: auxiliary.hpp:233
std::string
type_traits
Provides C++20 additions to the type_traits header.
seqan3::argument_parser_meta_data::short_description
std::string short_description
A short description of the application (e.g. "A tool for mapping reads to the genome").
Definition: auxiliary.hpp:273
seqan3::argument_parser_meta_data::description
std::vector< std::string > description
A more detailed description that is displayed on the help page in the section "DESCRIPTION"....
Definition: auxiliary.hpp:303
concept.hpp
Stream concepts.
SEQAN3_CPO_IMPL
#define SEQAN3_CPO_IMPL(PRIO, TERM)
A macro that helps defining the overload set of a customisation point.
Definition: customisation_point.hpp:45
vector
seqan3::argument_parser_meta_data::version
std::string version
The version information MAJOR.MINOR.PATH (e.g. 3.1.3)
Definition: auxiliary.hpp:271
seqan3::DEFAULT
@ DEFAULT
The default were no checking or special displaying is happening.
Definition: auxiliary.hpp:234
basic.hpp
Provides various type traits on generic types.
seqan3::argument_parser_meta_data::man_page_title
std::string man_page_title
The title of your man page when exported by specifying "--export-help man" on the common line.
Definition: auxiliary.hpp:295
debug_stream_type.hpp
Provides seqan3::debug_stream and related types.
seqan3::argument_parser_meta_data
Stores all parser related meta information of the seqan3::argument_parser.
Definition: auxiliary.hpp:263
concepts
The Concepts library.
seqan3::argument_parser_meta_data::short_copyright
std::string short_copyright
Brief copyright (and/or license) information.
Definition: auxiliary.hpp:285
seqan3::enumeration_names
auto const enumeration_names
Return a conversion map from std::string_view to option_type.
Definition: auxiliary.hpp:155
seqan3::REQUIRED
@ REQUIRED
Definition: auxiliary.hpp:235
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
seqan3::argument_parser_meta_data::man_page_section
unsigned man_page_section
The man page section info (type man man on the command line for more information).
Definition: auxiliary.hpp:297
seqan3::argument_parser_meta_data::url
std::string url
A link to your github/gitlab project with the newest release.
Definition: auxiliary.hpp:283
seqan3::argument_parser_meta_data::author
std::string author
Your name ;-)
Definition: auxiliary.hpp:275
seqan3::argument_parser_meta_data::email
std::string email
The author's e-mail address for correspondence.
Definition: auxiliary.hpp:277
named_enumeration
Checks whether the free function seqan3::enumeration_names can be called on the type.
argument_parser_compatible_option
Checks whether the the type can be used in an add_(positional_)option call on the argument parser.
std::type_identity
The identity transformation (a transformation_trait that returns the input).
seqan3::argument_parser_meta_data::date
std::string date
The date that the application was last updated. Keep this updated, ! since it will tell your users th...
Definition: auxiliary.hpp:281
seqan3::operator<<
debug_stream_type< char_t > & operator<<(debug_stream_type< char_t > &stream, alignment_t &&alignment)
Stream operator for alignments, which are represented as tuples of aligned sequences.
Definition: debug_stream_alignment.hpp:103
seqan3::HIDDEN
@ HIDDEN
Definition: auxiliary.hpp:244
std::remove_cvref_t
seqan3::custom::argument_parsing
A type that can be specialised to provide customisation point implementations for the seqan3::argumen...
Definition: auxiliary.hpp:51
input_stream_over
Concept for input streams.
std::conditional_t
seqan3::argument_parser_meta_data::long_copyright
std::string long_copyright
Detailed copyright information that will be displayed when the user specifies "--copyright" on the co...
Definition: auxiliary.hpp:289
seqan3::argument_parser_meta_data::synopsis
std::vector< std::string > synopsis
Add lines of usage to the synopsis section of the help page (e.g. "./my_read_mapper [OPTIONS] FILE1 F...
Definition: auxiliary.hpp:307
seqan3::ADVANCED
@ ADVANCED
Definition: auxiliary.hpp:240
seqan3::argument_parser_meta_data::examples
std::vector< std::string > examples
Provide some examples on how to use your tool and what standard parameters might be appropriate in di...
Definition: auxiliary.hpp:312
unordered_map
seqan3::argument_parser_meta_data::app_name
std::string app_name
The application name that will be displayed on the help page.
Definition: auxiliary.hpp:269
seqan3::custom
A namespace for third party and standard library specialisations of SeqAn customisation points.
Definition: char.hpp:44
customisation_point.hpp
Helper utilities for defining customisation point objects.