Wyatt  1.0.1
Command.cpp
1 //
2 // Created by Arthur Lockman on 4/5/17.
3 //
4 
5 #include "Command.h"
6 
8 {
9 
10 }
11 
13 
14 }
15 
17 {
18  m_lock.lock();
19  m_is_initialized = true;
20  m_lock.unlock();
21 }
22 
24 {
25  m_lock.lock();
26  m_is_running = false;
27  this->cleanup(true);
28  m_is_finished = true;
29  m_lock.unlock();
30 }
31 
33 {
34  m_lock.lock();
35  m_is_running = false;
36  this->cleanup(false);
37  m_is_finished = true;
38  m_lock.unlock();
39 }
40 
42 {
43  m_lock.lock();
44  bool tmp = m_is_running;
45  m_lock.unlock();
46  return tmp;
47 }
48 
50 {
51  m_lock.lock();
52  bool tmp = m_is_initialized;
53  m_lock.unlock();
54  return tmp;
55 }
56 
57 void Command::setIsRunning(bool value)
58 {
59  m_lock.lock();
60  m_is_running = value;
61  m_lock.unlock();
62 }
63 
65 {
66  m_lock.lock();
67  bool tmp = m_is_finished;
68  m_lock.unlock();
69  return tmp;
70 }
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
void init()
Definition: Command.cpp:16
bool isFinished()
Definition: Command.cpp:64
bool isRunning()
Definition: Command.cpp:41