12#ifndef edlsimplebuffer_h
13#define edlsimplebuffer_h
30 assign(incoming.m_buffer, incoming.m_bufferSize);
35 %apply
char *BYTE {
const uint8 *src};
38 %apply uint8_t INPUT[] {
const uint8 *src};
74 if (index >= m_bufferSize)
78 return m_buffer[index];
83 if (index >= m_bufferSize)
87 return m_buffer[index];
93 assign(incoming.m_buffer, incoming.m_bufferSize);
101 if (newSize != (
uint32) newSize)
107 if (!newSize && m_buffer)
112 else if (!m_buffer && newSize != 0)
114 m_buffer = (
uint8 *) m_allocate(newSize);
121 else if (newSize != m_bufferSize)
123 uint8 *newBuffer = (
uint8 *) m_reallocate(m_buffer, newSize);
128 m_buffer = newBuffer;
130 m_bufferSize = newSize;
136 if (m_buffer && m_bufferSize)
138 memset(m_buffer, 0, m_bufferSize);
150 m_reallocate = realloc;
153 void assign(
const uint8 *src,
size_t size)
158 memcpy(m_buffer, src,
size);
165 m_deallocate(m_buffer);
173 typedef void *(*AllocatorFn)(
size_t n);
174 typedef void (*DeallocatorFn)(
void *p);
175 typedef void *(*ReallocatorFn)(
void *p,
size_t newSize);
177 AllocatorFn m_allocate;
178 DeallocatorFn m_deallocate;
179 ReallocatorFn m_reallocate;
CEDLSimpleBuffer(const CEDLSimpleBuffer &incoming)
Definition edlsimplebuffer.h:27
CEDLSimpleBuffer(const uint8 *src, size_t size)
Definition edlsimplebuffer.h:42
CEDLSimpleBuffer & operator=(const CEDLSimpleBuffer &incoming)
Definition edlsimplebuffer.h:90
~CEDLSimpleBuffer()
Definition edlsimplebuffer.h:60
void clear()
Definition edlsimplebuffer.h:134
const uint8 & operator[](size_t index) const
Definition edlsimplebuffer.h:81
void resize(size_t newSize)
Definition edlsimplebuffer.h:97
CEDLSimpleBuffer(size_t size=0, bool clearBuff=false)
Definition edlsimplebuffer.h:52
size_t size() const
Definition edlsimplebuffer.h:66
uint8 & operator[](size_t index)
Definition edlsimplebuffer.h:72
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:32
@ 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:54
@ EDL_ERR_BAD_ARGUMENTS
General error for bad arguments passed to an API function.
Definition edlerrors.h:42