Skip to content

Commit

Permalink
[PARSE] Constness of the API for the cli parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
frozar committed Feb 22, 2018
1 parent e84fdcd commit 50b2f48
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 51 deletions.
52 changes: 26 additions & 26 deletions common/include/pcl/console/parse.h
Expand Up @@ -56,7 +56,7 @@ namespace pcl
* \note find_switch is simply returning find_argument != -1.
*/
PCL_EXPORTS bool
find_switch (int argc, char** argv, const char* argument_name);
find_switch (const int & argc, const char *const *const & argv, const char *const & argument_name);

/** \brief Finds the position of the argument with name "argument_name" in the argument list "argv"
* \param[in] argc the number of command line arguments
Expand All @@ -65,7 +65,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
find_argument (int argc, char** argv, const char* argument_name);
find_argument (const int & argc, const char *const *const & argv, const char *const & argument_name);

/** \brief Template version for parsing arguments. Template parameter needs to have input stream operator overloaded!
* \param[in] argc the number of command line arguments
Expand All @@ -75,7 +75,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
template<typename Type> int
parse (int argc, char** argv, const char* argument_name, Type& value)
parse (const int & argc, const char *const *const & argv, const char *const & argument_name, Type& value)
{
int index = find_argument (argc, argv, argument_name) + 1;

Expand All @@ -98,7 +98,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_argument (int argc, char** argv, const char* str, std::string &val);
parse_argument (const int & argc, const char *const *const & argv, const char *const & str, std::string &val);

/** \brief Parse for a specific given command line argument.
* \param[in] argc the number of command line arguments
Expand All @@ -108,7 +108,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_argument (int argc, char** argv, const char* str, bool &val);
parse_argument (const int & argc, const char *const *const & argv, const char *const & str, bool &val);

/** \brief Parse for a specific given command line argument.
* \param[in] argc the number of command line arguments
Expand All @@ -118,7 +118,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_argument (int argc, char** argv, const char* str, float &val);
parse_argument (const int & argc, const char *const *const & argv, const char *const & str, float &val);

/** \brief Parse for a specific given command line argument.
* \param[in] argc the number of command line arguments
Expand All @@ -128,7 +128,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_argument (int argc, char** argv, const char* str, double &val);
parse_argument (const int & argc, const char *const *const & argv, const char *const & str, double &val);

/** \brief Parse for a specific given command line argument.
* \param[in] argc the number of command line arguments
Expand All @@ -138,7 +138,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_argument (int argc, char** argv, const char* str, int &val);
parse_argument (const int & argc, const char *const *const & argv, const char *const & str, int &val);

/** \brief Parse for a specific given command line argument.
* \param[in] argc the number of command line arguments
Expand All @@ -148,7 +148,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_argument (int argc, char** argv, const char* str, unsigned int &val);
parse_argument (const int & argc, const char *const *const & argv, const char *const & str, unsigned int &val);

/** \brief Parse for a specific given command line argument.
* \param[in] argc the number of command line arguments
Expand All @@ -158,7 +158,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_argument (int argc, char** argv, const char* str, char &val);
parse_argument (const int & argc, const char *const *const & argv, const char *const & str, char &val);

/** \brief Parse for specific given command line arguments (2x values comma
* separated).
Expand All @@ -171,7 +171,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_2x_arguments (int argc, char** argv, const char* str, float &f, float &s, bool debug = true);
parse_2x_arguments (const int & argc, const char *const *const & argv, const char *const & str, float &f, float &s, bool debug = true);

/** \brief Parse for specific given command line arguments (2x values comma
* separated).
Expand All @@ -184,7 +184,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_2x_arguments (int argc, char** argv, const char* str, double &f, double &s, bool debug = true);
parse_2x_arguments (const int & argc, const char *const *const & argv, const char *const & str, double &f, double &s, bool debug = true);

/** \brief Parse for specific given command line arguments (2x values comma
* separated).
Expand All @@ -197,7 +197,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_2x_arguments (int argc, char** argv, const char* str, int &f, int &s, bool debug = true);
parse_2x_arguments (const int & argc, const char *const *const & argv, const char *const & str, int &f, int &s, bool debug = true);

/** \brief Parse for specific given command line arguments (3x values comma
* separated).
Expand All @@ -211,7 +211,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_3x_arguments (int argc, char** argv, const char* str, float &f, float &s, float &t, bool debug = true);
parse_3x_arguments (const int & argc, const char *const *const & argv, const char *const & str, float &f, float &s, float &t, bool debug = true);

/** \brief Parse for specific given command line arguments (3x values comma
* separated).
Expand All @@ -225,7 +225,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_3x_arguments (int argc, char** argv, const char* str, double &f, double &s, double &t, bool debug = true);
parse_3x_arguments (const int & argc, const char *const *const & argv, const char *const & str, double &f, double &s, double &t, bool debug = true);

/** \brief Parse for specific given command line arguments (3x values comma
* separated).
Expand All @@ -239,7 +239,7 @@ namespace pcl
* return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_3x_arguments (int argc, char** argv, const char* str, int &f, int &s, int &t, bool debug = true);
parse_3x_arguments (const int & argc, const char *const *const & argv, const char *const & str, int &f, int &s, int &t, bool debug = true);

/** \brief Parse for specific given command line arguments (3x values comma
* separated).
Expand All @@ -250,7 +250,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_x_arguments (int argc, char** argv, const char* str, std::vector<double>& v);
parse_x_arguments (const int & argc, const char *const *const & argv, const char *const & str, std::vector<double>& v);

/** \brief Parse for specific given command line arguments (N values comma
* separated).
Expand All @@ -261,7 +261,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_x_arguments (int argc, char** argv, const char* str, std::vector<float>& v);
parse_x_arguments (const int & argc, const char *const *const & argv, const char *const & str, std::vector<float>& v);

/** \brief Parse for specific given command line arguments (N values comma
* separated).
Expand All @@ -272,7 +272,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS int
parse_x_arguments (int argc, char** argv, const char* str, std::vector<int>& v);
parse_x_arguments (const int & argc, const char *const *const & argv, const char *const & str, std::vector<int>& v);

/** \brief Parse for specific given command line arguments (multiple occurences
* of the same command line parameter).
Expand All @@ -283,7 +283,7 @@ namespace pcl
* \return index of found argument or -1 if arguments do not appear in list
*/
PCL_EXPORTS bool
parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<int> &values);
parse_multiple_arguments (const int & argc, const char *const *const & argv, const char *const & str, std::vector<int> &values);

