38#include "pluginterfaces/base/futils.h"
54, allocationError (false)
66, allocationError (false)
108 memcpy (data, &
memory[
cursor],
static_cast<size_t> (numBytes));
114 *numBytesRead = numBytes;
124 if (buffer ==
nullptr)
125 return kInvalidArgument;
128 TSize requiredSize =
cursor + numBytes;
129 if (requiredSize >
size)
140 memcpy (&
memory[
cursor], buffer,
static_cast<size_t> (numBytes));
148 *numBytesWritten = numBytes;
183 return kInvalidArgument;
224 char* newMemory =
nullptr;
228 newMemory = (
char*)realloc (
memory, (
size_t)newMemorySize);
229 if (newMemory ==
nullptr && newMemorySize > 0)
231 newMemory = (
char*)malloc ((
size_t)newMemorySize);
240 newMemory = (
char*)malloc ((
size_t)newMemorySize);
242 if (newMemory ==
nullptr)
244 if (newMemorySize > 0)
IMPLEMENT_FUNKNOWN_METHODS(RunLoop, Steinberg::Linux::IRunLoop, Steinberg::Linux::IRunLoop::iid)
A low overhead memory stream with O(1) append, low heap fragmentation and a linear memory view.
void setSize(TSize size)
set the memory size, a realloc will occur if memory already used
char * detachData()
returns the memory pointer and give up ownership
tresult PLUGIN_API tell(int64 *pos) SMTG_OVERRIDE
tresult PLUGIN_API read(void *buffer, int32 numBytes, int32 *numBytesRead) SMTG_OVERRIDE
TSize getSize() const
returns the current memory size
char * getData() const
returns the memory pointer
tresult PLUGIN_API seek(int64 pos, int32 mode, int64 *result) SMTG_OVERRIDE
bool truncate()
realloc to the current use memory size if needed
bool truncateToCursor()
truncate memory at current cursor position
tresult PLUGIN_API write(void *buffer, int32 numBytes, int32 *numBytesWritten) SMTG_OVERRIDE
static const TSize kMemGrowAmount