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 
31 
32 #if OST_IMG_ENABLED
34 #endif
35 
36 #include <ost/io/io_exception.hh>
37 
38 namespace ost { namespace io {
39 
40 typedef std::vector<EntityIOHandlerFactoryBaseP> EntityIOHFList;
41 typedef std::vector<SequenceIOHandlerFactoryBasePtr> AlignmentIOFList;
42 typedef std::vector<ProfileIOHandlerFactoryBasePtr> ProfileIOFList;
43 typedef std::vector<SurfaceIOHandlerFactoryBasePtr> SurfaceIOFList;
44 
45 #if OST_IMG_ENABLED
46  typedef std::vector<MapIOHandlerFactoryBasePtr> MapIOFList;
47 #endif
48 
51 public:
67  EntityIOHandlerP FindEntityImportHandler(const String& filename,
68  const String& format="auto");
69 
74  EntityIOHandlerP FindEntityExportHandler(const String& filename,
75  const String& format="auto");
76 
77 
79 
80  SequenceIOHandlerPtr FindAlignmentImportHandler(const String& filename,
83  const String& format="auto");
84 
85  SequenceIOHandlerPtr FindAlignmentExportHandler(const String& filename,
86  const String& format="auto");
87 
88  ProfileIOHandlerPtr FindProfileImportHandler(const String& filename,
89  const String& format="auto");
90 
91  ProfileIOHandlerPtr FindProfileExportHandler(const String& filename,
92  const String& format="auto");
93 
94  SurfaceIOHandlerPtr FindSurfaceImportHandler(const String& filename,
95  const String& format="auto");
97  void RegisterFactory(const EntityIOHandlerFactoryBaseP&);
102  void RegisterFactory(const SequenceIOHandlerFactoryBasePtr&);
105  void RegisterFactory(const ProfileIOHandlerFactoryBasePtr&);
108  void RegisterFactory(const SurfaceIOHandlerFactoryBasePtr&);
109 
111  const EntityIOHFList& GetAvailableEntityHandler() const;
112 
114  const AlignmentIOFList& GetAvailableAlignmentHandler() const;
115 
117  const ProfileIOFList& GetAvailableProfileHandler() const;
118 
120  const SurfaceIOFList& GetAvailableSurfaceHandler() const;
121 
122 #if OST_IMG_ENABLED
123 
125  void RegisterFactory(const MapIOHandlerFactoryBasePtr&);
128 
129  MapIOHandlerPtr FindMapImportHandlerFile(const boost::filesystem::path& loc,
130  const ImageFormatBase& format);
131 
132  MapIOHandlerPtr FindMapImportHandlerStream(std::istream& stream,
133  const ImageFormatBase& format);
134 
135  MapIOHandlerPtr FindMapExportHandlerFile(const boost::filesystem::path& loc,
136  const ImageFormatBase& format);
137 
138  MapIOHandlerPtr FindMapExportHandlerStream(std::istream& stream,
139  const ImageFormatBase& format);
140 
141  const MapIOFList& GetAvailableMapHandler() const;
143 #endif
144 
145  // singleton interface
146  static IOManager& Instance();
147 
148 private:
149  IOManager();
150  IOManager(const IOManager&) {}
151  IOManager& operator=(const IOManager&) {return *this;}
152 
153  EntityIOHFList entity_iohf_list_;
154  AlignmentIOFList alignment_io_list_;
155  ProfileIOFList profile_io_list_;
156  SurfaceIOFList surface_io_list_;
157 
158 #if OST_IMG_ENABLED
159  MapIOFList map_io_list_;
160 #endif
161 };
162 
163 
164 
165 }}
166 
167 #endif
boost::shared_ptr< SequenceIOHandler > SequenceIOHandlerPtr
std::vector< SequenceIOHandlerFactoryBasePtr > AlignmentIOFList
Definition: io_manager.hh:41
boost::shared_ptr< EntityIOHandler > EntityIOHandlerP
std::string String
Definition: base.hh:54
boost::shared_ptr< SurfaceIOHandlerFactoryBase > SurfaceIOHandlerFactoryBasePtr
boost::shared_ptr< MapIOHandlerFactoryBase > MapIOHandlerFactoryBasePtr
boost::shared_ptr< ProfileIOHandlerFactoryBase > ProfileIOHandlerFactoryBasePtr
std::vector< EntityIOHandlerFactoryBaseP > EntityIOHFList
Definition: io_manager.hh:40
boost::shared_ptr< EntityIOHandlerFactoryBase > EntityIOHandlerFactoryBaseP
std::vector< ProfileIOHandlerFactoryBasePtr > ProfileIOFList
Definition: io_manager.hh:42
boost::shared_ptr< MapIOHandler > MapIOHandlerPtr
boost::shared_ptr< SurfaceIOHandler > SurfaceIOHandlerPtr
Central registry for input/output handlers.
Definition: io_manager.hh:50
#define DLLEXPORT_OST_IO
std::vector< SurfaceIOHandlerFactoryBasePtr > SurfaceIOFList
Definition: io_manager.hh:43
boost::shared_ptr< SequenceIOHandlerFactoryBase > SequenceIOHandlerFactoryBasePtr
boost::shared_ptr< ProfileIOHandler > ProfileIOHandlerPtr