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


openslam_gmapping
Author(s): Giorgio Grisetti, Cyrill Stachniss, Wolfram Burgard
autogenerated on Mon Jun 10 2019 14:04:22