CustusX  22.04-rc2
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
FileManagerImpService(ctkPluginContext *context)
void addFileReaderWriter(FileReaderWriterService *service)
Helper class for listening to services being added, modified and removed.
void removeFileReaderWriter(FileReaderWriterService *service)
Namespace for all CustusX production code.