Vector Optimized Library of Kernels  2.2
Architecture-tuned implementations of math kernels
volk_option_helpers.h
Go to the documentation of this file.
1 //
2 // Created by nathan on 2/1/18.
3 //
4 
5 #ifndef VOLK_VOLK_OPTION_HELPERS_H
6 #define VOLK_VOLK_OPTION_HELPERS_H
7 
8 #include <limits.h>
9 #include <cstring>
10 #include <map>
11 #include <string>
12 #include <vector>
13 
14 typedef enum {
21 } VOLK_OPTYPE;
22 
23 class option_t
24 {
25 public:
26  option_t(std::string longform,
27  std::string shortform,
28  std::string msg,
29  void (*callback)());
30  option_t(std::string longform,
31  std::string shortform,
32  std::string msg,
33  void (*callback)(int));
34  option_t(std::string longform,
35  std::string shortform,
36  std::string msg,
37  void (*callback)(float));
38  option_t(std::string longform,
39  std::string shortform,
40  std::string msg,
41  void (*callback)(bool));
42  option_t(std::string longform,
43  std::string shortform,
44  std::string msg,
45  void (*callback)(std::string));
46  option_t(std::string longform,
47  std::string shortform,
48  std::string msg,
49  std::string printval);
50 
51  std::string longform;
52  std::string shortform;
53  std::string msg;
55  std::string printval;
56  void (*callback)();
57 };
58 
60 {
61 public:
62  option_list(std::string program_name);
63  bool present(std::string option_name);
64 
65  void add(option_t opt);
66 
67  void parse(int argc, char** argv);
68 
69  void help();
70 
71 private:
72  std::string program_name;
73  std::vector<option_t> internal_list;
74  std::map<std::string, int> present_options;
75 };
76 
77 
78 #endif // VOLK_VOLK_OPTION_HELPERS_H
VOID_CALLBACK
Definition: volk_option_helpers.h:15
option_t::printval
std::string printval
Definition: volk_option_helpers.h:55
option_list::parse
void parse(int argc, char **argv)
Definition: volk_option_helpers.cc:96
option_t::longform
std::string longform
Definition: volk_option_helpers.h:51
option_t
Definition: volk_option_helpers.h:23
STRING_CALLBACK
Definition: volk_option_helpers.h:18
void
VOLK_API void
Call into a specific implementation given by name.
option_list::help
void help()
Definition: volk_option_helpers.cc:202
option_list::option_list
option_list(std::string program_name)
Definition: volk_option_helpers.cc:88
INT_CALLBACK
Definition: volk_option_helpers.h:16
option_t::msg
std::string msg
Definition: volk_option_helpers.h:53
option_t::shortform
std::string shortform
Definition: volk_option_helpers.h:52
FLOAT_CALLBACK
Definition: volk_option_helpers.h:19
option_t::option_type
VOLK_OPTYPE option_type
Definition: volk_option_helpers.h:54
option_list::present
bool present(std::string option_name)
Definition: volk_option_helpers.cc:193
VOLK_OPTYPE
VOLK_OPTYPE
Definition: volk_option_helpers.h:14
option_t::option_t
option_t(std::string longform, std::string shortform, std::string msg, void(*callback)())
Definition: volk_option_helpers.cc:17
option_list::add
void add(option_t opt)
Definition: volk_option_helpers.cc:94
STRING
Definition: volk_option_helpers.h:20
BOOL_CALLBACK
Definition: volk_option_helpers.h:17
option_list
Definition: volk_option_helpers.h:59
option_t::callback
void(* callback)()
Definition: volk_option_helpers.h:56