NorMIT-nav  22.09
An IGT application
cxFileManagerImplService.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
13 #include <QFileInfo>
14 #include "cxTypeConversions.h"
15 #include "cxUtilHelpers.h"
16 #include "cxNullDeleter.h"
17 #include "cxLogger.h"
18 #include "boost/bind.hpp"
19 #include "cxCoreServices.h"
20 
21 namespace cx
22 {
24 {
25  this->setObjectName("FileManagerImpService");
26  this->initServiceListener(context);
27 
28 }
29 
31 {
32 }
33 
34 void FileManagerImpService::initServiceListener(ctkPluginContext *context)
35 {
36  mServiceListener.reset(new ServiceTrackerListener<FileReaderWriterService>(
37  context,
38  boost::bind(&FileManagerImpService::onServiceAdded, this, _1),
39  boost::function<void (FileReaderWriterService*)>(),
40  boost::bind(&FileManagerImpService::onServiceRemoved, this, _1)
41  ));
42  mServiceListener->open();
43 }
44 
45 void FileManagerImpService::onServiceAdded(FileReaderWriterService *service)
46 {
47  this->addFileReaderWriter(service);
48 }
49 
50 void FileManagerImpService::onServiceRemoved(FileReaderWriterService *service)
51 {
52  this->removeFileReaderWriter(service);
53 }
54 
55 } // cx
cxLogger.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::ServiceTrackerListener
Helper class for listening to services being added, modified and removed.
Definition: cxServiceTrackerListener.h:53
cxUtilHelpers.h
cx::FileManagerServiceBase::addFileReaderWriter
void addFileReaderWriter(FileReaderWriterService *service)
Definition: cxFileManagerServiceBase.cpp:168
cx::FileManagerImpService::FileManagerImpService
FileManagerImpService(ctkPluginContext *context)
Definition: cxFileManagerImplService.cpp:23
cxFileManagerImplService.h
cxNullDeleter.h
cxTypeConversions.h
cx::FileManagerServiceBase::removeFileReaderWriter
void removeFileReaderWriter(FileReaderWriterService *service)
Definition: cxFileManagerServiceBase.cpp:175
cxCoreServices.h
cx::FileManagerImpService::~FileManagerImpService
virtual ~FileManagerImpService()
Definition: cxFileManagerImplService.cpp:30
cx::FileReaderWriterService
Definition: cxFileReaderWriterService.h:30