MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkKinectV2Activator.cpp
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12#ifndef __mitkKinectV2Activator_h
13#define __mitkKinectV2Activator_h
14
15// Microservices
16#include <usServiceRegistration.h>
17#include <usModuleActivator.h>
18#include <usModuleContext.h>
19
21
22#include "mitkToFConfig.h"
24
26
27/*
28 * This is the module activator for the "mitkKinectV2Module" module. It registers services
29 * like the IToFDeviceFactory.
30 */
31
32namespace mitk
33{
34class KinectV2Activator : public us::ModuleActivator {
35public:
36
37 void Load(us::ModuleContext* context)
38 {
39 //Implementing KinectDeviceFactory
40 KinectV2DeviceFactory* KinectV2Factory = new KinectV2DeviceFactory();
41 us::ServiceProperties KinectV2FactoryProps;
42 KinectV2FactoryProps["ToFFactoryName"] =KinectV2Factory->GetFactoryName();
43 context->RegisterService<IToFDeviceFactory>(KinectV2Factory, KinectV2FactoryProps);
44 KinectV2Factory->ConnectToFDevice();
45
46 m_Factories.push_back( KinectV2Factory );
47 }
48
49 void Unload(us::ModuleContext* )
50 {
51 }
52
54 {
55 if(m_Factories.size() > 0)
56 {
57 for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it)
58 {
59 delete (*it);
60 }
61 }
62 }
63
64private:
65
66 std::list< IToFDeviceFactory* > m_Factories;
67
68};
69}
70US_EXPORT_MODULE_ACTIVATOR(mitk::KinectV2Activator)
71#endif
void Unload(us::ModuleContext *)
void Load(us::ModuleContext *context)
KinectDeviceFactory is an implementation of the factory pattern to generate Microsoft Kinect V2 devic...
std::string GetFactoryName()
GetFactoryName Get the name of the factory.
IGT Exceptions.
ToFCameraDevice::Pointer ConnectToFDevice()
ConnectToFDevice Use this method to connect a device.
This is the base of class for all ToFDeviceFactories.