- Timestamp:
- 02/02/19 20:50:07 (6 years ago)
- Location:
- cpp/frams/util
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/frams/util/extvalue.cpp
r845 r851 964 964 logPrintf("ExtValue", "getInt", LOG_ERROR, "Getting integer value from object reference (%s)", getString().c_str()); 965 965 return (paInt)(intptr_t)odata().param; 966 case TUnknown: 967 case TInvalid: 968 logPrintf("ExtValue", "getInt", LOG_ERROR, "Getting integer value from %s", getString().c_str()); 969 return 0; 966 970 default:; 967 971 } … … 979 983 logPrintf("ExtValue", "getDouble", LOG_ERROR, "Getting floating point value from object reference (%s)", getString().c_str()); 980 984 return (double)(intptr_t)odata().param; 985 case TUnknown: 986 case TInvalid: 987 logPrintf("ExtValue", "getInt", LOG_ERROR, "Getting floating point value from %s", getString().c_str()); 988 return 0.0; 981 989 default:; 982 990 } -
cpp/frams/util/extvalue.h
r793 r851 56 56 }; 57 57 58 void copyFrom(const ExtObject& src) 59 60 void* operator new(size_t s, void* mem) { return mem; }58 void copyFrom(const ExtObject& src) { subtype = src.subtype; object = src.object; param = src.param; } 59 60 void* operator new(size_t s, void* mem) { return mem; } 61 61 #ifdef _MSC_VER 62 63 #endif 64 void* operator new(size_t s) { return malloc(sizeof(ExtObject)); }62 void operator delete(void* mem, void* t) {} 63 #endif 64 void* operator new(size_t s) { return malloc(sizeof(ExtObject)); } 65 65 void operator delete(void* mem) { free(mem); } 66 66 ///@param tmp_param can be used for temporary storage, the result ParamInterface* is only valid for as long as tmp_param is valid 67 ParamInterface *getParamInterface(Param &tmp_param) const { if (subtype & 2){ tmp_param.setParamTab(param->getParamTab()); tmp_param.select(object); return &tmp_param; } return paraminterface; }67 ParamInterface *getParamInterface(Param &tmp_param) const { if (subtype & 2) { tmp_param.setParamTab(param->getParamTab()); tmp_param.select(object); return &tmp_param; } return paraminterface; } 68 68 const char* interfaceName() const { if (isEmpty()) return "Empty"; return (subtype & 2) ? param->getName() : paraminterface->getName(); } 69 69 bool matchesInterfaceName(ParamInterface* pi) const { return !strcmp(interfaceName(), pi->getName()); } … … 74 74 int isEmpty() const { return !param; } 75 75 static const ExtObject& empty() { static const ExtObject e((ParamInterface*)NULL); return e; } 76 ExtObject(const ExtObject& src) 76 ExtObject(const ExtObject& src) { DEBUG_EXTOBJECT("(const&)"); src.incref(); copyFrom(src); } 77 77 void operator=(const ExtObject& src) { src.incref(); decref(); copyFrom(src); } 78 78 bool makeUnique();//< @return false if nothing has changed … … 86 86 ExtObject(Param *p, void *o) :subtype(2), object(o), param(p) { DEBUG_EXTOBJECT("(Param,void)"); } 87 87 ExtObject(ParamInterface *p = 0) :subtype(0), object(0), paraminterface(p) { DEBUG_EXTOBJECT("(ParamInterface)"); } 88 ExtObject(Param *p, DestrBase *o) :subtype(1 + 2), dbobject(o), param(p) { DEBUG_EXTOBJECT("(Param,DestrBase)"); incref(); }89 ExtObject(ParamInterface *p, DestrBase *o) :subtype(1), dbobject(o), paraminterface(p) { DEBUG_EXTOBJECT("(ParamInterface,DestrBase)"); incref(); }90 91 ~ExtObject() { DEBUG_EXTOBJECT("~"); decref(); }88 ExtObject(Param *p, DestrBase *o) :subtype(1 + 2), dbobject(o), param(p) { DEBUG_EXTOBJECT("(Param,DestrBase)"); incref(); } 89 ExtObject(ParamInterface *p, DestrBase *o) :subtype(1), dbobject(o), paraminterface(p) { DEBUG_EXTOBJECT("(ParamInterface,DestrBase)"); incref(); } 90 91 ~ExtObject() { DEBUG_EXTOBJECT("~"); decref(); } 92 92 93 93 class Serialization … … 132 132 #endif 133 133 134 void* operator new(size_t s, void* mem) { return mem; }135 void* operator new(size_t s) { return ::operator new(s); }136 137 ExtValue() :type(TUnknown){}134 void* operator new(size_t s, void* mem) { return mem; } 135 void* operator new(size_t s) { return ::operator new(s); } 136 137 ExtValue() :type(TUnknown) {} 138 138 ~ExtValue() { setEmpty(); } 139 139 ExtValue(paInt v) { seti(v); } … … 225 225 226 226 private: // setrx - release and set, setx - assume released 227 void setr(const ExtValue& src) { setEmpty(); set(src); }227 void setr(const ExtValue& src) { setEmpty(); set(src); } 228 228 void set(const ExtValue& src); 229 229 void setri(paInt v) { setEmpty(); seti(v); }
Note: See TracChangeset
for help on using the changeset viewer.