Changeset 5044:d0ab725e3ada in orange
 Timestamp:
 07/31/08 21:22:34 (6 years ago)
 Branch:
 default
 Convert:
 a1311245d187a448470e2825c4501f3d81c97831
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

source/orange/values.hpp
r4161 r5044 55 55 For other types of attributes that would need more space, there's a pointer to 56 56 an object of a type derived from TSomeValue. 57 57 58 58 This approach is used instead of deriving new classes from TValue. The reason 59 59 is in efficient implementation of TExample. TExample stores a vector of TValue's, … … 97 97 98 98 TValue() 99 : varType(NONE), 99 : varType(NONE), 100 100 valueType(numeric_limits<char>::max()), 101 101 intV(numeric_limits<int>::max()), … … 111 111 112 112 explicit TValue(const int &anintV, PSomeValue v) 113 : varType(INTVAR), 114 valueType(valueRegular), 113 : varType(INTVAR), 114 valueType(valueRegular), 115 115 intV(anintV), 116 116 floatV(numeric_limits<float>::quiet_NaN()), … … 119 119 120 120 explicit TValue(const float &v) 121 : varType(FLOATVAR), 121 : varType(FLOATVAR), 122 122 valueType(valueRegular), 123 123 intV(numeric_limits<int>::max()), … … 126 126 127 127 explicit TValue(const double &v) 128 : varType(FLOATVAR), 128 : varType(FLOATVAR), 129 129 valueType(valueRegular), 130 130 intV(numeric_limits<int>::max()), … … 133 133 134 134 explicit TValue(const float &afloatV, PSomeValue v) 135 : varType(FLOATVAR), 136 valueType(valueRegular), 135 : varType(FLOATVAR), 136 valueType(valueRegular), 137 137 intV(numeric_limits<int>::max()), 138 138 floatV(afloatV), … … 141 141 142 142 explicit TValue(PSomeValue v, const unsigned char &t, const signed char &spec = valueRegular) 143 : varType(t), 144 valueType(spec), 143 : varType(t), 144 valueType(spec), 145 145 intV(numeric_limits<int>::max()), 146 146 floatV(numeric_limits<float>::quiet_NaN()), … … 154 154 floatV(numeric_limits<float>::quiet_NaN()) 155 155 { if (!spec) 156 raiseErrorWho("Value", "illegal 'valueType' for special value"); 156 raiseErrorWho("Value", "illegal 'valueType' for special value"); 157 157 } 158 158 … … 173 173 inline void setDC() 174 174 { killValues(); 175 valueType = valueDC; 175 valueType = valueDC; 176 176 } 177 177 178 178 inline void setDK() 179 179 { killValues(); 180 valueType = valueDK; 181 } 182 183 inline void TValue::setSpecial(int spec)180 valueType = valueDK; 181 } 182 183 inline void setSpecial(int spec) 184 184 { killValues(); 185 valueType = (unsigned char)spec; 186 } 187 188 inline bool TValue::isRegular() const185 valueType = (unsigned char)spec; 186 } 187 188 inline bool isRegular() const 189 189 { return valueType==valueRegular; } 190 190 191 inline bool TValue::isDC() const191 inline bool isDC() const 192 192 { return valueType==valueDC; } 193 193 194 inline bool TValue::isDK() const194 inline bool isDK() const 195 195 { return valueType==valueDK; } 196 196 197 inline bool TValue::isSpecial() const197 inline bool isSpecial() const 198 198 { return valueType>0; } 199 199 … … 206 206 return *this; 207 207 } 208 208 209 209 #define CASES(in,fl,sv) \ 210 210 { \ … … 217 217 218 218 219 inline int TValue::compare(const TValue &v) const219 inline int compare(const TValue &v) const 220 220 { 221 221 if (isSpecial()) … … 229 229 230 230 231 inline bool TValue::compatible(const TValue &v) const231 inline bool compatible(const TValue &v) const 232 232 { 233 233 if (isSpecial()  v.isSpecial()) … … 238 238 239 239 240 inline bool TValue::operator ==(const TValue &v) const241 { 240 inline bool operator ==(const TValue &v) const 241 { 242 242 if (isSpecial()) 243 243 return v.isSpecial(); … … 250 250 251 251 252 inline bool TValue::operator !=(const TValue &v) const252 inline bool operator !=(const TValue &v) const 253 253 { 254 254 if (isSpecial()) … … 264 264 265 265 inline void intValInit(TValue &val, const int &i, const int &vt = valueRegular) 266 { 266 { 267 267 val.varType = TValue::INTVAR; 268 268 val.valueType = vt; … … 273 273 274 274 inline void floatValInit(TValue &val, const float &f, const int &vt = valueRegular) 275 { 275 { 276 276 val.varType = TValue::FLOATVAR; 277 277 val.valueType = vt;
Note: See TracChangeset
for help on using the changeset viewer.