ERC CISST - cisst software

vctFastCopy Class Reference

#include <vctFastCopy.h>

Collaboration diagram for vctFastCopy:

Collaboration graph
[legend]
List of all members.

Detailed Description

Container class for fast copy related methods.

The static methods in this class should not be used directly. These are helper methods used by the containers methods. To perform a FastCopy (aka memcpy), always use the methods FastCopyOf and FastCopyCompatible defined for vctFixedSizeVector, vctFixedSizeMatrix, vctDynamicVector, vctDynamicMatrix and vctDynamicNArray.

Definition at line 41 of file vctFastCopy.h.

Static Public Member Functions

Static Public Attributes

Static Protected Member Functions


Member Function Documentation

template<class _vector1Type, class _vector2Type>
static bool vctFastCopy::VectorSizeCompatible ( const _vector1Type &  vector1,
const _vector2Type &  vector2 
) [inline, static, protected]

Helper functions to test if sizes or strides are compatible.

Definition at line 48 of file vctFastCopy.h.

Referenced by ThrowUnlessValidVectorSizes(), and VectorCopyCompatible().

template<class _container1Type, class _container2Type>
static bool vctFastCopy::ContainerSizesCompatible ( const _container1Type &  container1,
const _container2Type &  container2 
) [inline, static, protected]

Helper functions to test if sizes or strides are compatible.

Definition at line 55 of file vctFastCopy.h.

Referenced by MatrixCopyCompatible(), NArrayCopyCompatible(), and ThrowUnlessValidContainerSizes().

template<class _vector1Type, class _vector2Type>
static bool vctFastCopy::VectorStrideCompatible ( const _vector1Type &  vector1,
const _vector2Type &  vector2 
) [inline, static, protected]

Helper functions to test if sizes or strides are compatible.

Definition at line 62 of file vctFastCopy.h.

Referenced by VectorCopy(), and VectorCopyCompatible().

template<class _matrix1Type, class _matrix2Type>
static bool vctFastCopy::MatrixStridesCompatible ( const _matrix1Type &  matrix1,
const _matrix2Type &  matrix2 
) [inline, static, protected]

Helper functions to test if sizes or strides are compatible.

Definition at line 70 of file vctFastCopy.h.

Referenced by MatrixCopy(), and MatrixCopyCompatible().

template<class _nArray1Type, class _nArray2Type>
static bool vctFastCopy::NArrayStridesCompatible ( const _nArray1Type &  nArray1,
const _nArray2Type &  nArray2 
) [inline, static, protected]

Helper functions to test if sizes or strides are compatible.

Definition at line 86 of file vctFastCopy.h.

Referenced by NArrayCopy(), and NArrayCopyCompatible().

template<class _vector1Type, class _vector2Type>
static void vctFastCopy::ThrowUnlessValidVectorSizes ( const _vector1Type &  vector1,
const _vector2Type &  vector2 
) throw (std::runtime_error) [inline, static, protected]

Helper function to throw an exception whenever sizes mismatch. This enforces that a standard message is sent.

Definition at line 99 of file vctFastCopy.h.

References cmnThrow(), and VectorSizeCompatible().

Referenced by VectorCopy().

template<class _container1Type, class _container2Type>
static void vctFastCopy::ThrowUnlessValidContainerSizes ( const _container1Type &  container1,
const _container2Type &  container2 
) throw (std::runtime_error) [inline, static, protected]

Helper function to throw an exception whenever sizes mismatch. This enforces that a standard message is sent.

Definition at line 109 of file vctFastCopy.h.

References cmnThrow(), and ContainerSizesCompatible().

Referenced by MatrixCopy(), and NArrayCopy().

template<class _vector1Type, class _vector2Type>
static bool vctFastCopy::VectorCopyCompatible ( const _vector1Type &  vector1,
const _vector2Type &  vector2 
) [inline, static]

Helper functions to test if a fast copy is possible.

Definition at line 130 of file vctFastCopy.h.

References VectorSizeCompatible(), and VectorStrideCompatible().

Referenced by vctDynamicConstVectorBase< vctDynamicVectorOwner< svlFilterSourceVideoCapture::_ImageFormat >, svlFilterSourceVideoCapture::_ImageFormat >::FastCopyCompatible(), and vctFixedSizeConstVectorBase< _size, _stride, int, vctFixedSizeVectorTraits< int, _size, 1 >::array >::FastCopyCompatible().

template<class _matrix1Type, class _matrix2Type>
static bool vctFastCopy::MatrixCopyCompatible ( const _matrix1Type &  matrix1,
const _matrix2Type &  matrix2 
) [inline, static]

