MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkKinectActivator.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 __mitkKinectActivator_h
13#define __mitkKinectActivator_h
14
15// Microservices
16#include <usServiceRegistration.h>
17#include <usModuleActivator.h>
18#include <usModuleContext.h>
19
20//ToF
22#include "mitkToFConfig.h"
25
26namespace mitk
27{
32class KinectActivator : public us::ModuleActivator{
33public:
38 void Load(us::ModuleContext* context)
39 {
40 //Implementing KinectDeviceFactory
41 KinectDeviceFactory* kinectFactory = new KinectDeviceFactory();
42 us::ServiceProperties kinectFactoryProps;
43 kinectFactoryProps["ToFFactoryName"] =kinectFactory->GetFactoryName();
44 context->RegisterService<IToFDeviceFactory>(kinectFactory, kinectFactoryProps);
45 kinectFactory->ConnectToFDevice();
46
47 m_Factories.push_back( kinectFactory );
48 }
49
53 void Unload(us::ModuleContext* )
54 {
55 }
56
62 {
63 if(m_Factories.size() > 0)
64 {
65 for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it)
66 {
67 delete (*it);
68 }
69 }
70 }
71
72private:
76 std::list< IToFDeviceFactory* > m_Factories;
77
78};
79}
80US_EXPORT_MODULE_ACTIVATOR(mitk::KinectActivator)
81#endif
The KinectActivator class This is the module activator for the "mitkKinectModule" module....
void Load(us::ModuleContext *context)
Load This method is automatically called, when the kinect module is activated. It will automatically ...
~KinectActivator()
Default destructor which deletes all registered factories. Usually, there should never be more than o...
void Unload(us::ModuleContext *)
Unload called when the module is unloaded.
KinectDeviceFactory is an implementation of the factory pattern to generate Microsoft Kinect devices....
std::string GetFactoryName()
Get the name of the factory, here for the Kinect.
IGT Exceptions.
ToFCameraDevice::Pointer ConnectToFDevice()
ConnectToFDevice Use this method to connect a device.
This is the base of class for all ToFDeviceFactories.