[mlpack-git] master: fix naming in cli.hpp (2f2eb93)

gitdub at mlpack.org gitdub at mlpack.org
Mon Jun 6 09:25:00 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/4fa39b6ab0baa1428116d0406264b5452e716d06...97402b9098d9d72889aa795923cf8fd67a4d87bf

>---------------------------------------------------------------

commit 2f2eb939e6119e9ec2cca6f8c4dc7ce86c61dfc0
Author: Keon Kim <kwk236 at gmail.com>
Date:   Mon Jun 6 09:42:20 2016 +0900

    fix naming in cli.hpp


>---------------------------------------------------------------

2f2eb939e6119e9ec2cca6f8c4dc7ce86c61dfc0
 src/mlpack/core/util/cli.cpp      | 22 +++++++++++-----------
 src/mlpack/core/util/cli_impl.hpp | 14 +++++++-------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/mlpack/core/util/cli.cpp b/src/mlpack/core/util/cli.cpp
index 0eaf543..626e5af 100644
--- a/src/mlpack/core/util/cli.cpp
+++ b/src/mlpack/core/util/cli.cpp
@@ -100,18 +100,18 @@ CLI::~CLI()
  * @param alias An alias for the parameter.
  * @param required Indicates if parameter must be set on command line.
  */
-void CLI::Add(const std::string& path,
-             const std::string& description,
-             const std::string& alias,
-             bool required)
+void CLI::Add(const std::string& identifier,
+              const std::string& description,
+              const std::string& alias,
+              bool required)
 {
   po::options_description& desc = CLI::GetSingleton().desc;
 
   // Must make use of boost option name syntax.
-  std::string progOptId = alias.length() ? path + "," + alias : path;
+  std::string progOptId = alias.length() ? identifier + "," + alias : identifier;
 
   // Deal with a required alias.
-  AddAlias(alias, path);
+  AddAlias(alias, identifier);
 
   // Add the option to boost::program_options.
   desc.add_options()(progOptId.c_str(), description.c_str());
@@ -122,15 +122,15 @@ void CLI::Add(const std::string& path,
   ParamData data;
   data.desc = description;
   data.tname = "";
-  data.name = path;
+  data.name = identifier;
   data.isFlag = false;
   data.wasPassed = false;
 
-  gmap[path] = data;
+  gmap[identifier] = data;
 
   // If the option is required, add it to the required options list.
   if (required)
-    GetSingleton().requiredOptions.push_front(path);
+    GetSingleton().requiredOptions.push_front(identifier);
 
   return;
 }
@@ -155,8 +155,8 @@ void CLI::AddAlias(const std::string& alias, const std::string& original)
  * @brief Adds a flag parameter to CLI.
  */
 void CLI::AddFlag(const std::string& identifier,
-                 const std::string& description,
-                 const std::string& alias)
+                  const std::string& description,
+                  const std::string& alias)
 {
   // Reuse functionality from Add().
   Add(identifier, description, alias, false);
diff --git a/src/mlpack/core/util/cli_impl.hpp b/src/mlpack/core/util/cli_impl.hpp
index 72f4be2..1960618 100644
--- a/src/mlpack/core/util/cli_impl.hpp
+++ b/src/mlpack/core/util/cli_impl.hpp
@@ -28,7 +28,7 @@ namespace mlpack {
  *   unless the parameter is specified.
  */
 template<typename T>
-void CLI::Add(const std::string& path,
+void CLI::Add(const std::string& identifier,
               const std::string& description,
               const std::string& alias,
               bool required)
@@ -36,10 +36,10 @@ void CLI::Add(const std::string& path,
 
   po::options_description& desc = CLI::GetSingleton().desc;
   // Must make use of boost syntax here.
-  std::string progOptId = alias.length() ? path + "," + alias : path;
+  std::string progOptId = alias.length() ? identifier + "," + alias : identifier;
 
   // Add the alias, if necessary
-  AddAlias(alias, path);
+  AddAlias(alias, identifier);
 
   // Add the option to boost program_options.
   desc.add_options()(progOptId.c_str(), po::value<T>(), description.c_str());
@@ -51,16 +51,16 @@ void CLI::Add(const std::string& path,
   T tmp = T();
 
   data.desc = description;
-  data.name = path;
+  data.name = identifier;
   data.tname = TYPENAME(T);
   data.value = boost::any(tmp);
   data.wasPassed = false;
 
-  gmap[path] = data;
+  gmap[identifier] = data;
 
   // If the option is required, add it to the required options list.
   if (required)
-    GetSingleton().requiredOptions.push_front(path);
+    GetSingleton().requiredOptions.push_front(identifier);
 }
 
 // We specialize this in cli.cpp.
@@ -73,7 +73,7 @@ bool& CLI::GetParam<bool>(const std::string& identifier);
  *   more or less valid value is returned.
  *
  * @tparam T The type of the parameter.
- * @param identifier The full pathname of the parameter.
+ * @param identifier The full name of the parameter.
  *
  * @return The value of the parameter.  Use CLI::CheckValue to determine if it's
  *     valid.




More information about the mlpack-git mailing list