23 #if ! defined (octave_oct_locbuf_h)
24 #define octave_oct_locbuf_h 1
26 #include "octave-config.h"
48 operator T *()
const {
return data; }
81 static OCTAVE_API
void clear (
void);
109 octave_chunk_buffer&
operator = (
const octave_chunk_buffer&);
114 #define SPECIALIZE_POD_BUFFER(TYPE) \
116 class octave_local_buffer<TYPE> : private octave_chunk_buffer \
119 octave_local_buffer (size_t size) \
120 : octave_chunk_buffer (size * sizeof (TYPE)) { } \
122 operator TYPE *() const \
124 return reinterpret_cast<TYPE *> (this->data ()); \
144 template <
typename T>
152 operator T **()
const {
return reinterpret_cast<T **
> (this->
data ()); }
155 template <
typename T>
163 operator const T **()
const
165 return reinterpret_cast<const T **
> (this->
data ());
174 #if 0 // defined (HAVE_DYNAMIC_AUTO_ARRAYS)
178 #define OCTAVE_LOCAL_BUFFER_MAX_STACK_SIZE 8192
186 #define OCTAVE_LOCAL_BUFFER(T, buf, size) \
187 const size_t _bufsize_ ## buf = size; \
188 const bool _lbufaut_ ## buf = _bufsize_ ## buf * sizeof (T) \
189 <= OCTAVE_LOCAL_BUFFER_MAX_STACK_SIZE; \
190 T _bufaut_ ## buf [_lbufaut_ ## buf ? _bufsize_ ## buf : 0]; \
191 octave_local_buffer<T> _bufheap_ ## buf (! _lbufaut_ ## buf ? _bufsize_ ## buf : 0); \
192 T *buf = (_lbufaut_ ## buf \
193 ? _bufaut_ ## buf : static_cast<T *> (_bufheap_ ## buf))
200 #define OCTAVE_LOCAL_BUFFER(T, buf, size) \
201 octave_local_buffer<T> _buffer_ ## buf (size); \
202 T *buf = _buffer_ ## buf
209 #define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value) \
210 OCTAVE_LOCAL_BUFFER (T, buf, size); \
211 for (size_t _buf_iter = 0, _buf_size = size; \
212 _buf_iter < _buf_size; _buf_iter++) \
213 buf[_buf_iter] = value
octave_local_buffer(size_t size)
octave_local_buffer(size_t size)
static OCTAVE_API void clear(void)
octave_local_buffer & operator=(const octave_local_buffer &)
static const size_t chunk_size
octave_local_buffer(size_t size)
octave_chunk_buffer & operator=(const octave_chunk_buffer &)
virtual OCTAVE_API ~octave_chunk_buffer(void)
OCTAVE_API octave_chunk_buffer(size_t size)
~octave_local_buffer(void)
std::complex< float > FloatComplex
std::complex< double > Complex
#define SPECIALIZE_POD_BUFFER(TYPE)