safecopy.H File Reference

#include <cstring>
#include "Util/TypeTraits.H"
Include dependency graph for safecopy.H:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  SafeCopyHelper< T, isTrivial >
 Helper template struct for pointer version of safecopy(). More...
struct  SafeCopyHelper< T, true >
 Specialized implementation for trivial types. More...

Functions

template<class Iter , class ConstIter >
void genericcopy (Iter dest, ConstIter src, unsigned int count)
 Element-by-element copy a series forward iterators.
template<class Iter , class ConstIter >
void safecopy (Iter dest, ConstIter src, unsigned int count)
 A generic version of safecopy() for iterators.
template<class T >
void safecopy (T *dest, const T *src, unsigned int count)
 A specialized version of safecopy() for pointers.

Detailed Description

Provides a "safe" replacement for memcpy: when INVT_MEM_DEBUG is not defined, we just delegate to memcpy(), however when INVT_MEM_DEBUG is defined we use a generic iterator version, which allows the use of a range-checked iterator (such as CheckedIterator) for tracking down memory-access related bugs.

Definition in file safecopy.H.


Function Documentation

template<class Iter , class ConstIter >
void genericcopy ( Iter  dest,
ConstIter  src,
unsigned int  count 
) [inline]

Element-by-element copy a series forward iterators.

Definition at line 52 of file safecopy.H.

Referenced by safecopy().

template<class T >
void safecopy ( T *  dest,
const T *  src,
unsigned int  count 
) [inline]

A specialized version of safecopy() for pointers.

This version uses memcpy() internally for maximum efficiency if T is a "trivial" type, otherwise it uses genericcopy(). Note however that safecopy's third parameter is number-of-elements, NOT number of bytes (i.e., unlike memcpy).

Definition at line 87 of file safecopy.H.

template<class Iter , class ConstIter >
void safecopy ( Iter  dest,
ConstIter  src,
unsigned int  count 
) [inline]

A generic version of safecopy() for iterators.

Definition at line 60 of file safecopy.H.

References genericcopy().

Referenced by Hmax::origGetC2().

Generated on Sun May 8 08:42:52 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3