Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
berryIJobChangeListener.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 
18 
19 namespace berry
20 {
21 
23 {
24  if (!listener)
25  return;
26 
27  Types types = listener->GetEventTypes();
28 
29  if (types & ABOUT_TO_RUN)
31  if (types & AWAKE)
33  if (types & DONE)
35  if (types & RUNNING)
37  if (types & SCHEDULED)
39  if (types & SLEEPING)
41 }
42 
44 {
45  if (!listener)
46  return;
47 
48  jobAboutToRun -= Delegate(listener, &IJobChangeListener::AboutToRun);
49  jobAwake -= Delegate(listener, &IJobChangeListener::Awake);
50  jobDone -= Delegate(listener, &IJobChangeListener::Done);
51  jobRunning -= Delegate(listener, &IJobChangeListener::Running);
52  jobScheduled -= Delegate(listener, &IJobChangeListener::Scheduled);
53  jobSleeping -= Delegate(listener, &IJobChangeListener::Sleeping);
54 }
55 
57 {
58  jobAboutToRun.SetExceptionHandler(handler);
59  jobAwake.SetExceptionHandler(handler);
60  jobDone.SetExceptionHandler(handler);
61  jobRunning.SetExceptionHandler(handler);
62  jobScheduled.SetExceptionHandler(handler);
63  jobSleeping.SetExceptionHandler(handler);
64 }
65 
66 }
static MsgHandler handler
Definition: usUtils.cpp:261
virtual void Sleeping(const IJobChangeEvent::ConstPointer &)
virtual void Scheduled(const IJobChangeEvent::ConstPointer &)
void AddListener(IJobChangeListener *listener)
MessageDelegate1< IJobChangeListener, const IJobChangeEvent::ConstPointer & > Delegate
virtual void Running(const IJobChangeEvent::ConstPointer &)
void RemoveListener(IJobChangeListener *listener)
void SetExceptionHandler(const AbstractExceptionHandler &handler)
virtual void AboutToRun(const IJobChangeEvent::ConstPointer &)
virtual void Awake(const IJobChangeEvent::ConstPointer &)
virtual Events::Types GetEventTypes()=0
virtual void Done(const IJobChangeEvent::ConstPointer &)