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];
98 assign(incoming.m_buffer, incoming.m_bufferSize);
106 if (newSize != (
uint32) newSize)
112 if (!newSize && m_buffer)
117 else if (!m_buffer && newSize != 0)
119 m_buffer = (
uint8 *) m_allocate(newSize);
126 else if (newSize != m_bufferSize)
128 uint8 *newBuffer = (
uint8 *) m_reallocate(m_buffer, newSize);
133 m_buffer = newBuffer;
135 m_bufferSize = newSize;
141 if (m_buffer && m_bufferSize)
143 memset(m_buffer, 0, m_bufferSize);
155 m_reallocate = realloc;
158 void assign(
const uint8 *src,
size_t size)
163 memcpy(m_buffer, src,
size);
170 m_deallocate(m_buffer);
178 typedef void *(*AllocatorFn)(
size_t n);
179 typedef void (*DeallocatorFn)(
void *p);
180 typedef void *(*ReallocatorFn)(
void *p,
size_t newSize);
182 AllocatorFn m_allocate;
183 DeallocatorFn m_deallocate;
184 ReallocatorFn m_reallocate;
CEDLSimpleBuffer(const CEDLSimpleBuffer &incoming)
Definition edlsimplebuffer.h:29
CEDLSimpleBuffer(const uint8 *src, size_t size)
Definition edlsimplebuffer.h:47
CEDLSimpleBuffer & operator=(const CEDLSimpleBuffer &incoming)
Definition edlsimplebuffer.h:95
~CEDLSimpleBuffer()
Definition edlsimplebuffer.h:65
void clear()
Definition edlsimplebuffer.h:139
const uint8 & operator[](size_t index) const
Definition edlsimplebuffer.h:86
void resize(size_t newSize)
Definition edlsimplebuffer.h:102
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:34
unsigned char uint8
Definition edltypes.h:32
@ 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