----------------------------------------------------------------------------- Gets a value as a floating point number -----------------------------------------------------------------------------
| 2201 | // Gets a value as a floating point number |
| 2202 | //----------------------------------------------------------------------------- |
| 2203 | bool Manager::GetValueAsFloat |
| 2204 | ( |
| 2205 | ValueID const& _id, |
| 2206 | float* o_value |
| 2207 | ) |
| 2208 | { |
| 2209 | bool res = false; |
| 2210 | |
| 2211 | if( o_value ) |
| 2212 | { |
| 2213 | if( ValueID::ValueType_Decimal == _id.GetType() ) |
| 2214 | { |
| 2215 | if( Driver* driver = GetDriver( _id.GetHomeId() ) ) |
| 2216 | { |
| 2217 | LockGuard LG(driver->m_nodeMutex); |
| 2218 | if( ValueDecimal* value = static_cast<ValueDecimal*>( driver->GetValue( _id ) ) ) |
| 2219 | { |
| 2220 | string str = value->GetValue(); |
| 2221 | *o_value = (float)atof( str.c_str() ); |
| 2222 | value->Release(); |
| 2223 | res = true; |
| 2224 | } else { |
| 2225 | OZW_ERROR(OZWException::OZWEXCEPTION_INVALID_VALUEID, "Invalid ValueID passed to GetValueAsFloat"); |
| 2226 | } |
| 2227 | } |
| 2228 | } else { |
| 2229 | OZW_ERROR(OZWException::OZWEXCEPTION_CANNOT_CONVERT_VALUEID, "ValueID passed to GetValueAsFloat is not a Float Value"); |
| 2230 | } |
| 2231 | } |
| 2232 | |
| 2233 | return res; |
| 2234 | } |
| 2235 | |
| 2236 | //----------------------------------------------------------------------------- |
| 2237 | // <Manager::GetValueAsInt> |