OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
io_manager.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2011 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_IO_MANAGER_H
20 #define OST_IO_MANAGER_H
21 
22 #include <vector>
23 
24 #include <ost/config.hh>
25 #include <ost/io/module_config.hh>
26 
30 
31 #if OST_IMG_ENABLED
33 #endif
34 
35 #include <ost/io/io_exception.hh>
36 namespace ost { namespace io {
37 
38 typedef std::vector<EntityIOHandlerFactoryBaseP> EntityIOHFList;
39 typedef std::vector<SequenceIOHandlerFactoryBasePtr> AlignmentIOFList;
40 typedef std::vector<SurfaceIOHandlerFactoryBasePtr> SurfaceIOFList;
41 
42 #if OST_IMG_ENABLED
43  typedef std::vector<MapIOHandlerFactoryBasePtr> MapIOFList;
44 #endif
45 
48 public:
64  EntityIOHandlerP FindEntityImportHandler(const String& filename,
65  const String& format="auto");
66 
71  EntityIOHandlerP FindEntityExportHandler(const String& filename,
72  const String& format="auto");
73 
74 
76 
77 
78 
79  SequenceIOHandlerPtr FindAlignmentImportHandler(const String& filename,
80  const String& format="auto");
81 
82  SequenceIOHandlerPtr FindAlignmentExportHandler(const String& filename,
83  const String& format="auto");
84 
85  SurfaceIOHandlerPtr FindSurfaceImportHandler(const String& filename,
86  const String& format="auto");
88 
89 
90  void RegisterFactory(const EntityIOHandlerFactoryBaseP&);
93  void RegisterFactory(const SequenceIOHandlerFactoryBasePtr&);
96  void RegisterFactory(const SurfaceIOHandlerFactoryBasePtr&);
97 
99  const EntityIOHFList& GetAvailableEntityHandler() const;
100 
102  const AlignmentIOFList& GetAvailableAlignmentHandler() const;
103 
105  const SurfaceIOFList& GetAvailableSurfaceHandler() const;
106 
107 #if OST_IMG_ENABLED
108 
109 
110 
111 
112  void RegisterFactory(const MapIOHandlerFactoryBasePtr&);
113 
114  MapIOHandlerPtr FindMapImportHandlerFile(const boost::filesystem::path& loc,
115  const ImageFormatBase& format);
116 
117  MapIOHandlerPtr FindMapImportHandlerStream(std::istream& stream,
118  const ImageFormatBase& format);
119 
120  MapIOHandlerPtr FindMapExportHandlerFile(const boost::filesystem::path& loc,
121  const ImageFormatBase& format);
122 
123  MapIOHandlerPtr FindMapExportHandlerStream(std::istream& stream,
124  const ImageFormatBase& format);
125 
126  const MapIOFList& GetAvailableMapHandler() const;
128 #endif
129 
130  // singleton interface
131  static IOManager& Instance();
132 
133 private:
134  IOManager();
135  IOManager(const IOManager&) {}
136  IOManager& operator=(const IOManager&) {return *this;}
137 
138  EntityIOHFList entity_iohf_list_;
139  AlignmentIOFList alignment_io_list_;
140  SurfaceIOFList surface_io_list_;
141 
142 #if OST_IMG_ENABLED
143  MapIOFList map_io_list_;
144 #endif
145 };
146 
147 
148 
149 }}
150 
151 #endif