Пример #1
0
bool
IntVectorFilter::BuildYourselfFromAValueSet( ValueSet &valueSet ) {

    int			comparatorType, index;
    ValueSet	*pValueVector;
    bool		rc;
    I64			*pValue, value;

    rc = Filter::BuildYourselfFromAValueSet( valueSet );

    ClearValueVector();
    delete m_pComparator;

    valueSet.GetInt( SSAPI_INT_FLOAT_VECTOR_FILTER_FID_FIELD_ID, &m_fieldId );
    valueSet.GetInt( SSAPI_INT_FLOAT_VECTOR_FILTER_FID_COMPARATOR_TYPE, &comparatorType );
    m_pComparator = new Comparator( (Comparator::COMPARATOR_TYPE)comparatorType );

    pValueVector	= (ValueSet *)valueSet.GetValue( SSAPI_INT_FLOAT_VECTOR_FILTER_FID_VALUE_VECTOR );

    if( !pValueVector )
        return false;

    for( index = 0; index < pValueVector->GetCount(); index++ ) {
        if( !pValueVector->GetInt64( index, &value ) ) {
            int i;
            if( !pValueVector->GetInt( index, (int *)&i) )
                return false;
            else
                value = i;
        }

        pValue = new I64;
        *pValue = value;
        m_pValueVector->AddAt( (CONTAINER_ELEMENT)pValue, index );
    }

    return rc;
}
Пример #2
0
Filter::FILTER_RC
IntVectorFilter::DoesApply( ValueSet &valueSet ) {

    U32			index;
    I64			*pValue;
    ValueSet	*pVector;

    if( !m_pValueVector )
        return NO_MORE_ITEMS_WILL_APPLY;

    pVector = (ValueSet *)valueSet.GetValue( m_fieldId );
    if( !pVector->GetCount() && !m_pValueVector->Count() )
        return APPLIES;

    for( index = 0; index < m_pValueVector->Count(); index++ ) {
        if( !m_pValueVector->GetAt( (CONTAINER_ELEMENT &)pValue, index ) )
            return DOES_NOT_APPLY;

        if( m_pComparator->DoesApply( &valueSet, m_fieldId, *pValue ) )
            return APPLIES;
    }

    return DOES_NOT_APPLY;
}