diff Applications/Commands/ICommand.h @ 307:be2660b6e40a am-callable-and-promise

wip: commands + status update
author am@osimis.io
date Tue, 25 Sep 2018 15:14:53 +0200
parents b04b13810540
children daa04d15192c
line wrap: on
line diff
--- a/Applications/Commands/ICommand.h	Tue Sep 18 18:20:10 2018 +0200
+++ b/Applications/Commands/ICommand.h	Tue Sep 25 15:14:53 2018 +0200
@@ -30,14 +30,14 @@
   class ICommand  // TODO noncopyable
   {
   protected:
-    const char* name_;
-    ICommand(const char* name)
+    std::string name_;
+    ICommand(const std::string& name)
       : name_(name)
     {}
   public:
     virtual void Execute() = 0;
-    virtual void Configure(const Json::Value& arguments) = 0;
-    const char* GetName()
+//    virtual void Configure(const Json::Value& arguments) = 0;
+    const std::string& GetName() const
     {
       return name_;
     }
@@ -45,10 +45,10 @@
 
 
   template <typename TCommand>
-  class BaseCommand : ICommand
+  class BaseCommand : public ICommand
   {
   protected:
-    BaseCommand(const char* name)
+    BaseCommand(const std::string& name)
       : ICommand(name)
     {}
 
@@ -70,5 +70,13 @@
     virtual void Execute() {}
   };
 
+  class SimpleCommand : public BaseCommand<SimpleCommand>
+  {
+  public:
+    SimpleCommand(const std::string& name)
+      : BaseCommand(name)
+    {}
+    virtual void Execute() {} // TODO currently not used but this is not nice at all !
+  };
 
 }