/******************************************************************************
**  GETQUERYSTRING -- Get the complete query string that will be executed.
**  For Fortran we adjust the 'index' so the call can be 1-indexed.
*/
void
VF_GETQUERYSTRING (Query *query, char *type, int *index, char *qstring, 
    int *len, int tlen, int qlen)
{
    char *_type  = sstrip (type, tlen);
    int   code = typecode (_type);

    char *res  = voc_getQueryString (*query, code, (*index - 1));

    bzero (qstring, qlen);
    if ((*len = strlen(res)) > qlen)
	fprintf (stderr, "Warning: truncating query string: len=%d maxch=%d\n",
            *len, qlen);
    spad (strncpy (qstring, res, *len), qlen);

    free ((char *) res);
    free ((char *) _type);
}
示例#2
0
/***********************************************************************//**
 * @brief Print column information
 *
 * @param[in] chatter Chattiness.
 * @return String containing column information.
 *
 * @todo Format and cfitsio information is mainly for debugging. This could
 * be vanish in a more stable version of the code, or it could be compiled
 * in conditionally using a debug option.
 ***************************************************************************/
std::string GFitsImage::print(const GChatter& chatter) const
{
    // Initialise result string
    std::string result;

    // Continue only if chatter is not silent
    if (chatter != SILENT) {

        // Append header
        result.append("=== GFitsImage ===");

        // Append HDU information
        result.append("\n"+print_hdu(chatter));

        // Append image dimensions
        result.append("\n"+gammalib::parformat("Image type"));
        result.append(typecode(type()));
        result.append("\n"+gammalib::parformat("Number of dimensions"));
        result.append(gammalib::str(naxis()));
        result.append("\n"+gammalib::parformat("Number of image pixels"));
        result.append(gammalib::str(npix()));
        for (int i = 0; i < naxis(); ++i) {
            result.append("\n"+gammalib::parformat("Number of bins in "+gammalib::str(i)));
            result.append(gammalib::str(naxes(i)));
        }

        // NORMAL: Append header information
        if (chatter >= NORMAL) {
            result.append(+"\n"+m_header.print(gammalib::reduce(chatter)));
        }

    } // endif: chatter was not silent

    // Return result
    return result;
}