1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html 2 3 #include "smgenericin.hh" 4 #include "smmmapin.hh" 5 #include "smstdioin.hh" 6 7 using SpectMorph::GenericIn; 8 using SpectMorph::MMapIn; 9 using SpectMorph::StdioIn; 10 using std::string; 11 12 /** 13 * Open a file for reading, using memory mapping if possible, stdio based reading otherwise. 14 * 15 * \returns the newly created GenericIn object, or NULL on error 16 */ 17 GenericIn* open(const std::string & filename)18GenericIn::open (const std::string& filename) 19 { 20 GenericIn *file = MMapIn::open (filename); 21 if (!file) 22 file = StdioIn::open (filename); 23 return file; 24 } 25 ~GenericIn()26GenericIn::~GenericIn() 27 { 28 } 29