Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkCallbackFromGUIThread.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
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 #include <mitkLogMacros.h>
19 
20 mitk::CallbackFromGUIThread *mitk::CallbackFromGUIThread::m_Instance = nullptr;
21 mitk::CallbackFromGUIThreadImplementation *mitk::CallbackFromGUIThread::m_Implementation = nullptr;
22 
23 namespace mitk
24 {
27  {
28  if (!m_Instance)
29  {
30  m_Instance = new CallbackFromGUIThread();
31  }
32 
33  return m_Instance;
34  }
35 
37  {
38  m_Implementation = implementation;
39  }
40 
41  void CallbackFromGUIThread::CallThisFromGUIThread(itk::Command *cmd, itk::EventObject *e)
42  {
43  if (m_Implementation)
44  {
45  m_Implementation->CallThisFromGUIThread(cmd, e);
46  }
47  else
48  {
49  MITK_ERROR << "in mitk::CallbackFromGUIThread::CallbackFromGUIThread(): no implementation registered."
50  << std::endl;
51  }
52  }
53 
54 } // namespace
Toolkit specific implementation of mitk::CallbackFromGUIThread.
virtual void CallThisFromGUIThread(itk::Command *, itk::EventObject *)=0
Change the current application cursor.
static void RegisterImplementation(CallbackFromGUIThreadImplementation *implementation)
To be called by a toolkit specific CallbackFromGUIThreadImplementation.
#define MITK_ERROR
Definition: mitkLogMacros.h:24
CallbackFromGUIThread()
Purposely hidden - singleton.
DataCollection - Class to facilitate loading/accessing structured data.
Allows threads to call some method from within the GUI thread.
void CallThisFromGUIThread(itk::Command *, itk::EventObject *e=nullptr)
Change the current application cursor.
static CallbackFromGUIThread * GetInstance()
This class is a singleton.