40 using ElementType = ELEMENT_TYPE;
99 nonvirtual span<ElementType>
ReadBlocking (span<ElementType> intoBuffer);
110 nonvirtual optional<span<ElementType>>
ReadNonBlocking (span<ElementType> intoBuffer);
132 nonvirtual optional<ElementType>
Peek ();
133 nonvirtual span<ElementType>
Peek (span<ElementType> intoBuffer);
154 nonvirtual
size_t ReadAll (ElementType* intoStart, ElementType* intoEnd);
193 nonvirtual
bool IsAtEOF ();
196 [[deprecated (
"Since Stroika v3.0d5 use Read/1-span")]]
size_t Read (ElementType* intoStart, ElementType* intoEnd)
198 return Read (span{intoStart, intoEnd}).size ();
203 static constexpr size_t kDefaultReadBufferSize_ = 8 * 1024;
204 static constexpr size_t kMaxBufferedChunkSize_ = 64 * 1024;
209 static constexpr size_t kCountPingPingBufs_ = 2;
213 using InlineBufferElementType_ = conditional_t<same_as<Characters::Character, ElementType>, char32_t, ElementType>;
214 static_assert (
sizeof (ElementType) ==
sizeof (InlineBufferElementType_));
218 CacheBlock_ () =
default;
219 size_t GetSize ()
const;
222 optional<ElementType> Peek1FromCache (
SeekOffsetType actualOffset)
const;
223 optional<ElementType> Read1FromCache (
SeekOffsetType* actualOffset);
224 optional<size_t> ReadFromCache (
SeekOffsetType* actualOffset, span<ElementType> into);
225 void FillCacheWith (
SeekOffsetType s, span<InlineBufferElementType_> into);
237 CacheBlock_ fCacheBlocks_[kCountPingPingBufs_];
238 size_t fCacheBlockLastFilled_{0};
241 nonvirtual optional<ElementType> Peek1FromCache_ ()
const;
242 nonvirtual optional<ElementType> Read1FromCache_ ();
243 nonvirtual optional<size_t> ReadFromCache_ (span<ElementType> into);
244 nonvirtual
void FillCacheWith_ (
SeekOffsetType s, span<InlineBufferElementType_> into);