commandline.h
Go to the documentation of this file.
1 /*****************************************************************
2  *
3  * This file is part of the GMAPPING project
4  *
5  * GMAPPING Copyright (c) 2004 Giorgio Grisetti,
6  * Cyrill Stachniss, and Wolfram Burgard
7  *
8  * This software is licensed under the 3-Clause BSD License
9  * and is copyrighted by Giorgio Grisetti, Cyrill Stachniss,
10  * and Wolfram Burgard.
11  *
12  * Further information on this license can be found at:
13  * https://opensource.org/licenses/BSD-3-Clause
14  *
15  * GMAPPING is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied
17  * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
18  * PURPOSE.
19  *
20  *****************************************************************/
21 
22 
23 #ifndef COMMANDLINE_H
24 #define COMMANDLINE_H
25 
26 
27 #define parseFlag(name,value)\
28 if (!strcmp(argv[c],name)){\
29  value=true;\
30  cout << name << " on"<< endl;\
31  recognized=true;\
32 }\
33 
34 #define parseString(name,value)\
35 if (!strcmp(argv[c],name) && c<argc-1){\
36  c++;\
37  value=argv[c];\
38  cout << name << "=" << value << endl;\
39  recognized=true;\
40 }\
41 
42 
43 #define parseDouble(name,value)\
44 if (!strcmp(argv[c],name) && c<argc-1){\
45  c++;\
46  value=atof(argv[c]);\
47  cout << name << "=" << value << endl;\
48  recognized=true;\
49 }\
50 
51 #define parseInt(name,value)\
52 if (!strcmp(argv[c],name) && c<argc-1){\
53  c++;\
54  value=atoi(argv[c]);\
55  cout << name << "=" << value << endl;\
56  recognized=true;\
57 }\
58 
59 #define CMD_PARSE_BEGIN(i, count)\
60 {\
61  int c=i;\
62  while (c<count){\
63  bool recognized=false;
64 
65 #define CMD_PARSE_END\
66  if (!recognized)\
67  cout << "COMMAND LINE: parameter " << argv[c] << " not recognized" << endl;\
68  c++;\
69  }\
70 }
71 
72 #define CMD_PARSE_BEGIN_SILENT(i, count)\
73 {\
74  int c=i;\
75  while (c<count){\
76  bool recognized=false;
77 
78 #define CMD_PARSE_END_SILENT\
79  c++;\
80  }\
81 }
82 
83 
84 #define parseFlagSilent(name,value)\
85 if (!strcmp(argv[c],name)){\
86  value=true;\
87  recognized=true;\
88 }\
89 
90 #define parseStringSilent(name,value)\
91 if (!strcmp(argv[c],name) && c<argc-1){\
92  c++;\
93  value=argv[c];\
94  recognized=true;\
95 }\
96 
97 
98 #define parseDoubleSilent(name,value)\
99 if (!strcmp(argv[c],name) && c<argc-1){\
100  c++;\
101  value=atof(argv[c]);\
102  recognized=true;\
103 }\
104 
105 #define parseIntSilent(name,value)\
106 if (!strcmp(argv[c],name) && c<argc-1){\
107  c++;\
108  value=atoi(argv[c]);\
109  recognized=true;\
110 }\
111 
112 
113 #endif
114 


openslam_gmapping
Author(s): Cyrill Stachniss, Udo Frese, Giorgio Grisetti, Wolfram Burgard
autogenerated on Mon Feb 28 2022 22:59:20