Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
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 (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 
13 #include <usGetModuleContext.h>
14 #include <usModuleActivator.h>
15 #include <usModuleContext.h>
16 #include <usModule.h>
17 
18 #include "mitkIGTLMeasurements.h"
19 
20 namespace mitk
21 {
22 
26  class IGTLModuleActivator : public us::ModuleActivator
27  {
28  public:
29 
30  void Load(us::ModuleContext* context) override
31  {
32  // First create and register a instance.
33  m_Measurement = IGTLMeasurements::New();
34  m_MeasurementReg = context->RegisterService<IGTLMeasurements>(m_Measurement);
35  }
36 
37  void Unload(us::ModuleContext*) override
38  {
39  m_MeasurementReg.Unregister();
40  //delete m_Measurement;
41  //m_Measurement.
42  }
43 
44  private:
45  IGTLMeasurements::Pointer m_Measurement;
47  };
48 }
49 
50 US_EXPORT_MODULE_ACTIVATOR(mitk::IGTLModuleActivator)
DataCollection - Class to facilitate loading/accessing structured data.
virtual void Unload(ModuleContext *context)=0
#define US_EXPORT_MODULE_ACTIVATOR(_activator_type)
Export a module activator class.
virtual void Load(ModuleContext *context)=0