Medical Imaging Interaction Toolkit  2018.4.99-389bf124
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 (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 #ifndef __mitkMESASR4000Activator_h
13 #define __mitkMESASR4000Activator_h
14 
15 // Microservices
16 #include <usServiceRegistration.h>
17 #include <usModuleActivator.h>
18 #include "usModuleContext.h"
19 #include <usModuleActivator.h>
20 
21 //ToF
22 #include "mitkIToFDeviceFactory.h"
23 #include "mitkToFConfig.h"
25 
26 namespace mitk
27 {
32 class MESASR4000ModuleActivator : public us::ModuleActivator {
33 public:
34 
39  void Load(us::ModuleContext* context)
40  {
41  //Implementing MESASR4000DeviceFactory
42  ToFCameraMESASR4000DeviceFactory* toFCameraMESASR4000DeviceFactory = new ToFCameraMESASR4000DeviceFactory();
43  us::ServiceProperties mitkMESASR4000FactoryProps;
44  mitkMESASR4000FactoryProps["ToFFactoryName"] = toFCameraMESASR4000DeviceFactory->GetFactoryName();
45  context->RegisterService<IToFDeviceFactory>(toFCameraMESASR4000DeviceFactory, mitkMESASR4000FactoryProps);
46 
47  toFCameraMESASR4000DeviceFactory->ConnectToFDevice();
48 
49  m_Factories.push_back(toFCameraMESASR4000DeviceFactory);
50  }
51 
55  void Unload(us::ModuleContext* )
56  {
57  }
58 
62  ~MESASR4000ModuleActivator()
63  {
64  if(m_Factories.size() > 0)
65  {
66  for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it)
67  {
68  delete (*it);
69  }
70  }
71  }
72 
73 private:
77  std::list< IToFDeviceFactory* > m_Factories;
78 
79 };
80 }
81 US_EXPORT_MODULE_ACTIVATOR(mitk::MESASR4000ModuleActivator)
82 #endif
DataCollection - Class to facilitate loading/accessing structured data.
US_UNORDERED_MAP_TYPE< std::string, Any > ServiceProperties
#define US_EXPORT_MODULE_ACTIVATOR(_activator_type)
Export a module activator class.