Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef FileReaderRegistry_H_HEADER_INCLUDED_C1E7E521
18 #define FileReaderRegistry_H_HEADER_INCLUDED_C1E7E521
19 
20 #include <MitkCoreExports.h>
21 #include <mitkBaseData.h>
22 
23 #include <mitkIFileReader.h>
24 
25 // Microservices
26 #include <usGetModuleContext.h>
27 #include <usServiceObjects.h>
28 #include <usServiceReference.h>
29 
30 namespace mitk
31 {
32  class MimeType;
33 
44  {
45  public:
47 
50 
58  static MimeType GetMimeTypeForFile(const std::string &path, us::ModuleContext *context = us::GetModuleContext());
59 
60  static std::vector<ReaderReference> GetReferences(const MimeType &mimeType,
61  us::ModuleContext *context = us::GetModuleContext());
62 
63  mitk::IFileReader *GetReader(const ReaderReference &ref, us::ModuleContext *context = us::GetModuleContext());
64 
65  std::vector<mitk::IFileReader *> GetReaders(const MimeType &mimeType,
66  us::ModuleContext *context = us::GetModuleContext());
67 
68  void UngetReader(mitk::IFileReader *reader);
69  void UngetReaders(const std::vector<mitk::IFileReader *> &readers);
70 
71  private:
72  // purposely not implemented
74  FileReaderRegistry &operator=(const FileReaderRegistry &);
75 
76  std::map<mitk::IFileReader *, us::ServiceObjects<mitk::IFileReader>> m_ServiceObjects;
77  };
78 
79 } // namespace mitk
80 
81 #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:45
The common interface for all MITK file readers.
static ModuleContext * GetModuleContext()
Returns the module context of the calling module.