OpenStructure
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 #include <ost/mol/mol.hh>
27 
31 
32 #if OST_IMG_ENABLED
34 #endif
35 
36 #include <ost/io/io_exception.hh>
37 namespace ost { namespace io {
38 
39 typedef std::vector<EntityIOHandlerFactoryBaseP> EntityIOHFList;
40 typedef std::vector<SequenceIOHandlerFactoryBasePtr> AlignmentIOFList;
41 typedef std::vector<SurfaceIOHandlerFactoryBasePtr> SurfaceIOFList;
42 
43 #if OST_IMG_ENABLED
44  typedef std::vector<MapIOHandlerFactoryBasePtr> MapIOFList;
45 #endif
46 
49 public:
65  EntityIOHandlerP FindEntityImportHandler(const String& filename,
66  const String& format="auto");
67 
72  EntityIOHandlerP FindEntityExportHandler(const String& filename,
73  const String& format="auto");
74 
75 
77 
78 
79 
80  SequenceIOHandlerPtr FindAlignmentImportHandler(const String& filename,
81  const String& format="auto");
82 
83  SequenceIOHandlerPtr FindAlignmentExportHandler(const String& filename,
84  const String& format="auto");
85 
86  SurfaceIOHandlerPtr FindSurfaceImportHandler(const String& filename,
87  const String& format="auto");
89 
90 
91  void RegisterFactory(const EntityIOHandlerFactoryBaseP&);
94  void RegisterFactory(const SequenceIOHandlerFactoryBasePtr&);
97  void RegisterFactory(const SurfaceIOHandlerFactoryBasePtr&);
98 
100  const EntityIOHFList& GetAvailableEntityHandler() const;
101 
103  const AlignmentIOFList& GetAvailableAlignmentHandler() const;
104 
106  const SurfaceIOFList& GetAvailableSurfaceHandler() const;
107 
108 #if OST_IMG_ENABLED
109 
110 
111 
112 
113  void RegisterFactory(const MapIOHandlerFactoryBasePtr&);
114 
115  MapIOHandlerPtr FindMapImportHandlerFile(const boost::filesystem::path& loc,
116  const ImageFormatBase& format);
117 
118  MapIOHandlerPtr FindMapImportHandlerStream(std::istream& stream,
119  const ImageFormatBase& format);
120 
121  MapIOHandlerPtr FindMapExportHandlerFile(const boost::filesystem::path& loc,
122  const ImageFormatBase& format);
123 
124  MapIOHandlerPtr FindMapExportHandlerStream(std::istream& stream,
125  const ImageFormatBase& format);
126 
127  const MapIOFList& GetAvailableMapHandler() const;
129 #endif
130 
131  // singleton interface
132  static IOManager& Instance();
133 
134 private:
135  IOManager();
136  IOManager(const IOManager&) {}
137  IOManager& operator=(const IOManager&) {return *this;}
138 
139  EntityIOHFList entity_iohf_list_;
140  AlignmentIOFList alignment_io_list_;
141  SurfaceIOFList surface_io_list_;
142 
143 #if OST_IMG_ENABLED
144  MapIOFList map_io_list_;
145 #endif
146 };
147 
148 
149 
150 }}
151 
152 #endif