Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkIGTLModuleActivator.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 
17 #include <usGetModuleContext.h>
18 #include <usModuleActivator.h>
19 #include <usModuleContext.h>
20 #include <usModule.h>
21 
22 #include "mitkIGTLMeasurements.h"
23 
24 namespace mitk
25 {
26 
30  class IGTLModuleActivator : public us::ModuleActivator
31  {
32  public:
33 
34  void Load(us::ModuleContext* context) override
35  {
36  // First create and register a instance.
37  m_Measurement = IGTLMeasurements::New();
38  m_MeasurementReg = context->RegisterService<IGTLMeasurements>(m_Measurement);
39  }
40 
41  void Unload(us::ModuleContext*) override
42  {
43  m_MeasurementReg.Unregister();
44  //delete m_Measurement;
45  //m_Measurement.
46  }
47 
48  private:
49  IGTLMeasurements::Pointer m_Measurement;
51  };
52 }
53 
54 US_EXPORT_MODULE_ACTIVATOR(mitk::IGTLModuleActivator)
itk::SmartPointer< Self > Pointer
DataCollection - Class to facilitate loading/accessing structured data.
virtual void Unload(ModuleContext *context)=0
virtual void Load(ModuleContext *context)=0
US_EXPORT_MODULE_ACTIVATOR(mitk::SimulationActivator)