Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkFileReaderRegistry.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef FileReaderRegistry_H_HEADER_INCLUDED_C1E7E521
14 #define FileReaderRegistry_H_HEADER_INCLUDED_C1E7E521
15 
16 #include <MitkCoreExports.h>
17 #include <mitkBaseData.h>
18 
19 #include <mitkIFileReader.h>
20 
21 // Microservices
22 #include <usGetModuleContext.h>
23 #include <usServiceObjects.h>
24 #include <usServiceReference.h>
25 
26 namespace mitk
27 {
28  class MimeType;
29 
40  {
41  public:
43 
46 
54  static MimeType GetMimeTypeForFile(const std::string &path, us::ModuleContext *context = us::GetModuleContext());
55 
56  static std::vector<ReaderReference> GetReferences(const MimeType &mimeType,
57  us::ModuleContext *context = us::GetModuleContext());
58 
59  mitk::IFileReader *GetReader(const ReaderReference &ref, us::ModuleContext *context = us::GetModuleContext());
60 
61  std::vector<mitk::IFileReader *> GetReaders(const MimeType &mimeType,
62  us::ModuleContext *context = us::GetModuleContext());
63 
64  void UngetReader(mitk::IFileReader *reader);
65  void UngetReaders(const std::vector<mitk::IFileReader *> &readers);
66 
67  private:
68  // purposely not implemented
70  FileReaderRegistry &operator=(const FileReaderRegistry &);
71 
72  std::map<mitk::IFileReader *, us::ServiceObjects<mitk::IFileReader>> m_ServiceObjects;
73  };
74 
75 } // namespace mitk
76 
77 #endif /* FileReaderRegistry_H_HEADER_INCLUDED_C1E7E521 */
#define MITKCORE_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
us::ServiceReference< IFileReader > ReaderReference
The MimeType class represens a registered mime-type. It is an immutable wrapper for mitk::CustomMimeT...
Definition: mitkMimeType.h:36
The common interface for all MITK file readers.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.