MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkToFHardwareActivator.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 __mitkToFHardwareModuleActivator_h
13#define __mitkToFHardwareModuleActivator_h
14
15// Microservices
16#include <usServiceRegistration.h>
17#include <usModuleActivator.h>
18#include <usModuleContext.h>
19
21
22#include "mitkToFConfig.h"
24
25/*
26 * This is the module activator for the "ToFHardware" module. It registers services
27 * like the IToFDeviceFactory.
28*/
29
30namespace mitk
31{
32class ToFHardwareActivator : public us::ModuleActivator {
33public:
34
35 void Load(us::ModuleContext* context) override
36 {
37 //Registering MITKPlayerDevice as MicroService
38 ToFCameraMITKPlayerDeviceFactory* toFCameraMITKPlayerDeviceFactory = new ToFCameraMITKPlayerDeviceFactory();
39 us::ServiceProperties mitkPlayerFactoryProps;
40 mitkPlayerFactoryProps["ToFFactoryName"] = toFCameraMITKPlayerDeviceFactory->GetFactoryName();
41 context->RegisterService<IToFDeviceFactory>(toFCameraMITKPlayerDeviceFactory, mitkPlayerFactoryProps);
42 //Create an instance of the player
43 toFCameraMITKPlayerDeviceFactory->ConnectToFDevice();
44
45 m_Factories.push_back( toFCameraMITKPlayerDeviceFactory );
46 }
47
48 void Unload(us::ModuleContext* ) override
49 {
50 }
51
53 {
54 if(m_Factories.size() > 0)
55 {
56 for(std::list< IToFDeviceFactory* >::iterator it = m_Factories.begin(); it != m_Factories.end(); ++it)
57 {
58 delete (*it);
59 }
60 }
61 }
62
63private:
64
65 std::list< IToFDeviceFactory* > m_Factories;
66
67};
68}
69US_EXPORT_MODULE_ACTIVATOR(mitk::ToFHardwareActivator)
70#endif
ToFPlayerDeviceFactory is an implementation of the factory pattern to generate ToFPlayer devices....
std::string GetFactoryName() override
Defining the Factorie's Name, here for the ToFPlayer.
void Load(us::ModuleContext *context) override
void Unload(us::ModuleContext *) override
IGT Exceptions.
ToFCameraDevice::Pointer ConnectToFDevice()
ConnectToFDevice Use this method to connect a device.
This is the base of class for all ToFDeviceFactories.