GNU Octave  3.8.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Macros | Functions
oct-mem.h File Reference
#include <cstddef>
#include <cstring>
#include <algorithm>
#include "oct-cmplx.h"
#include "oct-inttypes.h"
Include dependency graph for oct-mem.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define DEFINE_POD_FILL(T)
#define DEFINE_POD_NEW_DELETE(T)
#define DEFINE_POD_UCOPY(T)

Functions

template<class T >
void copy_or_memcpy (size_t n, const T *src, T *dest)
void copy_or_memcpy (size_t n, const double *src, double *dest)
void copy_or_memcpy (size_t n, const float *src, float *dest)
void copy_or_memcpy (size_t n, const char *src, char *dest)
void copy_or_memcpy (size_t n, const short *src, short *dest)
void copy_or_memcpy (size_t n, const int *src, int *dest)
void copy_or_memcpy (size_t n, const long *src, long *dest)
void copy_or_memcpy (size_t n, const unsigned char *src, unsigned char *dest)
void copy_or_memcpy (size_t n, const unsigned short *src, unsigned short *dest)
void copy_or_memcpy (size_t n, const unsigned int *src, unsigned int *dest)
void copy_or_memcpy (size_t n, const unsigned long *src, unsigned long *dest)
void copy_or_memcpy (size_t n, const Complex *src, Complex *dest)
template<class T >
void copy_or_memcpy (size_t n, const octave_int< T > *src, octave_int< T > *dest)
template<class T >
void fill_or_memset (size_t n, const T &value, T *dest)
void fill_or_memset (size_t n, const double &value, double *dest)
void fill_or_memset (size_t n, const float &value, float *dest)
void fill_or_memset (size_t n, const char &value, char *dest)
void fill_or_memset (size_t n, const short &value, short *dest)
void fill_or_memset (size_t n, const int &value, int *dest)
void fill_or_memset (size_t n, const long &value, long *dest)
void fill_or_memset (size_t n, const unsigned char &value, unsigned char *dest)
void fill_or_memset (size_t n, const unsigned short &value, unsigned short *dest)
void fill_or_memset (size_t n, const unsigned int &value, unsigned int *dest)
void fill_or_memset (size_t n, const unsigned long &value, unsigned long *dest)
void fill_or_memset (size_t n, const Complex &value, Complex *dest)
template<class T >
void fill_or_memset (size_t n, const octave_int< T > &value, octave_int< T > *dest)
template<class T >
bool helper_is_zero_mem (const T &value)
template<class T >
bool helper_is_zero_mem (const std::complex< T > &value)
template<class T >
bool helper_is_zero_mem (const octave_int< T > &value)
template<class T >
void no_ctor_delete (T *ptr)
template<>
void no_ctor_delete< Complex > (Complex *ptr)
template<>
void no_ctor_delete< FloatComplex > (FloatComplex *ptr)
template<>
void no_ctor_delete< octave_int16 > (octave_int16 *ptr)
template<>
void no_ctor_delete< octave_int32 > (octave_int32 *ptr)
template<>
void no_ctor_delete< octave_int64 > (octave_int64 *ptr)
template<>
void no_ctor_delete< octave_int8 > (octave_int8 *ptr)
template<>
void no_ctor_delete< octave_uint16 > (octave_uint16 *ptr)
template<>
void no_ctor_delete< octave_uint32 > (octave_uint32 *ptr)
template<>
void no_ctor_delete< octave_uint64 > (octave_uint64 *ptr)
template<>
void no_ctor_delete< octave_uint8 > (octave_uint8 *ptr)
template<class T >
T * no_ctor_new (size_t n)
template<>
Complexno_ctor_new< Complex > (size_t n)
template<>
FloatComplexno_ctor_new< FloatComplex > (size_t n)
template<>
octave_int16no_ctor_new< octave_int16 > (size_t n)
template<>
octave_int32no_ctor_new< octave_int32 > (size_t n)
template<>
octave_int64no_ctor_new< octave_int64 > (size_t n)
template<>
octave_int8no_ctor_new< octave_int8 > (size_t n)
template<>
octave_uint16no_ctor_new< octave_uint16 > (size_t n)
template<>
octave_uint32no_ctor_new< octave_uint32 > (size_t n)
template<>
octave_uint64no_ctor_new< octave_uint64 > (size_t n)
template<>
octave_uint8no_ctor_new< octave_uint8 > (size_t n)
size_t safe_size_comp (size_t n, size_t size)

