Commit e19d99c8 authored by Marco De Marco's avatar Marco De Marco
Browse files

Precision loss in query composition fixed

parent c3d1908a
Loading
Loading
Loading
Loading
+159 −164
Original line number Diff line number Diff line
@@ -477,70 +477,65 @@ std::string WorkerThread::extractKey(CCfits::PHDU& phdu, std::string keyName,
    INFO_STREAM << "-------------------------------------------------" << endl;
#endif

    std::stringstream result_stream;
    
    try
    {
        switch(fitsKeyType)
        {
            case TSTRING:
            {
                std::string value;
                phdu.readKey(keyName, value);
            result_stream << value;
            break;
            
                return value;
            }
            case TINT: case TSHORT: case TLOGICAL: case TSBYTE:
            {
                int value = 0;
                phdu.readKey(keyName, value);
            result_stream << value;
            break;
                return boost::lexical_cast<std::string>(value);
            }
            case TUINT: case TUSHORT: case TBIT: case TBYTE:
            {
                unsigned int value = 0;
                phdu.readKey(keyName, value);
            result_stream << value;
            break;
                return boost::lexical_cast<std::string>(value);
            }
            case TULONG:
            {
                unsigned long value = 0;
                phdu.readKey(keyName, value);
            result_stream << value;
            break;
                return boost::lexical_cast<std::string>(value);
            }
            case TLONG:
            {
                long value = 0;
                phdu.readKey(keyName, value);
            result_stream << value;
            break;
                return boost::lexical_cast<std::string>(value);
            }
            case TLONGLONG:
            {
                long long value = 0;
                phdu.readKey(keyName, value);
            result_stream << value;
            break;
                return boost::lexical_cast<std::string>(value);
            }
            case TDOUBLE: case TFLOAT:
            {
                double value = 0;
                phdu.readKey(keyName, value);
            result_stream << value;
            break;
                return boost::lexical_cast<std::string>(value);
            }
            case TCOMPLEX: case TDBLCOMPLEX:
            {
                //TODO: [WARNING] complex case
			std::runtime_error("Not yet implemented fits type");
                std::runtime_error(" Complex fits type not yet implemented");
            }
            default:
                throw std::runtime_error("Unknown fits type");
        }   //switch
    }
    catch(boost::bad_lexical_cast& ex)
    {
        throw std::runtime_error(ex.what());
    }
    
    return result_stream.str();
}

//==============================================================================
+17 −17

File changed.

Contains only whitespace changes.