Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkSimulationActivator.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 "mitkSimulationIO.h"
18 #include "mitkSimulationService.h"
19 #include <usModuleActivator.h>
20 #include <usModuleContext.h>
21 #include <memory>
22 
23 namespace mitk
24 {
25  class SimulationActivator : public us::ModuleActivator
26  {
27  public:
28  SimulationActivator()
29  {
30  }
31 
32  ~SimulationActivator()
33  {
34  }
35 
36  void Load(us::ModuleContext* context) override
37  {
38  m_SimulationService.reset(new SimulationService);
39  context->RegisterService<ISimulationService>(m_SimulationService.get());
40 
41  m_SimulationIO.reset(new SimulationIO);
42  }
43 
44  void Unload(us::ModuleContext*) override
45  {
46  m_SimulationIO.reset(NULL);
47  m_SimulationService.reset(NULL);
48  }
49 
50  private:
51  SimulationActivator(const SimulationActivator&);
52  SimulationActivator& operator=(const SimulationActivator&);
53 
54  std::unique_ptr<SimulationService> m_SimulationService;
55  std::unique_ptr<AbstractFileIO> m_SimulationIO;
56  };
57 }
58 
59 US_EXPORT_MODULE_ACTIVATOR(mitk::SimulationActivator);
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)