Vector Optimized Library of Kernels  2.0
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 <string>
9 #include <cstring>
10 #include <limits.h>
11 #include <vector>
12 #include <map>
13 
14 typedef enum
15 {
22 } VOLK_OPTYPE;
23 
24 class option_t {
25  public:
26  option_t(std::string longform, std::string shortform, std::string msg, void (*callback)());
27  option_t(std::string longform, std::string shortform, std::string msg, void (*callback)(int));
28  option_t(std::string longform, std::string shortform, std::string msg, void (*callback)(float));
29  option_t(std::string longform, std::string shortform, std::string msg, void (*callback)(bool));
30  option_t(std::string longform, std::string shortform, std::string msg, void (*callback)(std::string));
31  option_t(std::string longform, std::string shortform, std::string msg, std::string printval);
32 
33  std::string longform;
34  std::string shortform;
35  std::string msg;
37  std::string printval;
38  void (*callback)();
39 
40 };
41 
43 {
44  public:
45  option_list(std::string program_name);
46  bool present(std::string option_name);
47 
48  void add(option_t opt);
49 
50  void parse(int argc, char **argv);
51 
52  void help();
53  private:
54  std::string program_name;
55  std::vector<option_t> internal_list;
56  std::map<std::string, int> present_options;
57 };
58 
59 
60 #endif //VOLK_VOLK_OPTION_HELPERS_H
Definition: volk_option_helpers.h:20
option_t(std::string longform, std::string shortform, std::string msg, void(*callback)())
Definition: volk_option_helpers.cc:17
void(* callback)()
Definition: volk_option_helpers.h:38
std::string msg
Definition: volk_option_helpers.h:35
Definition: volk_option_helpers.h:21
std::string longform
Definition: volk_option_helpers.h:33
Definition: volk_option_helpers.h:42
Definition: volk_option_helpers.h:16
std::string shortform
Definition: volk_option_helpers.h:34
VOLK_API void
Call into a specific implementation given by name.
VOLK_OPTYPE
Definition: volk_option_helpers.h:14
Definition: volk_option_helpers.h:24
std::string printval
Definition: volk_option_helpers.h:37
VOLK_OPTYPE option_type
Definition: volk_option_helpers.h:36
Definition: volk_option_helpers.h:17
Definition: volk_option_helpers.h:18
Definition: volk_option_helpers.h:19