Macro Definition Documentation

#define DEFINE_POD_FILL (   T)
Value:
inline void fill_or_memset (size_t n, const T& value, T *dest) \
{ \
if (helper_is_zero_mem (value)) \
std::memset (dest, 0, n * sizeof (T)); \
else \
std::fill_n (dest, n, value); \
}

Definition at line 99 of file oct-mem.h.

#define DEFINE_POD_NEW_DELETE (   T)
Value:
template <> \
inline T *no_ctor_new<T > (size_t n) \
{ return reinterpret_cast<T *> (new char [safe_size_comp (n, sizeof (T))]); } \
template <> \
inline void no_ctor_delete<T > (T *ptr) \
{ delete [] reinterpret_cast<char *> (ptr); }

Definition at line 140 of file oct-mem.h.

#define DEFINE_POD_UCOPY (   T)
Value:
inline void copy_or_memcpy (size_t n, const T *src, T *dest) \
{ std::memcpy (dest, src, n * sizeof (T)); }

Definition at line 53 of file oct-mem.h.

Function Documentation

template<class T >
void copy_or_memcpy ( size_t  n,
const T *  src,
T *  dest 
)
inline
void copy_or_memcpy ( size_t  n,
const double src,
double dest 
)
inline

Definition at line 57 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const float src,
float dest 
)
inline

Definition at line 58 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const char src,
char dest 
)
inline

Definition at line 59 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const short *  src,
short *  dest 
)
inline

Definition at line 60 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const int src,
int dest 
)
inline

Definition at line 61 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const long *  src,
long *  dest 
)
inline

Definition at line 62 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const unsigned char src,
unsigned char dest 
)
inline

Definition at line 63 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const unsigned short *  src,
unsigned short *  dest 
)
inline

Definition at line 64 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const unsigned int src,
unsigned int dest 
)
inline

Definition at line 65 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const unsigned long *  src,
unsigned long *  dest 
)
inline

Definition at line 66 of file oct-mem.h.

void copy_or_memcpy ( size_t  n,
const Complex src,
Complex dest 
)
inline

Definition at line 68 of file oct-mem.h.

template<class T >
void copy_or_memcpy ( size_t  n,
const octave_int< T > *  src,
octave_int< T > *  dest 
)
inline

Definition at line 72 of file oct-mem.h.

template<class T >
void fill_or_memset ( size_t  n,
const T &  value,
T *  dest 
)
inline
void fill_or_memset ( size_t  n,
const double value,
double dest 
)
inline

Definition at line 108 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const float value,
float dest 
)
inline

Definition at line 109 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const char value,
char dest 
)
inline

Definition at line 110 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const short &  value,
short *  dest 
)
inline

Definition at line 111 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const int value,
int dest 
)
inline

Definition at line 112 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const long &  value,
long *  dest 
)
inline

Definition at line 113 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const unsigned char value,
unsigned char dest 
)
inline

Definition at line 114 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const unsigned short &  value,
unsigned short *  dest 
)
inline

Definition at line 115 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const unsigned int value,
unsigned int dest 
)
inline

Definition at line 116 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const unsigned long &  value,
unsigned long *  dest 
)
inline

Definition at line 117 of file oct-mem.h.

void fill_or_memset ( size_t  n,
const Complex value,
Complex dest 
)
inline

Definition at line 119 of file oct-mem.h.

