Vector Optimized Library of Kernels  3.0.0
Architecture-tuned implementations of math kernels
volk_option_helpers.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2018-2020 Free Software Foundation, Inc.
4  *
5  * This file is part of VOLK
6  *
7  * SPDX-License-Identifier: LGPL-3.0-or-later
8  */
9 
10 #ifndef VOLK_VOLK_OPTION_HELPERS_H
11 #define VOLK_VOLK_OPTION_HELPERS_H
12 
13 #include <limits.h>
14 #include <cstring>
15 #include <map>
16 #include <string>
17 #include <vector>
18 
19 typedef enum {
26 } VOLK_OPTYPE;
27 
28 class option_t
29 {
30 public:
31  option_t(std::string t_longform,
32  std::string t_shortform,
33  std::string t_msg,
34  void (*t_callback)());
35  option_t(std::string t_longform,
36  std::string t_shortform,
37  std::string t_msg,
38  void (*t_callback)(int));
39  option_t(std::string t_longform,
40  std::string t_shortform,
41  std::string t_msg,
42  void (*t_callback)(float));
43  option_t(std::string t_longform,
44  std::string t_shortform,
45  std::string t_msg,
46  void (*t_callback)(bool));
47  option_t(std::string t_longform,
48  std::string t_shortform,
49  std::string t_msg,
50  void (*t_callback)(std::string));
51  option_t(std::string t_longform,
52  std::string t_shortform,
53  std::string t_msg,
54  std::string t_printval);
55 
56  std::string longform;
57  std::string shortform;
58  std::string msg;
60  std::string printval;
61  void (*callback)();
62 };
63 
65 {
66 public:
67  option_list(std::string program_name);
68  bool present(std::string option_name);
69 
70  void add(option_t opt);
71 
72  void parse(int argc, char** argv);
73 
74  void help();
75 
76 private:
77  std::string d_program_name;
78  std::vector<option_t> d_internal_list;
79  std::map<std::string, int> d_present_options;
80 };
81 
82 
83 #endif // VOLK_VOLK_OPTION_HELPERS_H
Definition: volk_option_helpers.h:65
void add(option_t opt)
Definition: volk_option_helpers.cc:106
void parse(int argc, char **argv)
Definition: volk_option_helpers.cc:108
option_list(std::string program_name)
Definition: volk_option_helpers.cc:100
void help()
Definition: volk_option_helpers.cc:214
bool present(std::string option_name)
Definition: volk_option_helpers.cc:205
Definition: volk_option_helpers.h:29
std::string shortform
Definition: volk_option_helpers.h:57
option_t(std::string t_longform, std::string t_shortform, std::string t_msg, void(*t_callback)())
Definition: volk_option_helpers.cc:23
std::string printval
Definition: volk_option_helpers.h:60
VOLK_OPTYPE option_type
Definition: volk_option_helpers.h:59
std::string longform
Definition: volk_option_helpers.h:56
std::string msg
Definition: volk_option_helpers.h:58
void(* callback)()
Definition: volk_option_helpers.h:61
VOLK_API void
Call into a specific implementation given by name.
Definition: volk.tmpl.h:101
VOLK_OPTYPE
Definition: volk_option_helpers.h:19
@ INT_CALLBACK
Definition: volk_option_helpers.h:21
@ VOID_CALLBACK
Definition: volk_option_helpers.h:20
@ BOOL_CALLBACK
Definition: volk_option_helpers.h:22
@ STRING_CALLBACK
Definition: volk_option_helpers.h:23
@ STRING
Definition: volk_option_helpers.h:25
@ FLOAT_CALLBACK
Definition: volk_option_helpers.h:24