Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryJob.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "berryJob.h"
18 #include "berryIJobManager.h"
19 #include "internal/berryJobManager.h"
20 #include "berryIStatus.h"
21 #include "berryStatus.h"
22 
23 #include <string>
24 
25 namespace berry
26 {
27 
28 
29 
31  new Status (IStatus::OK_TYPE, JobManager::PI_JOBS(),
32  1,
33  "",
34  berry::Status::SourceLocation(__FILE__, "berry::Job::ASYNC_FINISH", __LINE__)
35  ));
36 
37 Job::Job(const QString& name)
38  : InternalJob(name)
39 {
40 }
41 
43 {
44  return ptr_manager;
45 }
46 
47 
49 {
50  return false;
51 }
52 
54 {
55  return InternalJob::Cancel();
56 }
57 
59 {
60  InternalJob::Done(result);
61 }
62 
63 QString Job::GetName() const
64 {
65  return InternalJob::GetName();
66 }
67 
68 int Job::GetPriority() const
69 {
70  return InternalJob::GetPriority();
71 }
72 
73 // TODO QualifiedName muss noch implementiert werden
74 // Object Job::GetProperty(QualifiedName key)
75 // {
76 // return InternalJob::GetProperty(key);
77 // }
78 
79 
81  {
82  return InternalJob::GetResult();
83  }
84 
86 {
87  return InternalJob::GetRule();
88 }
89 
90 int Job::GetState() const
91 {
92  return InternalJob::GetState();
93 }
94 
95 Poco::Thread*
97 {
98  return InternalJob::GetThread();
99 }
100 
102 {
103  return InternalJob::IsBlocking();
104 }
105 
106 bool Job::IsSystem() const
107 {
108  return InternalJob::IsSystem();
109 }
110 
111 bool Job::IsUser() const
112 {
113  return InternalJob::IsUser();
114 }
115 
116 // TODO Join
117 //void Job::Join()
118 // throw (InterruptedException)
119 // {
120 // InternalJob::Join();
121 // }
122 
124 {
125  InternalJob::RemoveJobChangeListener(listener);
126 }
127 
129 {
130  Poco::Timestamp::TimeDiff tmpNoDelay = 0;
131  InternalJob::Schedule(tmpNoDelay);
132 }
133 
134 void Job::Schedule(Poco::Timestamp::TimeDiff delay)
135 {
136  InternalJob::Schedule(delay);
137 }
138 
139 void Job::SetName(const QString& name)
140 {
141  InternalJob::SetName(name);
142 }
143 
144 void Job::SetPriority(int priority)
145 {
146  InternalJob::SetPriority(priority);
147 }
148 
150 {
151  InternalJob::SetProgressGroup(group, ticks);
152 }
153 
154 // TODO SetProperty
155 // void Job::SetProperty(QualifiedName key, Object value)
156 // {
157 // InternalJob::SetProperty(key, value);
158 // }
159 
161 {
162  InternalJob::SetRule(rule);
163 }
164 
165 void Job::SetSystem(bool value)
166 {
167  InternalJob::SetSystem(value);
168 }
169 
170 void Job::SetUser(bool value)
171 {
172  InternalJob::SetUser(value);
173 }
174 
175 void Job::SetThread(Poco::Thread* thread)
176 {
177  InternalJob::SetThread(thread);
178 }
179 
181 {
182  return true;
183 }
184 
186 {
187  return true;
188 }
189 
191 {
192  return InternalJob::Sleep();
193 }
194 
196 {
197  InternalJob::WakeUp(0);
198 }
199 
200 void Job::WakeUp(long delay)
201 {
202  InternalJob::WakeUp(delay);
203 }
204 
206 {
207  //default implementation does nothing
208 }
209 
210 }
void SetSystem(bool value)
Definition: berryJob.cpp:165
berry::SmartPointer< Self > Pointer
Definition: berryIStatus.h:58
static const IJobManager * GetJobManager()
Definition: berryJob.cpp:42
bool IsBlocking()
Definition: berryJob.cpp:101
int GetState() const
Definition: berryJob.cpp:90
void WakeUp()
Definition: berryJob.cpp:195
IStatus::Pointer GetResult() const
Object GetProperty(QualifiedName key) const ;.
Definition: berryJob.cpp:80
virtual bool ShouldRun()
Definition: berryJob.cpp:180
bool IsUser() const
Definition: berryJob.cpp:111
Job(const QString &name)
Definition: berryJob.cpp:37
void SetUser(bool value)
Definition: berryJob.cpp:170
virtual void Canceling() override
Definition: berryJob.cpp:205
static const IStatus::Pointer ASYNC_FINISH
Definition: berryJob.h:76
void RemoveJobChangeListener(IJobChangeListener *listener)
void Join() ;
Definition: berryJob.cpp:123
ISchedulingRule::Pointer GetRule() const
Definition: berryJob.cpp:85
int GetPriority() const
Definition: berryJob.cpp:68
Poco::Thread * GetThread() const
Definition: berryJob.cpp:96
virtual bool ShouldSchedule() override
Definition: berryJob.cpp:185
QString GetName() const
Definition: berryJob.cpp:63
void Done(IStatus::Pointer result)
Definition: berryJob.cpp:58
void SetProgressGroup(IProgressMonitor::Pointer group, int ticks)
Definition: berryJob.cpp:149
bool BelongsTo(Object::Pointer family) override
Definition: berryJob.cpp:48
void SetName(const QString &name)
Definition: berryJob.cpp:139
void SetPriority(int priority)
Definition: berryJob.cpp:144
bool IsSystem() const
Definition: berryJob.cpp:106
bool Sleep()
Definition: berryJob.cpp:190
static std::string GetName(std::string fileName, std::string suffix)
void Schedule()
Definition: berryJob.cpp:128
void SetThread(Poco::Thread *thread)
Definition: berryJob.cpp:175
void SetRule(ISchedulingRule::Pointer rule)
void SetProperty(QualifiedName key, Object value);
Definition: berryJob.cpp:160
bool Cancel()
Definition: berryJob.cpp:53