template<class T >
void fill_or_memset ( size_t  n,
const octave_int< T > &  value,
octave_int< T > *  dest 
)
inline

Definition at line 123 of file oct-mem.h.

template<class T >
bool helper_is_zero_mem ( const T &  value)
inline

Definition at line 81 of file oct-mem.h.

References IT.

Referenced by helper_is_zero_mem().

template<class T >
bool helper_is_zero_mem ( const std::complex< T > &  value)
inline

Definition at line 89 of file oct-mem.h.

References helper_is_zero_mem().

template<class T >
bool helper_is_zero_mem ( const octave_int< T > &  value)
inline

Definition at line 96 of file oct-mem.h.

References octave_int< T >::value().

template<class T >
void no_ctor_delete ( T *  ptr)
inline

Definition at line 137 of file oct-mem.h.

template<>
void no_ctor_delete< Complex > ( Complex ptr)
inline

Definition at line 148 of file oct-mem.h.

template<>
void no_ctor_delete< FloatComplex > ( FloatComplex ptr)
inline

Definition at line 149 of file oct-mem.h.

template<>
void no_ctor_delete< octave_int16 > ( octave_int16 ptr)
inline

Definition at line 152 of file oct-mem.h.

template<>
void no_ctor_delete< octave_int32 > ( octave_int32 ptr)
inline

Definition at line 153 of file oct-mem.h.

template<>
void no_ctor_delete< octave_int64 > ( octave_int64 ptr)
inline

Definition at line 154 of file oct-mem.h.

template<>
void no_ctor_delete< octave_int8 > ( octave_int8 ptr)
inline

Definition at line 151 of file oct-mem.h.

template<>
void no_ctor_delete< octave_uint16 > ( octave_uint16 ptr)
inline

Definition at line 156 of file oct-mem.h.

template<>
void no_ctor_delete< octave_uint32 > ( octave_uint32 ptr)
inline

Definition at line 157 of file oct-mem.h.

template<>
void no_ctor_delete< octave_uint64 > ( octave_uint64 ptr)
inline

Definition at line 158 of file oct-mem.h.

template<>
void no_ctor_delete< octave_uint8 > ( octave_uint8 ptr)
inline

Definition at line 155 of file oct-mem.h.

template<class T >
T* no_ctor_new ( size_t  n)
inline

Definition at line 129 of file oct-mem.h.

References safe_size_comp().

template<>
Complex* no_ctor_new< Complex > ( size_t  n)
inline

Definition at line 148 of file oct-mem.h.

template<>
FloatComplex* no_ctor_new< FloatComplex > ( size_t  n)
inline

Definition at line 149 of file oct-mem.h.

template<>
octave_int16* no_ctor_new< octave_int16 > ( size_t  n)
inline

Definition at line 152 of file oct-mem.h.

template<>
octave_int32* no_ctor_new< octave_int32 > ( size_t  n)
inline

Definition at line 153 of file oct-mem.h.

template<>
octave_int64* no_ctor_new< octave_int64 > ( size_t  n)
inline

Definition at line 154 of file oct-mem.h.

template<>
octave_int8* no_ctor_new< octave_int8 > ( size_t  n)
inline

Definition at line 151 of file oct-mem.h.

template<>
octave_uint16* no_ctor_new< octave_uint16 > ( size_t  n)
inline

Definition at line 156 of file oct-mem.h.

template<>
octave_uint32* no_ctor_new< octave_uint32 > ( size_t  n)
inline

Definition at line 157 of file oct-mem.h.

template<>
octave_uint64* no_ctor_new< octave_uint64 > ( size_t  n)
inline

Definition at line 158 of file oct-mem.h.

template<>
octave_uint8* no_ctor_new< octave_uint8 > ( size_t  n)
inline

Definition at line 155 of file oct-mem.h.

size_t safe_size_comp ( size_t  n,
size_t  size 
)
inline

Definition at line 39 of file oct-mem.h.

References size().

Referenced by no_ctor_new().