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 <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
VOID_CALLBACK
@ VOID_CALLBACK
Definition: volk_option_helpers.h:16
option_t::printval
std::string printval
Definition: volk_option_helpers.h:37
option_list::parse
void parse(int argc, char **argv)
Definition: volk_option_helpers.cc:66
option_t::longform
std::string longform
Definition: volk_option_helpers.h:33
option_t
Definition: volk_option_helpers.h:24
STRING_CALLBACK
@ STRING_CALLBACK
Definition: volk_option_helpers.h:19
void
VOLK_API void
Call into a specific implementation given by name.
option_list::help
void help()
Definition: volk_option_helpers.cc:161
option_list::option_list
option_list(std::string program_name)
Definition: volk_option_helpers.cc:58
INT_CALLBACK
@ INT_CALLBACK
Definition: volk_option_helpers.h:17
option_t::msg
std::string msg
Definition: volk_option_helpers.h:35
option_t::shortform
std::string shortform
Definition: volk_option_helpers.h:34
FLOAT_CALLBACK
@ FLOAT_CALLBACK
Definition: volk_option_helpers.h:20
option_t::option_type
VOLK_OPTYPE option_type
Definition: volk_option_helpers.h:36
option_list::present
bool present(std::string option_name)
Definition: volk_option_helpers.cc:153
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:64
STRING
@ STRING
Definition: volk_option_helpers.h:21
BOOL_CALLBACK
@ BOOL_CALLBACK
Definition: volk_option_helpers.h:18
option_list
Definition: volk_option_helpers.h:42
option_t::callback
void(* callback)()
Definition: volk_option_helpers.h:38