35template <
typename char_t,
typename traits_t = std::
char_traits<
char_t>>
78 template <
typename record_type>
79 requires std::same_as<std::ranges::range_value_t<record_type>,
std::string_view>
80 void cache_record_into(
char const record_end,
char const field_sep, record_type & raw_record)
82 bool has_overflowed =
false;
85 size_t const number_of_fields = raw_record.size();
86 size_t number_of_seen_fields = 0;
91 auto overflow_into_buffer = [&]()
94 has_overflowed =
true;
103 while (number_of_seen_fields < number_of_fields - 1)
109 field_positions[number_of_seen_fields] = ptr -
stream_buf->gptr() + old_count;
111 ++number_of_seen_fields;
115 overflow_into_buffer();
129 overflow_into_buffer();
153 field_positions.
back() = old_count + count;
155 for (
size_t i = 1; i < number_of_fields; ++i)
156 raw_record[i] =
std::string_view{data_begin + field_positions[i - 1] + 1, data_begin + field_positions[i]};
80 void cache_record_into(
char const record_end,
char const field_sep, record_type & raw_record) {
…}
173 int32_t remaining_bytes{size};
181 remaining_bytes -= number_of_copied_bytes;
185 &&
"I still need to read characters but my stream is at end.");
188 if (remaining_bytes != 0)
240 assert(lhs.stream_buf !=
nullptr);
242 return (lhs.stream_buf->gptr() == lhs.stream_buf->egptr());
248 return !(lhs == std::default_sentinel);
254 return rhs == std::default_sentinel;
260 return !(rhs == std::default_sentinel);
Functionally the same as std::istreambuf_iterator, but faster.
Definition fast_istreambuf_iterator.hpp:37
ptrdiff_t difference_type
Defaults to ptrdiff_t.
Definition fast_istreambuf_iterator.hpp:49
void operator++(int)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition fast_istreambuf_iterator.hpp:219
fast_istreambuf_iterator & operator++()
Advance by one and rebuffer if necessary (vtable lookup iff rebuffering).
Definition fast_istreambuf_iterator.hpp:207
reference operator*() const
Read current value from buffer (no vtable lookup, safe if not at end).
Definition fast_istreambuf_iterator.hpp:226
fast_istreambuf_iterator() noexcept=default
Defaulted.
std::string overflow_buffer
Place to store a range of characters that overlaps stream buffer boundaries.
Definition fast_istreambuf_iterator.hpp:43
char_t reference
The char type of the stream.
Definition fast_istreambuf_iterator.hpp:51
friend bool operator!=(std::default_sentinel_t const &, fast_istreambuf_iterator const &rhs) noexcept
True if the read buffer is empty; involves no vtable lookup.
Definition fast_istreambuf_iterator.hpp:258
friend bool operator!=(fast_istreambuf_iterator const &lhs, std::default_sentinel_t const &) noexcept
True if the read buffer is empty; involves no vtable lookup.
Definition fast_istreambuf_iterator.hpp:246
friend bool operator==(fast_istreambuf_iterator const &lhs, std::default_sentinel_t const &) noexcept
True if the read buffer is not empty; involves no vtable lookup.
Definition fast_istreambuf_iterator.hpp:238
friend bool operator==(std::default_sentinel_t const &, fast_istreambuf_iterator const &rhs) noexcept
True if the read buffer is not empty; involves no vtable lookup.
Definition fast_istreambuf_iterator.hpp:252
void cache_record_into(char const record_end, char const field_sep, record_type &raw_record)
Cache until raw_record.size() - 1 occurrences of field_sep followed by record_end were found.
Definition fast_istreambuf_iterator.hpp:80
stream_buffer_exposer< char_t, traits_t > * stream_buf
Down-cast pointer to the stream-buffer.
Definition fast_istreambuf_iterator.hpp:40
void pointer
Has no pointer type.
Definition fast_istreambuf_iterator.hpp:52
char_t value_type
The char type of the stream.
Definition fast_istreambuf_iterator.hpp:50
std::string_view cache_bytes(int32_t const size)
Cache size bytes from input stream.
Definition fast_istreambuf_iterator.hpp:160
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
SeqAn specific customisations in the standard namespace.
Provides seqan3::detail::stream_buffer_exposer.
Functionally the same as std::basic_streambuf<char_t, traits_t_>, but exposes protected members as pu...
Definition stream_buffer_exposer.hpp:32