40 using ElementType = ELEMENT_TYPE;
103 nonvirtual span<ElementType>
ReadBlocking (span<ElementType> intoBuffer);
114 nonvirtual optional<span<ElementType>>
ReadNonBlocking (span<ElementType> intoBuffer);
136 nonvirtual optional<ElementType>
Peek ();
137 nonvirtual span<ElementType>
Peek (span<ElementType> intoBuffer);
158 nonvirtual
size_t ReadAll (ElementType* intoStart, ElementType* intoEnd);
197 nonvirtual
bool IsAtEOF ();
200 [[deprecated (
"Since Stroika v3.0d5 use Read/1-span")]]
size_t Read (ElementType* intoStart, ElementType* intoEnd)
202 return Read (span{intoStart, intoEnd}).size ();
207 static constexpr size_t kDefaultReadBufferSize_ = 8 * 1024;
208 static constexpr size_t kMaxBufferedChunkSize_ = 64 * 1024;
213 static constexpr size_t kCountPingPingBufs_ = 2;
217 using InlineBufferElementType_ = conditional_t<same_as<Characters::Character, ElementType>, char32_t, ElementType>;
218 static_assert (
sizeof (ElementType) ==
sizeof (InlineBufferElementType_));
222 CacheBlock_ () =
default;
223 size_t GetSize ()
const;
226 optional<ElementType> Peek1FromCache (
SeekOffsetType actualOffset)
const;
227 optional<ElementType> Read1FromCache (
SeekOffsetType* actualOffset);
228 optional<size_t> ReadFromCache (
SeekOffsetType* actualOffset, span<ElementType> into);
229 void FillCacheWith (
SeekOffsetType s, span<InlineBufferElementType_> into);
241 CacheBlock_ fCacheBlocks_[kCountPingPingBufs_];
242 size_t fCacheBlockLastFilled_{0};
245 nonvirtual optional<ElementType> Peek1FromCache_ ()
const;
246 nonvirtual optional<ElementType> Read1FromCache_ ();
247 nonvirtual optional<size_t> ReadFromCache_ (span<ElementType> into);
248 nonvirtual
void FillCacheWith_ (
SeekOffsetType s, span<InlineBufferElementType_> into);