Helper functions to test if a fast copy is possible.

Definition at line 140 of file vctFastCopy.h.

References ContainerSizesCompatible(), and MatrixStridesCompatible().

Referenced by vctDynamicConstMatrixBase< vctDynamicMatrixOwner< float >, float >::FastCopyCompatible().

template<class _nArray1Type, class _nArray2Type>
static bool vctFastCopy::NArrayCopyCompatible ( const _nArray1Type &  nArray1,
const _nArray2Type &  nArray2 
) [inline, static]

Helper functions to test if a fast copy is possible.

Definition at line 150 of file vctFastCopy.h.

References ContainerSizesCompatible(), and NArrayStridesCompatible().

Referenced by vctDynamicConstNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::FastCopyCompatible().

template<class _destinationVectorType, class _sourceVectorType>
static bool vctFastCopy::VectorCopy ( _destinationVectorType &  destination,
const _sourceVectorType &  source,
bool  performSafetyChecks 
) [inline, static]

Function to use memcpy whenever possible. This is not really and engine since it has no loop nor plugable operation, but it performs a similar size check as other engines.

Definition at line 166 of file vctFastCopy.h.

References ThrowUnlessValidVectorSizes(), and VectorStrideCompatible().

Referenced by vctDynamicVectorBase< vctDynamicVectorOwner< svlFilterSourceVideoCapture::_ImageFormat >, svlFilterSourceVideoCapture::_ImageFormat >::FastCopyOf(), and vctFixedSizeVectorBase< _size, 1, svlPoint2D, vctFixedSizeVectorTraits< svlPoint2D, _size, 1 >::array >::FastCopyOf().

template<class _destinationMatrixType, class _sourceMatrixType>
static bool vctFastCopy::MatrixCopy ( _destinationMatrixType &  destination,
const _sourceMatrixType &  source,
bool  performSafetyChecks 
) [inline, static]

Function to use memcpy whenever possible. This is not really and engine since it has no loop nor plugable operation, but it performs a similar size check as other engines. This method will attempt to copy either the whole matrix using a single memcpy or one memcpy for each row or column whenever possible.

First the method performs a serie of checks to make sure both matrices are compatible. If the sizes are incorrect, the method will throw an exception as do all cisstVector engines. If the strides are not compatible for a memcpy, the method return false. The safety checks can be skipped by turning the second parameter (performSafetyChecks) to false.

Then the method will test if both matrices are compact to figure out if a single memcpy is possible. Otherwise, the methods will compare the strides, assuming that either both row or column strides are equal to one.

Note:
If the safety checks are turned off, the caller must make sure that for both matrices have the same sizes and satisfy either: -1- both compact, -2- both have column strides equal to one OR -3- both have row strides equal to one. If these conditions are not satified, a memcpy might be performed on unallocated memory.

Definition at line 213 of file vctFastCopy.h.

References MatrixStridesCompatible(), and ThrowUnlessValidContainerSizes().

Referenced by vctDynamicMatrixBase< vctDynamicMatrixOwner< float >, float >::FastCopyOf(), and vctFixedSizeMatrixBase< _rows, _cols, _rowMajor?_cols:1, _rowMajor?1:_rows, double, vctFixedSizeMatrixTraits< double, _rows, _cols, _rowMajor?_cols:1, _rowMajor?1:_rows >::array >::FastCopyOf().

template<class _destinationNArrayType, class _sourceNArrayType>
static bool vctFastCopy::NArrayCopy ( _destinationNArrayType &  destination,
const _sourceNArrayType &  source,
bool  performSafetyChecks 
) [inline, static]

Function to use memcpy whenever possible. This is not really and engine since it has no loop nor plugable operation, but it performs a similar size check as other engines. This method will attempt to copy either the whole nArray using a single memcpy.

Definition at line 289 of file vctFastCopy.h.

References NArrayStridesCompatible(), and ThrowUnlessValidContainerSizes().

Referenced by vctDynamicNArrayBase< vctDynamicNArrayRefOwner< _elementType, _dimension >, _elementType, _dimension >::FastCopyOf().


Member Data Documentation

const bool vctFastCopy::SkipChecks = false [static]

Flags used to skip or perform safety checks in FastCopy.

Definition at line 123 of file vctFastCopy.h.

const bool vctFastCopy::PerformChecks = true [static]

Flags used to skip or perform safety checks in FastCopy.

Definition at line 124 of file vctFastCopy.h.


The documentation for this class was generated from the following file:
erc-cisst-devel<at>lists.johnshopkins.edu