23 #if !defined (octave_oct_locbuf_h)
24 #define octave_oct_locbuf_h 1
44 operator T *()
const {
return data; }
77 static OCTAVE_API
void clear (
void);
105 octave_chunk_buffer&
operator = (
const octave_chunk_buffer&);
110 #define SPECIALIZE_POD_BUFFER(TYPE) \
112 class octave_local_buffer<TYPE> : private octave_chunk_buffer \
115 octave_local_buffer (size_t size) \
116 : octave_chunk_buffer (size * sizeof (TYPE)) { } \
118 operator TYPE *() const \
120 return reinterpret_cast<TYPE *> (this->data ()); \
148 operator T **()
const {
return reinterpret_cast<T **
> (this->
data ()); }
159 operator const T **()
const
161 return reinterpret_cast<const T **
> (this->
data ());
170 #if 0 // defined (HAVE_DYNAMIC_AUTO_ARRAYS)
174 #define OCTAVE_LOCAL_BUFFER_MAX_STACK_SIZE 8192
182 #define OCTAVE_LOCAL_BUFFER(T, buf, size) \
183 const size_t _bufsize_ ## buf = size; \
184 const bool _lbufaut_ ## buf = _bufsize_ ## buf * sizeof (T) \
185 <= OCTAVE_LOCAL_BUFFER_MAX_STACK_SIZE; \
186 T _bufaut_ ## buf [_lbufaut_ ## buf ? _bufsize_ ## buf : 0]; \
187 octave_local_buffer<T> _bufheap_ ## buf \
188 (!_lbufaut_ ## buf ? _bufsize_ ## buf : 0); \
189 T *buf = _lbufaut_ ## buf \
190 ? _bufaut_ ## buf : static_cast<T *> (_bufheap_ ## buf)
197 #define OCTAVE_LOCAL_BUFFER(T, buf, size) \
198 octave_local_buffer<T> _buffer_ ## buf (size); \
199 T *buf = _buffer_ ## buf
206 #define OCTAVE_LOCAL_BUFFER_INIT(T, buf, size, value) \
207 OCTAVE_LOCAL_BUFFER (T, buf, size); \
208 for (size_t _buf_iter = 0, _buf_size = size; \
209 _buf_iter < _buf_size; _buf_iter++) \
210 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
size_t size(T const (&)[z])
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)