// -*- c++ -*- /*****************************************************************************/ // Copyright (c) Illumina 2008 // Author: Richard Shaw // // This software is covered by the "Illumina Genome Analyzer Software // License Agreement" and the "Illumina Source Code License Agreement", // and certain third party copyright/licenses, and any user of this // source file is bound by the terms therein (see accompanying files // Illumina_Genome_Analyzer_Software_License_Agreement.pdf and // Illumina_Source_Code_License_Agreement.pdf and third party // copyright/license notices). /*****************************************************************************/ #ifndef FILE_BUFFER_H #define FILE_BUFFER_H /*****************************************************************************/ #include #include /*****************************************************************************/ class File_Buffer_Impl; /*****************************************************************************/ class File_Buffer { public: typedef enum { compressionNone, compressionGzip, compressionBzip2 } Compression_Type; typedef std::vector Line_Vec; typedef Line_Vec::const_iterator Line_Vec_CIter; File_Buffer(const std::string& file_name, Compression_Type compression_type); virtual ~File_Buffer(); bool write_some_lines(const Line_Vec& line_vec); bool write_buffer(char* buf_ptr, unsigned int num_bytes); bool end_file(); bool read_line(std::string& line_str, bool& at_eof); const std::string file_path_str(); private: // No copying. File_Buffer(const File_Buffer& file_buf); void operator=(const File_Buffer& file_buf); File_Buffer_Impl* my_impl_ptr; }; /*****************************************************************************/ bool resolve_compression(const std::string& compr_name, File_Buffer::Compression_Type& compr_type, std::string& msg_str); std::string add_std_extension(const std::string& file_path_str, const File_Buffer::Compression_Type compr_type); /*****************************************************************************/ #endif // ! FILE_BUFFER_H /*****************************************************************************/