Wyatt  1.0.1
Command.h
1 #pragma once
2 
3 #include <string>
4 #include <mutex>
5 
6 class Command {
7 public:
11  Command();
15  virtual ~Command();
16 
20  void init();
30  virtual bool execute() = 0;
37  virtual bool cleanup(bool canceled) = 0;
47  void cancel();
53  void stop();
58  bool isRunning();
63  bool isInitialized();
68  void setIsRunning(bool value);
73  bool isFinished();
74 protected:
76  std::mutex m_lock;
77 private:
79  bool m_is_running = false;
81  bool m_is_initialized = false;
83  bool m_is_finished = false;
84 };
bool isInitialized()
Definition: Command.cpp:49
Command()
Definition: Command.cpp:7
void setIsRunning(bool value)
Definition: Command.cpp:57
void cancel()
Definition: Command.cpp:23
void stop()
Definition: Command.cpp:32
virtual ~Command()
Definition: Command.cpp:12
std::mutex m_lock
Lock for managing access to member variables in a thread-safe manner.
Definition: Command.h:76
virtual bool cleanup(bool canceled)=0
Definition: Command.h:6
void init()
Definition: Command.cpp:16
virtual bool execute()=0
bool isFinished()
Definition: Command.cpp:64
bool isRunning()
Definition: Command.cpp:41