|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file. 1 #ifndef GENESIS_UTILS_IO_INPUT_STREAM_H_
2 #define GENESIS_UTILS_IO_INPUT_STREAM_H_
48 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
50 #include <string_view>
52 #endif // ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
111 : source_name_(
"invalid source" )
120 explicit InputStream( std::shared_ptr<BaseInputSource> input_source )
124 init_( input_source );
137 *
this = std::move( other );
172 throw std::runtime_error(
177 throw std::domain_error(
178 "Invalid input char in " +
source_name() +
" at " +
at() +
"."
211 if( current_ ==
'\n' ) {
275 void get_line( std::string& target );
291 #if ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
314 std::string_view get_line_view();
340 std::array<std::string_view, N> get_line_views()
343 std::array<std::string_view, N> result;
344 fill_line_views_( result.data(), result.size() );
351 void fill_line_views_( std::string_view* str_views,
size_t n_lines );
353 #endif // ((defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) || __cplusplus >= 201703L)
358 size_t update_and_move_to_line_or_buffer_end_();
359 void move_to_line_or_buffer_end_(
size_t const stop_pos );
360 void approach_line_or_buffer_end_avx512_(
size_t const stop_pos );
361 void approach_line_or_buffer_end_avx2_(
size_t const stop_pos );
362 void approach_line_or_buffer_end_unrolled_(
size_t const stop_pos );
363 void increment_to_next_line_();
392 assert( data_pos_ <= data_end_ );
393 return { &buffer_[ data_pos_ ], data_end_ - data_pos_ };
437 std::string
at()
const
447 return data_pos_ < data_end_;
454 inline explicit operator bool()
const
456 return data_pos_ < data_end_;
464 return data_pos_ >= data_end_;
492 void init_( std::shared_ptr<BaseInputSource> input_source );
507 void update_blocks_();
513 void set_current_char_();
523 std::unique_ptr<InputReader> input_reader_ =
nullptr;
524 std::string source_name_;
540 #endif // include guard
Provides some valuable additions to STD.
std::string to_string(GenomeLocus const &locus)
Container namespace for all symbols of genesis in order to keep them separate when used as a library.