CustusX  22.04-rc5
An IGT application
cxFileManagerServiceProxy.h
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 
12 #ifndef CXFILEMANAGERSERVICEPROXY_H
13 #define CXFILEMANAGERSERVICEPROXY_H
14 
15 #include "cxResourceExport.h"
16 #include "cxFileManagerService.h"
18 
19 namespace cx
20 {
21 
22 class cxResource_EXPORT FileManagerServiceProxy : public FileManagerService
23 {
24  Q_OBJECT
25 public:
26  static FileManagerServicePtr create(ctkPluginContext *context);
27 
28  FileManagerServiceProxy(ctkPluginContext *context);
29  virtual ~FileManagerServiceProxy();
30 
31  virtual bool isNull();
32 
33  bool canLoad(const QString &type, const QString &filename);
34  DataPtr load(const QString &uid, const QString &filename);
35  QString canLoadDataType() const;
36  std::vector<DataPtr> read(const QString &filename);
37 
38  bool readInto(DataPtr data, QString path);
39  QString findDataTypeFromFile(QString filename);
40  vtkImageDataPtr loadVtkImageData(QString filename);
41  vtkPolyDataPtr loadVtkPolyData(QString filename);
42 
43  void save(DataPtr data, const QString &filename);
44  void addFileReaderWriter(FileReaderWriterService *service);
45  void removeFileReaderWriter(FileReaderWriterService *service);
46 
47  std::vector<FileReaderWriterServicePtr> getExportersForDataType(QString dataType);
48  std::vector<FileReaderWriterServicePtr> getImportersForDataType(QString dataType);
49  QString getFileReaderName(const QString &filename);
50 
51 private:
52  void initServiceListener();
53  void onServiceAdded(FileManagerService *service);
54  void onServiceRemoved(FileManagerService *service);
55 
56  boost::shared_ptr<ServiceTrackerListener<FileManagerService> > mServiceListener;
57 
58  ctkPluginContext *mPluginContext;
59  FileManagerServicePtr mService;
60 
61 };
62 }
63 
64 #endif // CXFILEMANAGERSERVICEPROXY_H
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
boost::shared_ptr< class Data > DataPtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
vtkSmartPointer< class vtkImageData > vtkImageDataPtr
Namespace for all CustusX production code.