36 #include <htslib/hts.h>
43 namespace population {
50 std::string
const& file_name,
51 std::string
const& mode
53 : file_name_( file_name )
54 , hts_file_( ::hts_open( file_name.c_str(), mode.c_str() ))
58 throw std::runtime_error(
"Failed to open htslib file " +
file_name );
65 ::hts_close( hts_file_ );
75 std::swap( file_name_, other.file_name_ );
83 if(
this == &other ) {
86 std::swap( file_name_, other.file_name_ );
97 ::htsFormat
const* fmt_ptr = ::hts_get_format( hts_file_ );
98 char* fmt_str = ::hts_format_description( fmt_ptr );
99 auto const ret = std::string( fmt_str );
106 ::htsFormat
const* fmt_ptr = ::hts_get_format( hts_file_ );
107 return std::string( ::hts_format_file_extension( fmt_ptr ));
113 #endif // htslib guard