ocmath_b_copy

 

Description

Copy a vector of type BYTE with given array of indices.

Syntax

void ocmath_b_copy( uint nPts, const uint * pIndices, BYTE * pDestX, const BYTE * pSrcX, int nSrcSize )

Parameters

nPts
[input] size of pIndices arrays, must be smaller then the size of pSrcX.
pIndices
[input] array of indices to copy from pSrcX to pDestX, the largest element of this array must be smaller then the size of pDestX.
pDestX
[output] destination vector, must be SetSize to nPts.
pSrcX
[input] source vector, must be SetSize to at least the largest element in pIndices.
nSrcSize
[input] size of pSrcX

Return

There is nothing to return, It is assumed that caller will prepare all the pointers and arrays such that they are all in the valid range, as this function does not check for errors.

Examples

EX1

void ocmath_b_copy_ex1()
{
    vector vd = {1,1.1, 2 ,2.1, 3,3.1,4,4.1,5,5.1};
    vector<uint> vnIndices = {0,2,4,6,8};
    vector vDestX;
    bool bRet = vDestX.SetSize(vnIndices.GetSize());
    
    if(!bRet)
        return ;
    ocmath_d_copy(vnIndices.GetSize(), vnIndices,vDestX, vd, vd.GetSize() );
    //vDestX should have data of : 1, 2, 3, 4, 5
}

Remark

Copy source vector's elements indexed by pIndice to destination array.

Data types supported:

double: ocmath_d_copy

float: ocmath_f_copy

unsigned short: ocmath_us_copy

unsigned int: ocmath_ui_copy

unsigned char: ocmath_b_copy

See Also

ocmath_f_copy, ocmath_ui_copy, ocmath_us_copy

Header to Include

origin.h

Reference