/** \brief Parse for specific given command line arguments (multiple occurences
* of the same command line parameter).
Expand All @@ -294,7 +294,7 @@ namespace pcl
* \return true if found, false otherwise
*/
PCL_EXPORTS bool
parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<float> &values);
parse_multiple_arguments (const int & argc, const char *const *const & argv, const char *const & str, std::vector<float> &values);

/** \brief Parse for specific given command line arguments (multiple occurences
* of the same command line parameter).
Expand All @@ -305,7 +305,7 @@ namespace pcl
* \return true if found, false otherwise
*/
PCL_EXPORTS bool
parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<double> &values);
parse_multiple_arguments (const int & argc, const char *const *const & argv, const char *const & str, std::vector<double> &values);

/** \brief Parse for a specific given command line argument (multiple occurences
* of the same command line parameter).
Expand All @@ -316,7 +316,7 @@ namespace pcl
* \return true if found, false otherwise
*/
PCL_EXPORTS bool
parse_multiple_arguments (int argc, char** argv, const char* str, std::vector<std::string> &values);
parse_multiple_arguments (const int & argc, const char *const *const & argv, const char *const & str, std::vector<std::string> &values);

/** \brief Parse command line arguments for file names with given extension (multiple occurences
* of 2x argument groups, separated by commas).
Expand All @@ -328,7 +328,7 @@ namespace pcl
* \return true if found, false otherwise
*/
PCL_EXPORTS bool
parse_multiple_2x_arguments (int argc, char** argv, const char* str,
parse_multiple_2x_arguments (const int & argc, const char *const *const & argv, const char *const & str,
std::vector<double> &values_f,
std::vector<double> &values_s);

Expand All @@ -343,7 +343,7 @@ namespace pcl
* \return true if found, false otherwise
*/
PCL_EXPORTS bool
parse_multiple_3x_arguments (int argc, char** argv, const char* str,
parse_multiple_3x_arguments (const int & argc, const char *const *const & argv, const char *const & str,
std::vector<double> &values_f,
std::vector<double> &values_s,
std::vector<double> &values_t);
Expand All @@ -355,7 +355,7 @@ namespace pcl
* \return a vector with file names indices
*/
PCL_EXPORTS std::vector<int>
parse_file_extension_argument (int argc, char** argv, const std::string &ext);
parse_file_extension_argument (const int & argc, const char *const *const & argv, const std::string &ext);
}
}

Expand Down

0 comments on commit 50b2f48

Please sign in to comment.