14#ifndef edlsimplebuffer_h
15#define edlsimplebuffer_h
32 assign(incoming.m_buffer, incoming.m_bufferSize);
37 %apply
char *BYTE {
const uint8 *src};
40 %apply uint8_t INPUT[] {
const uint8 *src};
43 %apply
char INPUT[] {
const uint8 *src}
79 if (index >= m_bufferSize)
83 return m_buffer[index];
88 if (index >= m_bufferSize)
92 return m_buffer[index];
97 if (m_bufferSize == 0)
107 assign(incoming.m_buffer, incoming.m_bufferSize);
115 if (newSize != (
uint32) newSize)
121 if (!newSize && m_buffer)
126 else if (!m_buffer && newSize != 0)
128 m_buffer = (
uint8 *) m_allocate(newSize);
135 else if (newSize != m_bufferSize)
137 uint8 *newBuffer = (
uint8 *) m_reallocate(m_buffer, newSize);
142 m_buffer = newBuffer;
144 m_bufferSize = newSize;
150 if (m_buffer && m_bufferSize)
152 memset(m_buffer, 0, m_bufferSize);
158 if (m_buffer && m_bufferSize)
160 memset(m_buffer, val, m_bufferSize);
172 m_reallocate = realloc;
175 void assign(
const uint8 *src,
size_t size)
180 memcpy(m_buffer, src,
size);
187 m_deallocate(m_buffer);
195 typedef void *(*AllocatorFn)(
size_t n);
196 typedef void (*DeallocatorFn)(
void *p);
197 typedef void *(*ReallocatorFn)(
void *p,
size_t newSize);
199 AllocatorFn m_allocate;
200 DeallocatorFn m_deallocate;
201 ReallocatorFn m_reallocate;
CEDLSimpleBuffer(const CEDLSimpleBuffer &incoming)
Definition edlsimplebuffer.h:29
void fill(uint8 val)
Definition edlsimplebuffer.h:156
const uint8 * data() const
Definition edlsimplebuffer.h:95
CEDLSimpleBuffer(const uint8 *src, size_t size)
Definition edlsimplebuffer.h:47
CEDLSimpleBuffer & operator=(const CEDLSimpleBuffer &incoming)
Definition edlsimplebuffer.h:104
~CEDLSimpleBuffer()
Definition edlsimplebuffer.h:65
void clear()
Definition edlsimplebuffer.h:148
const uint8 & operator[](size_t index) const
Definition edlsimplebuffer.h:86
void resize(size_t newSize)
Definition edlsimplebuffer.h:111
CEDLSimpleBuffer(size_t size=0, bool clearBuff=false)
Definition edlsimplebuffer.h:57
size_t size() const
Definition edlsimplebuffer.h:71
uint8 & operator[](size_t index)
Definition edlsimplebuffer.h:77
EDL_API void throwEDLError(uint32 errorcode)
Utility - Throw an IEDLError exception with the given error code.
#define _END_EDL_DOM_NAMESPACE
Definition edlnamespaces.h:110
#define _BEGIN_EDL_DOM_NAMESPACE
Definition edlnamespaces.h:109
EDL "standard" types including known bit-length signed and unsigned integer type[def]s and definition...
unsigned int uint32
Definition edltypes.h:36
unsigned char uint8
Definition edltypes.h:34
@ EDL_ERR_OUTOFMEMORY
Out of memory.
Definition edlerrors.h:34
@ JM_ERR_RANGE_ERROR
An attempt was made to request or add an item from the API with an out-of-bounds index.
Definition edlerrors.h:57
@ EDL_ERR_BAD_ARGUMENTS
General error for bad arguments passed to an API function.
Definition edlerrors.h:44