34 while (
mChunks.back().Append(dataView) > 0)
44 const size_t desiredSize =
GetSize();
50 auto begin = chunk.Data.begin();
69 const size_t dataSize = dataView.second;
72 const size_t bytesLeft = dataSize - bytesToWrite;
74 const uint8_t* beginData =
static_cast<const uint8_t*
>(dataView.first);
75 const uint8_t* endData = beginData + bytesToWrite;
80 if (bytesToWrite == 1)
92 dataView.first = endData;
93 dataView.second = bytesLeft;
117 , mListIterator(isBegin ? mStream->
mChunks.cbegin() : mStream->
mChunks.cend())
125 mShowLinearPart =
false;
142 return { mStream->mLinearData.data(), mStream->mLinearData.size() };
144 return { mListIterator->Data.data(), mListIterator->BytesUsed };
154 return !(*
this == rhs);
159 return mStream == rhs.mStream && mListIterator == rhs.mListIterator &&
160 mShowLinearPart == rhs.mShowLinearPart;
auto operator*(PffftAlignedCount x, Integral y) -> std::enable_if_t< std::is_unsigned_v< Integral > &&sizeof(Integral)<=sizeof(size_t), PffftAlignedCount >
A low overhead memory stream with O(1) append, low heap fragmentation and a linear memory view.
bool IsEmpty() const noexcept
const size_t GetSize() const noexcept
std::pair< const void *, size_t > StreamChunk
void AppendData(const void *data, const size_t length)
const void * GetData() const
void AppendByte(char data)
static constexpr size_t ChunkSize
void copy(const T *src, T *dst, int32_t n)
size_t Append(StreamChunk &dataView)
std::array< uint8_t, ChunkSize > Data
Iterator(const Iterator &)=default
bool operator==(const Iterator &rhs) const noexcept
StreamChunk operator->() const
StreamChunk operator*() const
bool operator!=(const Iterator &rhs) const noexcept