Vector Optimized Library of Kernels 2.5.1
Architecture-tuned implementations of math kernels
 
Loading...
Searching...
No Matches
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 GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef VOLK_VOLK_OPTION_HELPERS_H
24#define VOLK_VOLK_OPTION_HELPERS_H
25
26#include <limits.h>
27#include <cstring>
28#include <map>
29#include <string>
30#include <vector>
31
32typedef enum {
40
42{
43public:
44 option_t(std::string t_longform,
45 std::string t_shortform,
46 std::string t_msg,
47 void (*t_callback)());
48 option_t(std::string t_longform,
49 std::string t_shortform,
50 std::string t_msg,
51 void (*t_callback)(int));
52 option_t(std::string t_longform,
53 std::string t_shortform,
54 std::string t_msg,
55 void (*t_callback)(float));
56 option_t(std::string t_longform,
57 std::string t_shortform,
58 std::string t_msg,
59 void (*t_callback)(bool));
60 option_t(std::string t_longform,
61 std::string t_shortform,
62 std::string t_msg,
63 void (*t_callback)(std::string));
64 option_t(std::string t_longform,
65 std::string t_shortform,
66 std::string t_msg,
67 std::string t_printval);
68
69 std::string longform;
70 std::string shortform;
71 std::string msg;
73 std::string printval;
74 void (*callback)();
75};
76
78{
79public:
80 option_list(std::string program_name);
81 bool present(std::string option_name);
82
83 void add(option_t opt);
84
85 void parse(int argc, char** argv);
86
87 void help();
88
89private:
90 std::string d_program_name;
91 std::vector<option_t> d_internal_list;
92 std::map<std::string, int> d_present_options;
93};
94
95
96#endif // VOLK_VOLK_OPTION_HELPERS_H
Definition: volk_option_helpers.h:78
void add(option_t opt)
Definition: volk_option_helpers.cc:119
void parse(int argc, char **argv)
Definition: volk_option_helpers.cc:121
void help()
Definition: volk_option_helpers.cc:227
bool present(std::string option_name)
Definition: volk_option_helpers.cc:218
Definition: volk_option_helpers.h:42
std::string shortform
Definition: volk_option_helpers.h:70
std::string printval
Definition: volk_option_helpers.h:73
VOLK_OPTYPE option_type
Definition: volk_option_helpers.h:72
std::string longform
Definition: volk_option_helpers.h:69
std::string msg
Definition: volk_option_helpers.h:71
void(* callback)()
Definition: volk_option_helpers.h:74
VOLK_OPTYPE
Definition: volk_option_helpers.h:32
@ INT_CALLBACK
Definition: volk_option_helpers.h:34
@ VOID_CALLBACK
Definition: volk_option_helpers.h:33
@ BOOL_CALLBACK
Definition: volk_option_helpers.h:35
@ STRING_CALLBACK
Definition: volk_option_helpers.h:36
@ STRING
Definition: volk_option_helpers.h:38
@ FLOAT_CALLBACK
Definition: volk_option_helpers.h:37