Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
mitkToDCameraMESASR4000ModuleActivator.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 #ifndef __mitkMESASR4000Activator_h
17 #define __mitkMESASR4000Activator_h
18 
19 // Microservices
20 #include <usServiceRegistration.h>
21 #include <usModuleActivator.h>
22 #include "usModuleContext.h"
23 #include <usModuleActivator.h>
24 
25 //ToF
26 #include "mitkIToFDeviceFactory.h"
27 #include "mitkToFConfig.h"
29 
30 namespace mitk
31 {
36 class MESASR4000ModuleActivator : public us::ModuleActivator {
37 public:
38 
43  void Load(us::ModuleContext* context)
44  {
45  //Implementing MESASR4000DeviceFactory
46  ToFCameraMESASR4000DeviceFactory* toFCameraMESASR4000DeviceFactory = new ToFCameraMESASR4000DeviceFactory();
47  us::ServiceProperties mitkMESASR4000FactoryProps;
48  mitkMESASR4000FactoryProps["ToFFactoryName"] = toFCameraMESASR4000DeviceFactory->GetFactoryName();
49  context->RegisterService<IToFDeviceFactory>(toFCameraMESASR4000DeviceFactory, mitkMESASR4000FactoryProps);
50 
51  toFCameraMESASR4000DeviceFactory->ConnectToFDevice();
52 
53  m_Factories.push_back(toFCameraMESASR4000DeviceFactory);
54  }
55 
59  void Unload(us::ModuleContext* )
60  {
61  }
62 
66  ~MESASR4000ModuleActivator()
67  {
68  if(m_Factories.size() > 0)
69  {
70  for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it)
71  {
72  delete (*it);
73  }
74  }
75  }
76 
77 private:
81  std::list< IToFDeviceFactory* > m_Factories;
82 
83 };
84 }
85 US_EXPORT_MODULE_ACTIVATOR(mitk::MESASR4000ModuleActivator)
86 #endif
DataCollection - Class to facilitate loading/accessing structured data.
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
US_EXPORT_MODULE_ACTIVATOR(mitk::SimulationActivator)