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-2020 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 
32 
33 #include <ost/io/io_exception.hh>
34 
35 namespace ost { namespace io {
36 
37 typedef std::vector<EntityIOHandlerFactoryBaseP> EntityIOHFList;
38 typedef std::vector<SequenceIOHandlerFactoryBasePtr> AlignmentIOFList;
39 typedef std::vector<ProfileIOHandlerFactoryBasePtr> ProfileIOFList;
40 typedef std::vector<SurfaceIOHandlerFactoryBasePtr> SurfaceIOFList;
41 typedef std::vector<MapIOHandlerFactoryBasePtr> MapIOFList;
42 
45 public:
62  const String& format="auto");
63 
69  const String& format="auto");
70 
71 
73 
74  SequenceIOHandlerPtr FindAlignmentImportHandler(const String& filename,
77  const String& format="auto");
78 
80  const String& format="auto");
81 
83  const String& format="auto");
84 
86  const String& format="auto");
87 
89  const String& format="auto");
91  void RegisterFactory(const EntityIOHandlerFactoryBaseP&);
103 
106 
109 
112 
115 
117 
118  void RegisterFactory(const MapIOHandlerFactoryBasePtr&);
121 
122  MapIOHandlerPtr FindMapImportHandlerFile(const boost::filesystem::path& loc,
123  const ImageFormatBase& format);
124 
126  const ImageFormatBase& format);
127 
128  MapIOHandlerPtr FindMapExportHandlerFile(const boost::filesystem::path& loc,
129  const ImageFormatBase& format);
130 
132  const ImageFormatBase& format);
133 
136 
137  // singleton interface
138  static IOManager& Instance();
139 
140 private:
141  IOManager();
142  IOManager(const IOManager&) {}
143  IOManager& operator=(const IOManager&) {return *this;}
144 
145  EntityIOHFList entity_iohf_list_;
146  AlignmentIOFList alignment_io_list_;
147  ProfileIOFList profile_io_list_;
148  SurfaceIOFList surface_io_list_;
149  MapIOFList map_io_list_;
150 };
151 
152 
153 
154 }}
155 
156 #endif
Central registry for input/output handlers.
Definition: io_manager.hh:44
void RegisterFactory(const SequenceIOHandlerFactoryBasePtr &)
register aligment io handler factory
ProfileIOHandlerPtr FindProfileExportHandler(const String &filename, const String &format="auto")
ProfileIOHandlerPtr FindProfileImportHandler(const String &filename, const String &format="auto")
EntityIOHandlerP FindEntityImportHandler(const String &filename, const String &format="auto")
const MapIOFList & GetAvailableMapHandler() const
MapIOHandlerPtr FindMapImportHandlerStream(std::istream &stream, const ImageFormatBase &format)
SurfaceIOHandlerPtr FindSurfaceImportHandler(const String &filename, const String &format="auto")
void RegisterFactory(const ProfileIOHandlerFactoryBasePtr &)
register profile io handler factory
const ProfileIOFList & GetAvailableProfileHandler() const
Get a list with all available ProfileHandler.
MapIOHandlerPtr FindMapImportHandlerFile(const boost::filesystem::path &loc, const ImageFormatBase &format)
const SurfaceIOFList & GetAvailableSurfaceHandler() const
Get a list with all available SurfaceHandler.
MapIOHandlerPtr FindMapExportHandlerFile(const boost::filesystem::path &loc, const ImageFormatBase &format)
const AlignmentIOFList & GetAvailableAlignmentHandler() const
Get a list with all available AlignmentHandler.
EntityIOHandlerP FindEntityExportHandler(const String &filename, const String &format="auto")
get entity IO handler that is able to export the file.
SequenceIOHandlerPtr FindAlignmentExportHandler(const String &filename, const String &format="auto")
MapIOHandlerPtr FindMapExportHandlerStream(std::istream &stream, const ImageFormatBase &format)
const EntityIOHFList & GetAvailableEntityHandler() const
Get a list with all available EntityHandler.
void RegisterFactory(const SurfaceIOHandlerFactoryBasePtr &)
register surface io handler factory
static IOManager & Instance()
#define DLLEXPORT_OST_IO
std::string String
Definition: base.hh:54
boost::shared_ptr< MapIOHandlerFactoryBase > MapIOHandlerFactoryBasePtr
std::vector< SurfaceIOHandlerFactoryBasePtr > SurfaceIOFList
Definition: io_manager.hh:40
boost::shared_ptr< SurfaceIOHandler > SurfaceIOHandlerPtr
boost::shared_ptr< SequenceIOHandler > SequenceIOHandlerPtr
std::vector< SequenceIOHandlerFactoryBasePtr > AlignmentIOFList
Definition: io_manager.hh:38
std::vector< MapIOHandlerFactoryBasePtr > MapIOFList
Definition: io_manager.hh:41
boost::shared_ptr< SequenceIOHandlerFactoryBase > SequenceIOHandlerFactoryBasePtr
std::vector< EntityIOHandlerFactoryBaseP > EntityIOHFList
Definition: io_manager.hh:37
std::vector< ProfileIOHandlerFactoryBasePtr > ProfileIOFList
Definition: io_manager.hh:39
boost::shared_ptr< ProfileIOHandler > ProfileIOHandlerPtr
boost::shared_ptr< SurfaceIOHandlerFactoryBase > SurfaceIOHandlerFactoryBasePtr
boost::shared_ptr< MapIOHandler > MapIOHandlerPtr
boost::shared_ptr< EntityIOHandlerFactoryBase > EntityIOHandlerFactoryBaseP
boost::shared_ptr< ProfileIOHandlerFactoryBase > ProfileIOHandlerFactoryBasePtr
boost::shared_ptr< EntityIOHandler > EntityIOHandlerP
Definition: base.dox:1