Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkToolManagerProvider.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 
19 // micro service includes
20 #include <usGetModuleContext.h>
21 #include <usServiceReference.h>
22 
24 {
25 }
26 
28 {
29  this->m_ToolManager = NULL;
30 }
31 
33 {
34  return this->m_ToolManager.GetPointer();
35 }
36 
38 {
40  static us::ModuleContext *context = us::GetModuleContext();
41  if (!serviceRef)
42  {
43  // This is either the first time GetInstance() was called,
44  // or a SingletonOneService instance has not yet been registered.
45  serviceRef = context->GetServiceReference<mitk::ToolManagerProvider>();
46  }
47  if (serviceRef)
48  {
49  // We have a valid service reference. It always points to the service
50  // with the lowest id (usually the one which was registered first).
51  // This still might return a null pointer, if all SingletonOneService
52  // instances have been unregistered (during unloading of the library,
53  // for example).
54  return context->GetService<mitk::ToolManagerProvider>(serviceRef);
55  }
56  else
57  {
58  // No SingletonOneService instance was registered yet.
59  return 0;
60  }
61 }
DataCollection - Class to facilitate loading/accessing structured data.
virtual mitk::ToolManager * GetToolManager()
Returns ToolManager object.
Micro Service Singleton to get an instance of mitk::ToolManager.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.
static mitk::ToolManagerProvider * GetInstance()
Returns an instance of ToolManagerProvider service.
Manages and coordinates instances of mitk::Tool.
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.