Changeset 118


Ignore:
Timestamp:
Oct 27, 2005 8:43:35 AM (17 years ago)
Author:
dkearney
Message:

added quick check feature to RpUnits.cc so if fromUnits == toUnits
no conversion is needed and we return the approriate type of value
as soon as possible.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/RpUnits.cc

    r116 r118  
    752752
    753753    fromUnitsName = std::string(endptr);
    754     if ( fromUnitsName.empty() )  {
    755         // there were no units in the input string
     754
     755    // check if the fromUnitsName is empty or
     756    // if the fromUnitsName == toUnitsName
     757    // these are conditions where no conversion is needed
     758    if ( (fromUnitsName.empty()) || (toUnitsName == fromUnitsName) )  {
     759        // there were no units in the input
     760        // string or no conversion needed
    756761        // assume fromUnitsName = toUnitsName
    757762        // return the correct value
     
    772777    RpUnits::units2list(toUnitsName,toUnitsList);
    773778    RpUnits::units2list(fromUnitsName,fromUnitsList);
    774 
    775     // std::cout << "toUnitsList = ";
    776     // RpUnits::printList(toUnitsList);
    777     // std::cout << "fromUnitsList = ";
    778     // RpUnits::printList(fromUnitsList);
    779779
    780780    toIter = toUnitsList.begin();
  • trunk/src/matlab/rpChildren.cc

    r115 r118  
    2929    /* Check for proper number of arguments. */
    3030    if (nrhs != 3)
    31         mexErrMsgTxt("Two input required.");
     31        mexErrMsgTxt("Three input required.");
    3232    else if (nlhs > 1)
    3333        mexErrMsgTxt("Too many output arguments.");
  • trunk/src/matlab/rpChildrenByType.cc

    r115 r118  
    3030    /* Check for proper number of arguments. */
    3131    if (nrhs != 4)
    32         mexErrMsgTxt("Two input required.");
     32        mexErrMsgTxt("Four input required.");
    3333    else if (nlhs > 1)
    3434        mexErrMsgTxt("Too many output arguments.");
Note: See TracChangeset for help on using the changeset viewer.