void rspfDDFSubfieldDefn::DumpData( const char * pachData, int nMaxBytes,
                                FILE * fp )

{
    if( eType == DDFFloat )
        fprintf( fp, "      Subfield `%s' = %f\n",
                 pszName,
                 ExtractFloatData( pachData, nMaxBytes, NULL ) );
    else if( eType == DDFInt )
        fprintf( fp, "      Subfield `%s' = %d\n",
                 pszName,
                 ExtractIntData( pachData, nMaxBytes, NULL ) );
    else if( eType == DDFBinaryString )
    {
        int     nBytes, i;
        rspf_uint8   *pabyBString = (rspf_uint8 *) ExtractStringData( pachData, nMaxBytes, &nBytes );

        fprintf( fp, "      Subfield `%s' = 0x", pszName );
        for( i = 0; i < std::min(nBytes,24); i++ )
            fprintf( fp, "%02X", pabyBString[i] );

        if( nBytes > 24 )
            fprintf( fp, "%s", "..." );

        fprintf( fp, "\n" );
    }
    else
        fprintf( fp, "      Subfield `%s' = `%s'\n",
                 pszName,
                 ExtractStringData( pachData, nMaxBytes, NULL ) );
}
Example #2
0
int WriteOneLine(DBHandles *d, char *oneLine, boost::unordered_set<dataPoint> *hash, DataFeedData *df)
{
    if (o.useTicks == true)
    {
        ExtractTickData(oneLine, df);

        //first check the hashTable to see if it already has the data
        if (o.useHashTable == true && hash != NULL)
        {
            dataPoint dp;
            dp.date = GetUDate(df->timestamp, dateGC);
            dp.tickId = atoi(df->tickId);

            if (hash->find(dp) != hash->end())
                return 0;
        }
    }
    else if (o.useInterval == true || o.useDaily == true)
    {
        ExtractIntData(oneLine, df);
    }
    else
    {
        WriteLog("Missing useInterval or useTicks\n");
        throw DataException(__FILE__, __LINE__);
    }

    return WriteDataToDB(d, df);
}