Changeset 478 for cpp/frams/util


Ignore:
Timestamp:
03/22/16 01:19:47 (8 years ago)
Author:
Maciej Komosinski
Message:

Accessing const objects, short -> paInt, less critical messages when not necessary, accessing dictionaries with "->"

Location:
cpp/frams/util
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/extvalue.cpp

    r472 r478  
    104104}
    105105
     106bool ExtObject::callDelegate(const char* delegate,ExtValue *args,ExtValue *ret)
     107{
     108Param tmp;
     109ParamInterface *pi=getParamInterface(tmp);
     110if (pi)
     111        {
     112        int f=pi->findId(delegate);
     113        if (f>=0)
     114                {
     115                pi->call(f,args,ret);
     116                return true;
     117                }
     118        }
     119logPrintf("Genotype","get", LOG_ERROR, "Could not call delegate '%s.%s'", pi?pi->getName():"NULL",delegate);
     120return false;
     121}
    106122
    107123SString ExtObject::toString() const
     
    644660        else
    645661        {
    646                 logPrintf("ExtValue", "divide", LOG_CRITICAL, "Division by zero: %d/0", idata());
     662                logPrintf("ExtValue", "divide", LOG_ERROR, "Division by zero: %d/0", idata());
    647663                setInvalid();
    648664        }
     
    653669        if (a == 0.0)
    654670        {
    655                 logPrintf("ExtValue", "divide", LOG_CRITICAL, "Division by zero: %s/0.0", getString().c_str());
     671                logPrintf("ExtValue", "divide", LOG_ERROR, "Division by zero: %s/0.0", getString().c_str());
    656672                setInvalid();
    657673        }
     
    662678                if (!finite(tmp))
    663679                {
    664                         logPrintf("ExtValue", "divide", LOG_CRITICAL, "Overflow %s/%g", getString().c_str(), a); setInvalid();
     680                        logPrintf("ExtValue", "divide", LOG_ERROR, "Overflow %s/%g", getString().c_str(), a); setInvalid();
    665681                }
    666682                else
     
    868884        case TString: return getInt(sdata().c_str());
    869885        case TObj:
    870                 logPrintf("ExtValue", "getInt", LOG_WARN, "Getting integer value from object reference (%s)", getString().c_str());
     886                logPrintf("ExtValue", "getInt", LOG_ERROR, "Getting integer value from object reference (%s)", getString().c_str());
    871887                return (paInt)(intptr_t)odata().param;
    872888        default:;
     
    883899        case TString: return getDouble(sdata().c_str());
    884900        case TObj:
    885                 logPrintf("ExtValue", "getDouble", LOG_WARN, "Getting floating point value from object reference (%s)", getString().c_str());
     901                logPrintf("ExtValue", "getDouble", LOG_ERROR, "Getting floating point value from object reference (%s)", getString().c_str());
    886902                return (double)(intptr_t)odata().param;
    887903        default:;
  • cpp/frams/util/extvalue.h

    r464 r478  
    6767        void* getTarget() const { return (subtype & 1) ? dbobject : object; }
    6868        void* getTarget(const char* classname, bool through_barrier = true, bool warn = true) const;
     69        bool callDelegate(const char* delegate,ExtValue *args,ExtValue *ret);
    6970        void setEmpty() { decref(); subtype = 0; param = NULL; object = NULL; }
    7071        int isEmpty() const { return !param; }
Note: See TracChangeset for help on using the changeset viewer.