SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
auxiliary.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 
13 #pragma once
14 
15 #include <seqan3/std/concepts>
16 #include <sstream>
17 #include <seqan3/std/type_traits>
18 #include <unordered_map>
19 #include <vector>
20 
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 
78 template <typename option_t>
79 struct enumeration_names_cpo : public detail::customisation_point_object<enumeration_names_cpo<option_t>, 1>
80 {
82  using base_t = detail::customisation_point_object<enumeration_names_cpo<option_t>, 1>;
84  using base_t::base_t;
85 
89  template <typename option_type>
90  using option_or_type_identity
92  seqan3::is_constexpr_default_constructible_v<std::remove_cvref_t<option_type>>,
95 
99  template <typename option_type = option_t>
100  static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<1>)
101  (
103  );
104 
114  template <typename option_type = option_t>
115  static constexpr auto SEQAN3_CPO_OVERLOAD(priority_tag<0>)
116  (
117  /*return*/ enumeration_names(option_or_type_identity<option_type>{}) /*;*/
118  );
119 };
120 
121 } // namespace seqan3::detail::adl_only
122 
123 namespace seqan3
124 {
125 
162 template <typename option_type>
164  requires requires { { detail::adl_only::enumeration_names_cpo<option_type>{}() }; }
166 inline auto const enumeration_names = detail::adl_only::enumeration_names_cpo<option_type>{}();
168 
180 template <typename option_type>
181 SEQAN3_CONCEPT named_enumeration = requires
182 {
183  { seqan3::enumeration_names<option_type> };
184 };
186 
198 template <typename option_type>
202 
217 template <typename char_t, typename option_type>
221 inline debug_stream_type<char_t> & operator<<(debug_stream_type<char_t> & s, option_type && op)
222 {
223  for (auto & [key, value] : enumeration_names<option_type>)
224  {
225  if (op == value)
226  return s << key;
227  }
228 
229  return s << "<UNKNOWN_VALUE>";
230 }
232 
243 enum option_spec
244 {
245  standard = 0,
246  required = 1,
251  advanced = 2,
255  hidden = 4,
261 #ifdef SEQAN3_DEPRECATED_310
266 #endif // SEQAN3_DEPRECATED_310
267 };
268 
270 enum class update_notifications
271 {
272  on,
273  off
274 };
275 
287 struct argument_parser_meta_data // holds all meta information
288 {
322  unsigned man_page_section{1};
338 };
339 
340 } // namespace seqan3
The Concepts library.
Helper utilities for defining customisation point objects (CPOs).
#define SEQAN3_CPO_OVERLOAD(...)
A macro that helps to define a seqan3::detail::customisation_point_object.
Definition: customisation_point.hpp:113
Provides seqan3::debug_stream and related types.
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:101
auto const enumeration_names
Return a conversion map from std::string_view to option_type.
Definition: auxiliary.hpp:160
option_spec
Used to further specify argument_parser options/flags.
Definition: auxiliary.hpp:238
@ standard
The default were no checking or special displaying is happening.
Definition: auxiliary.hpp:239
@ REQUIRED
Definition: auxiliary.hpp:257
@ advanced
Definition: auxiliary.hpp:245
@ DEFAULT
Definition: auxiliary.hpp:256
@ ADVANCED
Definition: auxiliary.hpp:258
@ hidden
Definition: auxiliary.hpp:249
@ required
Definition: auxiliary.hpp:240
@ HIDDEN
Definition: auxiliary.hpp:259
Checks whether the the type can be used in an add_(positional_)option call on the argument parser.
Concept for input streams.
Checks whether the free function seqan3::enumeration_names can be called on the type.
Stream concepts.
A namespace for third party and standard library specialisations of SeqAn customisation points.
Definition: char.hpp:44
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
update_notifications
Indicates whether application allows automatic update notifications by the seqan3::argument_parser.
Definition: auxiliary.hpp:265
@ off
Automatic update notifications should be disabled.
@ on
Automatic update notifications should be enabled.
#define SEQAN3_DEPRECATED_310
Deprecation message for SeqAn 3.1.0 release.
Definition: platform.hpp:203
std::string long_copyright
Detailed copyright information that will be displayed when the user specifies "--copyright" on the co...
Definition: auxiliary.hpp:308
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:314
std::string email
The author's e-mail address for correspondence.
Definition: auxiliary.hpp:296
std::string short_copyright
Brief copyright (and/or license) information.
Definition: auxiliary.hpp:304
std::string date
The date that the application was last updated. Keep this updated, ! since it will tell your users th...
Definition: auxiliary.hpp:300
std::string author
Your name ;-)
Definition: auxiliary.hpp:294
std::string version
The version information MAJOR.MINOR.PATH (e.g. 3.1.3)
Definition: auxiliary.hpp:290
std::string app_name
The application name that will be displayed on the help page.
Definition: auxiliary.hpp:288
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:326
std::string short_description
A short description of the application (e.g. "A tool for mapping reads to the genome").
Definition: auxiliary.hpp:292
std::string url
A link to your github/gitlab project with the newest release.
Definition: auxiliary.hpp:302
std::string citation
How users shall cite your application.
Definition: auxiliary.hpp:310
std::vector< std::string > description
A more detailed description that is displayed on the help page in the section "DESCRIPTION"....
Definition: auxiliary.hpp:322
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:331
unsigned man_page_section
The man page section info (type man man on the command line for more information).
Definition: auxiliary.hpp:316
A type that can be specialised to provide customisation point implementations for the seqan3::argumen...
Definition: auxiliary.hpp:51
Provides C++20 additions to the type_traits header.
Provides various type traits on generic types.