Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
berryJob.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef _BERRY_JOB_H
14 #define _BERRY_JOB_H
15 
16 #include <Poco/Thread.h>
17 
19 #include "berryJobExceptions.h"
20 #include "internal/berryInternalJob.h"
21 
22 #include <berryObject.h>
23 
24 #include <string>
25 
26 namespace berry
27 {
28 
29 struct IJobManager;
30 
58 class BERRY_JOBS Job: public InternalJob
59 {
60 
61 public:
62 
64 
71 
72  /* Job priorities */
83  static const int INTERACTIVE = 10;
94  static const int SHORT = 20;
102  static const int LONG = 30;
110  static const int BUILD = 40;
111 
121  static const int DECORATE = 50;
129  static const int NONE = 0;
135  static const int SLEEPING = 0x01;
141  static const int WAITING = 0x02;
147  static const int RUNNING = 0x04;
148 
154  static const IJobManager* GetJobManager();
155 
163  Job(const QString& name);
164 
171  void AddJobChangeListener(IJobChangeListener* listener);
172 
188  bool BelongsTo(Object::Pointer family) override;
189 
200  bool Cancel();
201 
217  void Done(IStatus::Pointer result);
218 
225  QString GetName() const;
226 
234  int GetPriority() const;
235 
242  IStatus::Pointer GetResult() const ;
243 
252  ISchedulingRule::Pointer GetRule() const;
253 
272  int GetState() const;
273 
280  Poco::Thread* GetThread() const;
281 
292  bool IsBlocking();
293 
304  bool IsSystem() const;
305 
315  bool IsUser() const;
316 
323  void RemoveJobChangeListener(IJobChangeListener* listener);
324 
325 
334  void Schedule();
335 
358  void Schedule(Poco::Timestamp::TimeDiff delay);
359 
370  void SetName(const QString& name);
371 
380  void SetPriority(int priority);
381 
399  void SetProgressGroup(IProgressMonitor::Pointer group, int ticks);
400 
409  void SetRule(ISchedulingRule::Pointer rule);
410 
422  void SetSystem(bool value);
423 
433  void SetUser(bool value);
434 
447  void SetThread(Poco::Thread* thread);
448 
466  virtual bool ShouldRun();
467 
484  bool ShouldSchedule() override;
485 
498  bool Sleep();
499 
510  void WakeUp();
511 
521  void WakeUp(long delay);
522 
523 
524 protected:
525 
533  void Canceling() override;
534 
560  IStatus::Pointer Run(IProgressMonitor::Pointer myProgressMonitor) override = 0;
561 
562 };
563 
564 }
565 #endif /* BERRY_JOB_H */
org_blueberry_core_jobs_Export.h
berry::Job::ASYNC_FINISH
static const IStatus::Pointer ASYNC_FINISH
Definition: berryJob.h:70
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
berry::IJobChangeListener
Definition: berryIJobChangeListener.h:43
berry::Job
Definition: berryJob.h:58
berry::IJobManager
Definition: berryIJobManager.h:54
berryJobExceptions.h
berry::Object::Pointer
berry::SmartPointer< Self > Pointer
Definition: berryObject.h:82
berryObjectMacro
#define berryObjectMacro(...)
Definition: berryMacros.h:31
BERRY_JOBS
#define BERRY_JOBS
Definition: org_blueberry_core_jobs_Export.h:26
berryObject.h
berry
Definition: QmitkPropertyItemModel.h:24
GlobalReinitAction::Run
MITK_QT_APP void Run(berry::IWorkbenchPartSite::Pointer workbenchPartSite, mitk::DataStorage::Pointer dataStorage)