source: molecuilder/src/Actions/Process.hpp@ d06198

Last change on this file since d06198 was b53a7e, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Added a special class of Actions that take some time.

  • Property mode set to 100644
File size: 1017 bytes
Line 
1/*
2 * Process.hpp
3 *
4 * Created on: Feb 17, 2010
5 * Author: crueger
6 */
7
8
9/**
10 * A Process is an action that might take some time and therfore contains methods
11 * that allows showing how much is done.
12 */
13#ifndef PROCESS_HPP_
14#define PROCESS_HPP_
15
16#include <set>
17
18#include "Patterns/Observer.hpp"
19#include "Actions/Action.hpp"
20
21class Process : public Action, public Observable
22{
23public:
24 Process(int _maxSteps, std::string _name, bool _doRegister=true);
25 virtual ~Process();
26
27 bool isActive();
28 bool doesStart();
29 bool doesStop();
30 int getCurrStep();
31 float getDoneRatio();
32 int getMaxSteps();
33
34protected:
35 void start();
36 void step();
37 void stop();
38
39private:
40 int currStep;
41 int maxSteps;
42 bool active;
43 bool starts;
44 bool stops;
45
46 // some global static stuff to allow general Observers that can show progresses
47public:
48 static void AddObserver(Observer *);
49 static void RemoveObserver(Observer *);
50private:
51 static std::set<Observer*> processObservers;
52};
53
54#endif /* PROCESS_HPP_ */
Note: See TracBrowser for help on using the repository browser.