Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 (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 
14 #include <mitkLogMacros.h>
15 
16 mitk::CallbackFromGUIThread *mitk::CallbackFromGUIThread::m_Instance = nullptr;
17 mitk::CallbackFromGUIThreadImplementation *mitk::CallbackFromGUIThread::m_Implementation = nullptr;
18 
19 namespace mitk
20 {
23  {
24  if (!m_Instance)
25  {
26  m_Instance = new CallbackFromGUIThread();
27  }
28 
29  return m_Instance;
30  }
31 
33  {
34  m_Implementation = implementation;
35  }
36 
37  void CallbackFromGUIThread::CallThisFromGUIThread(itk::Command *cmd, itk::EventObject *e)
38  {
39  if (m_Implementation)
40  {
41  m_Implementation->CallThisFromGUIThread(cmd, e);
42  }
43  else
44  {
45  MITK_ERROR << "in mitk::CallbackFromGUIThread::CallbackFromGUIThread(): no implementation registered."
46  << std::endl;
47  }
48  }
49 
50 } // 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:20
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.