[cig-commits] r8922 - cs/benchmark/cigma/trunk/src

luis at geodynamics.org luis at geodynamics.org
Wed Dec 19 12:03:24 PST 2007


Author: luis
Date: 2007-12-19 12:03:23 -0800 (Wed, 19 Dec 2007)
New Revision: 8922

Modified:
   cs/benchmark/cigma/trunk/src/Command.cpp
   cs/benchmark/cigma/trunk/src/Command.h
Log:
Simplified base Command class

Modified: cs/benchmark/cigma/trunk/src/Command.cpp
===================================================================
--- cs/benchmark/cigma/trunk/src/Command.cpp	2007-12-19 20:03:15 UTC (rev 8921)
+++ cs/benchmark/cigma/trunk/src/Command.cpp	2007-12-19 20:03:23 UTC (rev 8922)
@@ -1,8 +1,15 @@
+#include <cassert>
 #include "Command.h"
 
-// ---------------------------------------------------------------------------
-
 cigma::Command::~Command()
 {
 }
 
+bool cigma::Command::helpFlag(AnyOption *opt)
+{
+    if (opt != 0)
+    {
+        return opt->getFlag("help") || opt->getFlag('h');
+    }
+    return false;
+}

Modified: cs/benchmark/cigma/trunk/src/Command.h
===================================================================
--- cs/benchmark/cigma/trunk/src/Command.h	2007-12-19 20:03:15 UTC (rev 8921)
+++ cs/benchmark/cigma/trunk/src/Command.h	2007-12-19 20:03:23 UTC (rev 8922)
@@ -3,6 +3,8 @@
 
 #include <map>
 
+#include "AnyOption.h"
+
 namespace cigma
 {
     class Command;
@@ -16,18 +18,15 @@
 class cigma::Command
 {
 public:
-    typedef std::map<std::string, std::string> StringMap;
-    typedef std::vector<std::string> StringVector;
+    virtual ~Command();
 
 public:
-    virtual ~Command();
+    virtual void setupOptions(AnyOption *opt) = 0;
 
 public:
-    //virtual void parse(int argc, char *argv[], StringMap &params) = 0;
-    //virtual void configure(const StringMap &params) = 0;
-    virtual void configure(int argc, char *argv[]) = 0;
-    virtual void help() = 0;
-    virtual void run() = 0;
+    virtual bool helpFlag(AnyOption *opt);
+    virtual void configure(AnyOption *opt) = 0;
+    virtual int run() = 0;
 
 public:
     std::string name;



More information about the cig-commits mailing list