42 using ElementType = ELEMENT_TYPE;
105 nonvirtual span<ElementType>
ReadBlocking (span<ElementType> intoBuffer);
116 nonvirtual optional<span<ElementType>>
ReadNonBlocking (span<ElementType> intoBuffer);
138 nonvirtual optional<ElementType>
Peek ();
139 nonvirtual span<ElementType>
Peek (span<ElementType> intoBuffer);
160 nonvirtual
size_t ReadAll (ElementType* intoStart, ElementType* intoEnd);
210 [[deprecated (
"Since Stroika v3.0d5 use Read/1-span")]]
size_t Read (ElementType* intoStart, ElementType* intoEnd)
212 return Read (span{intoStart, intoEnd}).size ();
217 static constexpr size_t kDefaultReadBufferSize_ = 8 * 1024;
218 static constexpr size_t kMaxBufferedChunkSize_ = 64 * 1024;
223 static constexpr size_t kCountPingPingBufs_ = 2;
227 using InlineBufferElementType_ = conditional_t<same_as<Characters::Character, ElementType>, char32_t, ElementType>;
228 static_assert (
sizeof (ElementType) ==
sizeof (InlineBufferElementType_));
232 CacheBlock_ () =
default;
233 size_t GetSize ()
const;
236 optional<ElementType> Peek1FromCache (
SeekOffsetType actualOffset)
const;
237 optional<ElementType> Read1FromCache (
SeekOffsetType* actualOffset);
238 optional<size_t> ReadFromCache (
SeekOffsetType* actualOffset, span<ElementType> into);
239 void FillCacheWith (
SeekOffsetType s, span<InlineBufferElementType_> into);
251 CacheBlock_ fCacheBlocks_[kCountPingPingBufs_];
252 size_t fCacheBlockLastFilled_{0};
255 nonvirtual optional<ElementType> Peek1FromCache_ ()
const;
256 nonvirtual optional<ElementType> Read1FromCache_ ();
257 nonvirtual optional<size_t> ReadFromCache_ (span<ElementType> into);
258 nonvirtual
void FillCacheWith_ (
SeekOffsetType s, span<InlineBufferElementType_> into);