Last change
on this file since 98a2987 was 5d4edf, checked in by Tillmann Crueger <crueger@…>, 16 years ago |
Added a class that allows constructing Processes that have a result
|
-
Property mode
set to
100644
|
File size:
1.1 KB
|
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 |
|
---|
21 | class Process : public Action, public Observable
|
---|
22 | {
|
---|
23 | public:
|
---|
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 | void setCurrStep(int _currStep);
|
---|
32 | float getDoneRatio();
|
---|
33 | int getMaxSteps();
|
---|
34 | void setMaxSteps(int _maxSteps);
|
---|
35 |
|
---|
36 | protected:
|
---|
37 | void start();
|
---|
38 | void step();
|
---|
39 | void stop();
|
---|
40 |
|
---|
41 | private:
|
---|
42 | int currStep;
|
---|
43 | int maxSteps;
|
---|
44 | bool active;
|
---|
45 | bool starts;
|
---|
46 | bool stops;
|
---|
47 |
|
---|
48 | // some global static stuff to allow general Observers that can show progresses
|
---|
49 | public:
|
---|
50 | static void AddObserver(Observer *);
|
---|
51 | static void RemoveObserver(Observer *);
|
---|
52 | private:
|
---|
53 | static std::set<Observer*> processObservers;
|
---|
54 | };
|
---|
55 |
|
---|
56 | #endif /* PROCESS_HPP_ */
|
---|
Note:
See
TracBrowser
for help on using the repository browser.