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-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:
61  EntityIOHandlerP FindEntityImportHandler(const String& filename,
62  const String& format="auto");
63 
68  EntityIOHandlerP FindEntityExportHandler(const String& filename,
69  const String& format="auto");
70 
71 
73 
74  SequenceIOHandlerPtr FindAlignmentImportHandler(const String& filename,
77  const String& format="auto");
78 
79  SequenceIOHandlerPtr FindAlignmentExportHandler(const String& filename,
80  const String& format="auto");
81 
82  ProfileIOHandlerPtr FindProfileImportHandler(const String& filename,
83  const String& format="auto");
84 
85  ProfileIOHandlerPtr FindProfileExportHandler(const String& filename,
86  const String& format="auto");
87 
88  SurfaceIOHandlerPtr FindSurfaceImportHandler(const String& filename,
89  const String& format="auto");
91  void RegisterFactory(const EntityIOHandlerFactoryBaseP&);
96  void RegisterFactory(const SequenceIOHandlerFactoryBasePtr&);
99  void RegisterFactory(const ProfileIOHandlerFactoryBasePtr&);
102  void RegisterFactory(const SurfaceIOHandlerFactoryBasePtr&);
103 
105  const EntityIOHFList& GetAvailableEntityHandler() const;
106 
108  const AlignmentIOFList& GetAvailableAlignmentHandler() const;
109 
111  const ProfileIOFList& GetAvailableProfileHandler() const;
112 
114  const SurfaceIOFList& GetAvailableSurfaceHandler() const;
115 
117 
118  void RegisterFactory(const MapIOHandlerFactoryBasePtr&);
121 
122  MapIOHandlerPtr FindMapImportHandlerFile(const boost::filesystem::path& loc,
123  const ImageFormatBase& format);
124 
125  MapIOHandlerPtr FindMapImportHandlerStream(std::istream& stream,
126  const ImageFormatBase& format);
127 
128  MapIOHandlerPtr FindMapExportHandlerFile(const boost::filesystem::path& loc,
129  const ImageFormatBase& format);
130 
131  MapIOHandlerPtr FindMapExportHandlerStream(std::istream& stream,
132  const ImageFormatBase& format);
133 
134  const MapIOFList& GetAvailableMapHandler() const;
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
boost::shared_ptr< SequenceIOHandler > SequenceIOHandlerPtr
std::vector< SequenceIOHandlerFactoryBasePtr > AlignmentIOFList
Definition: io_manager.hh:38
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:37
std::vector< MapIOHandlerFactoryBasePtr > MapIOFList
Definition: io_manager.hh:41
boost::shared_ptr< EntityIOHandlerFactoryBase > EntityIOHandlerFactoryBaseP
std::vector< ProfileIOHandlerFactoryBasePtr > ProfileIOFList
Definition: io_manager.hh:39
boost::shared_ptr< MapIOHandler > MapIOHandlerPtr
boost::shared_ptr< SurfaceIOHandler > SurfaceIOHandlerPtr
Central registry for input/output handlers.
Definition: io_manager.hh:44
#define DLLEXPORT_OST_IO
std::vector< SurfaceIOHandlerFactoryBasePtr > SurfaceIOFList
Definition: io_manager.hh:40
boost::shared_ptr< SequenceIOHandlerFactoryBase > SequenceIOHandlerFactoryBasePtr
boost::shared_ptr< ProfileIOHandler > ProfileIOHandlerPtr