Logo Search packages:      
Sourcecode: quantlib version File versions  Download package

bool operator<= ( const Quantity ,
const Quantity  
) [related]

Definition at line 144 of file quantity.cpp.

References amount(), AutomatedConversion, BaseUnitOfMeasureConversion, QL_FAIL, and unitOfMeasure().

                                                            {
        if (m1.unitOfMeasure() == m2.unitOfMeasure()) {
            return m1.amount() <= m2.amount();
        } else if (Quantity::conversionType
                   == Quantity::BaseUnitOfMeasureConversion) {
            Quantity tmp1 = m1;
            convertToBase(tmp1);
            Quantity tmp2 = m2;
            convertToBase(tmp2);
            return tmp1 <= tmp2;
        } else if (Quantity::conversionType == Quantity::AutomatedConversion) {
            Quantity tmp = m2;
            convertTo(tmp, m1.unitOfMeasure());
            return m1 <= tmp;
        } else {
            QL_FAIL("unitOfMeasure mismatch and no conversion specified");
        }
    }


Generated by  Doxygen 1.6.0   Back to index