Eris  1.4.0
Task.h
1 #ifndef ERIS_TASK_H
2 #define ERIS_TASK_H
3 
4 #include <sigc++/trackable.h>
5 #include <sigc++/signal.h>
6 
7 #include <map>
8 #include <string>
9 
10 namespace Atlas {
11  namespace Message {
12  class Element;
13  typedef std::map<std::string, Element> MapType;
14  }
15 }
16 
17 namespace WFMath { class TimeDiff; }
18 
19 namespace Eris
20 {
21 
22 class Entity;
23 class View;
24 
25 class Task : public sigc::trackable
26 {
27 public:
28  virtual ~Task();
29 
34  const std::string& name() const;
35 
40  double progress() const;
41 
46  bool isComplete() const;
47 
48  sigc::signal<void> Completed;
49 
50  sigc::signal<void> Cancelled;
51 
52  sigc::signal<void> Progressed;
53 
54  sigc::signal<void> ProgressRateChanged;
55 
56 private:
57  void progressChanged();
58 
59  friend class View; // so it can call updateProgress
60  friend class Entity; // for constructor and updateFromAtlas
61 
65  Task(Entity* owner, const std::string& nm);
66 
67  void updateFromAtlas(const Atlas::Message::MapType& d);
68 
72  void updatePredictedProgress(const WFMath::TimeDiff& dt);
73 
74  const std::string m_name;
75  Entity* m_owner;
76  double m_progress;
77 
79  double m_progressRate;
80 };
81 
82 inline const std::string& Task::name() const
83 {
84  return m_name;
85 }
86 
87 inline double Task::progress() const
88 {
89  return m_progress;
90 }
91 
92 
93 }
94 
95 #endif
Definition: Task.h:17
View encapsulates the set of entities currently visible to an Avatar, as well as those that have rece...
Definition: View.h:37
Every Eris class and type lives inside the Eris namespace; certain utility functions live in the Util...
Definition: Account.cpp:34
Entity is a concrete (instantiable) class representing one game entity.
Definition: Entity.h:58
Definition: Task.h:25
Definition: BaseConnection.h:18