コード例 #1
0
psych_bool PsychCopyOutDepthArg(int position, psych_bool required, PsychDepthType *depths)
{
    double *depthsArray;
    int i;
    
    if(!PsychAllocOutDoubleMatArg(position, required, 1, PsychGetNumDepthsFromStruct(depths), 0, &depthsArray))
        return(FALSE); //optional argument was omitted 
    for(i=0;i<PsychGetNumDepthsFromStruct(depths);i++)
        depthsArray[i]=(double)PsychGetValueFromDepthStruct(i,depths);
    return(TRUE);
}
コード例 #2
0
/*
    PsychDepthIsMember()
    
    Accepts two depth structs and returns true if the one depth held by the first struct is among the one or more 
    depths within the second struct. 
*/
boolean PsychIsMemberDepthStruct(PsychDepthType *depth, PsychDepthType *depthSet)
{
    int numDepths, i;
    
    numDepths=PsychGetNumDepthsFromStruct(depth);
    if(numDepths>1)
        PsychErrorExitMsg(PsychError_internal, "depth structure contains multiple depths");
    else if(numDepths==0)
        return(FALSE);
    for(i=0;i<PsychGetNumDepthsFromStruct(depthSet);i++){
        if(PsychGetValueFromDepthStruct(i,depthSet) == PsychGetValueFromDepthStruct(0,depth))
            return(TRUE);
    }
    return(FALSE);
}
コード例 #3
0
/*
    PsychDepthCopy()
    
    Accepts two depth structs which must both have been initialized and copies the contents of the second
    depth to the first. Copy is cumulative. 
*/
void PsychCopyDepthStruct(PsychDepthType *toDepth, PsychDepthType *fromDepth)
{
    int i;
    
    for(i=0;i<PsychGetNumDepthsFromStruct(fromDepth); i++)
        PsychAddValueToDepthStruct(PsychGetValueFromDepthStruct(i,fromDepth), toDepth);

}