00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2010 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_IO_MANAGER_H 00020 #define OST_IO_MANAGER_H 00021 00022 #include <vector> 00023 00024 #include <ost/config.hh> 00025 #include <ost/io/module_config.hh> 00026 #include <ost/mol/mol.hh> 00027 00028 #include <ost/io/mol/entity_io_handler.hh> 00029 #include <ost/io/seq/sequence_io_handler.hh> 00030 #include <ost/io/mol/surface_io_handler.hh> 00031 00032 #if OST_IMG_ENABLED 00033 # include <ost/io/img/map_io_handler.hh> 00034 #endif 00035 00036 #include <ost/io/io_exception.hh> 00037 namespace ost { namespace io { 00038 00039 typedef std::vector<EntityIOHandlerFactoryBaseP> EntityIOHFList; 00040 typedef std::vector<SequenceIOHandlerFactoryBasePtr> AlignmentIOFList; 00041 typedef std::vector<SurfaceIOHandlerFactoryBasePtr> SurfaceIOFList; 00042 00043 #if OST_IMG_ENABLED 00044 typedef std::vector<MapIOHandlerFactoryBasePtr> MapIOFList; 00045 #endif 00046 00048 class DLLEXPORT_OST_IO IOManager { 00049 public: 00065 EntityIOHandlerP FindEntityImportHandler(const String& filename, 00066 const String& format="auto"); 00067 00072 EntityIOHandlerP FindEntityExportHandler(const String& filename, 00073 const String& format="auto"); 00074 00075 00077 00078 00079 00080 SequenceIOHandlerPtr FindAlignmentImportHandler(const String& filename, 00081 const String& format="auto"); 00082 00083 SequenceIOHandlerPtr FindAlignmentExportHandler(const String& filename, 00084 const String& format="auto"); 00085 00086 SurfaceIOHandlerPtr FindSurfaceImportHandler(const String& filename, 00087 const String& format="auto"); 00089 00090 00091 void RegisterFactory(const EntityIOHandlerFactoryBaseP&); 00094 void RegisterFactory(const SequenceIOHandlerFactoryBasePtr&); 00097 void RegisterFactory(const SurfaceIOHandlerFactoryBasePtr&); 00098 00100 const EntityIOHFList& GetAvailableEntityHandler() const; 00101 00103 const AlignmentIOFList& GetAvailableAlignmentHandler() const; 00104 00106 const SurfaceIOFList& GetAvailableSurfaceHandler() const; 00107 00108 #if OST_IMG_ENABLED 00110 00111 00112 00113 void RegisterFactory(const MapIOHandlerFactoryBasePtr&); 00114 00115 MapIOHandlerPtr FindMapImportHandlerFile(const boost::filesystem::path& loc, 00116 const ImageFormatBase& format); 00117 00118 MapIOHandlerPtr FindMapImportHandlerStream(std::istream& stream, 00119 const ImageFormatBase& format); 00120 00121 MapIOHandlerPtr FindMapExportHandlerFile(const boost::filesystem::path& loc, 00122 const ImageFormatBase& format); 00123 00124 MapIOHandlerPtr FindMapExportHandlerStream(std::istream& stream, 00125 const ImageFormatBase& format); 00126 00127 const MapIOFList& GetAvailableMapHandler() const; 00129 #endif 00130 00131 // singleton interface 00132 static IOManager& Instance(); 00133 00134 private: 00135 IOManager(); 00136 IOManager(const IOManager&) {} 00137 IOManager& operator=(const IOManager&) {return *this;} 00138 00139 EntityIOHFList entity_iohf_list_; 00140 AlignmentIOFList alignment_io_list_; 00141 SurfaceIOFList surface_io_list_; 00142 00143 #if OST_IMG_ENABLED 00144 MapIOFList map_io_list_; 00145 #endif 00146 }; 00147 00148 00149 00150 }} 00151 00152 #endif
1.5.8