mt4cpp
TickCommand.hpp
Go to the documentation of this file.
1 /**
2  * \file TickCommand.hpp
3  * \brief Module with testing command (progress after every 0.02 s).
4  */
5 
6 
7 #ifndef MT4CPP_TICK_COMMAND_HPP
8 #define MT4CPP_TICK_COMMAND_HPP
9 
10 //file with some testing commands
11 
12 #include "Command.hpp"
13 
14 namespace mt4cpp {
15 
16  /*! \brief
17  Testing concrete command class.
18  This commands waits for some time checking halt flag.
19  */
20  class TickCommand : public Command {
21  public:
22  TickCommand(int steps = 10) : steps_(steps) {}
23  virtual ~TickCommand() {}
24 
25  virtual void operator()(Progress& progress) {
26  for(int i=0;i<steps_;++i) {
27  boost::this_thread::sleep_for(boost::chrono::milliseconds(20)); //sleep 0.02 s
28  progress.setProgress(i/(double)steps_);
29  }
30  }
31  private:
32  int steps_;
33  };
34 
35 } //namespace mt4cpp
36 
37 #endif
The command module (Command base class, progress, command description).
virtual void operator()(Progress &progress)
Definition: TickCommand.hpp:25
Definition: Command.hpp:21
Definition: Command.hpp:120
Testing concrete command class. This commands waits for some time checking halt flag.
Definition: TickCommand.hpp:20
class to set the progress of given command. Subject in Obverver design pattern. It also check the 'ha...
Definition: Command.hpp:74