00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #ifndef PCL_CONSOLE_PARSE_H_
00040 #define PCL_CONSOLE_PARSE_H_
00041
00042 #include <vector>
00043 #include <string>
00044 #include <string.h>
00045 #include <stdlib.h>
00046 #include <boost/algorithm/string.hpp>
00047 #include <sstream>
00048
00049 #include <pcl/pcl_macros.h>
00050
00051 namespace pcl
00052 {
00053 namespace console
00054 {
00064 PCL_EXPORTS bool
00065 find_switch (int argc, char** argv, const char* argument_name);
00066
00073 PCL_EXPORTS int
00074 find_argument (int argc, char** argv, const char* argument_name);
00075
00083 template<typename Type> int
00084 parse (int argc, char** argv, const char* argument_name, Type& value)
00085 {
00086 int index = find_argument (argc, argv, argument_name) + 1;
00087
00088 if (index > 0 && index < argc)
00089 {
00090 std::istringstream stream;
00091 stream.clear ();
00092 stream.str (argv[index]);
00093 stream >> value;
00094 }
00095
00096 return (index - 1);
00097 }
00098
00106 PCL_EXPORTS int
00107 parse_argument (int argc, char** argv, const char* str, std::string &val);
00108
00116 PCL_EXPORTS int
00117 parse_argument (int argc, char** argv, const char* str, bool &val);
00118
00126 PCL_EXPORTS int
00127 parse_argument (int argc, char** argv, const char* str, float &val);
00128
00136 PCL_EXPORTS int
00137 parse_argument (int argc, char** argv, const char* str, double &val);
00138
00146 PCL_EXPORTS int
00147 parse_argument (int argc, char** argv, const char* str, int &val);
00148
00156 PCL_EXPORTS int
00157 parse_argument (int argc, char** argv, const char* str, unsigned int &val);
00158
00166 PCL_EXPORTS int
00167 parse_argument (int argc, char** argv, const char* str, char &val);
00168
00178 PCL_EXPORTS int
00179 parse_2x_arguments (int argc, char** argv, const char* str, float &f, float &s, bool debug = true);
00180
00190 PCL_EXPORTS int
00191 parse_2x_arguments (int argc, char** argv, const char* str, double &f, double &s, bool debug = true);
00192
00202 PCL_EXPORTS int
00203 parse_2x_arguments (int argc, char** argv, const char* str, int &f, int &s, bool debug = true);
00204
00215 PCL_EXPORTS int
00216 parse_3x_arguments (int argc, char** argv, const char* str, float &f, float &s, float &t, bool debug = true);
00217
00228 PCL_EXPORTS int
00229 parse_3x_arguments (int argc, char** argv, const char* str, double &f, double &s, double &t, bool debug = true);
00230
00241 PCL_EXPORTS int
00242 parse_3x_arguments (int argc, char** argv, const char* str, int &f, int &s, int &t, bool debug = true);
00243
00251 PCL_EXPORTS int
00252 parse_x_arguments (int argc, char** argv, const char* str, std::vector<double>& v);
00253
00261 PCL_EXPORTS int
00262 parse_x_arguments (int argc, char** argv, const char* str, std::vector<float>& v);
00263
00271 PCL_EXPORTS int
00272 parse_x_arguments (int argc, char** argv, const char* str, std::vector<int>& v);
00273
00281 PCL_EXPORTS bool
00282 parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<int> &values);
00283
00291 PCL_EXPORTS bool
00292 parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<float> &values);
00293
00301 PCL_EXPORTS bool
00302 parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<double> &values);
00303
00311 PCL_EXPORTS bool
00312 parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<std::string> &values);
00313
00323 PCL_EXPORTS bool
00324 parse_multiple_2x_arguments (int argc, char** argv, const char* str,
00325 std::vector<double> &values_f,
00326 std::vector<double> &values_s);
00327
00338 PCL_EXPORTS bool
00339 parse_multiple_3x_arguments (int argc, char** argv, const char* str,
00340 std::vector<double> &values_f,
00341 std::vector<double> &values_s,
00342 std::vector<double> &values_t);
00343
00350 PCL_EXPORTS std::vector<int>
00351 parse_file_extension_argument (int argc, char** argv, const std::string &ext);
00352 }
00353 }
00354
00355 #endif // PCL_CONSOLE_PARSE_H_
00356