示例#1
0
void
SampleProcessor::populate_calibration( SignalObserver::Observer * parent )
{
    SignalObserver::Observers_var vec = parent->getSiblings();

    if ( ( vec.ptr() != 0 ) && ( vec->length() > 0 ) ) {
        
        for ( CORBA::ULong i = 0; i < vec->length(); ++i ) {
            
            SignalObserver::Observer_ptr observer = vec[ i ];
            unsigned long objId = observer->objId();
            CORBA::WString_var dataClass;
            SignalObserver::octet_array_var data;
            CORBA::ULong idx = 0;
            while ( observer->readCalibration( idx++, data, dataClass ) ) {
                adfs::stmt sql( fs_->db() );
                sql.prepare( "INSERT INTO Calibration VALUES(:objid,:dataClass,:data,0)" );
                sql.bind( 1 ) = objId;
                sql.bind( 2 ) = std::wstring( dataClass.in() );
                sql.bind( 3 ) = adfs::blob( data->length(), reinterpret_cast< const int8_t *>( data->get_buffer() ) );
                if ( sql.step() == adfs::sqlite_done )
                    sql.commit();
                else
                    sql.reset();
            }
        }
        for ( CORBA::ULong i = 0; i < vec->length(); ++i )
            populate_calibration( vec[ i ] );
    }
    
}
示例#2
0
void
SampleProcessor::populate_descriptions( signalobserver::Observer * parent )
{
#if 0
    SignalObserver::Observers_var vec = parent->getSiblings();

    unsigned long pobjId = parent->objId();

    if ( ( vec.ptr() != 0 ) && ( vec->length() > 0 ) ) {
        
        for ( CORBA::ULong i = 0; i < vec->length(); ++i ) {
            
            SignalObserver::Observer_ptr observer = vec[ i ];
            
            unsigned long objId = observer->objId();
            
			CORBA::WString_var clsid = observer->dataInterpreterClsid();
			SignalObserver::Description_var desc = observer->getDescription();
			CORBA::WString_var trace_id = desc->trace_id.in();
			CORBA::WString_var trace_display_name = desc->trace_display_name.in();
			CORBA::WString_var axis_x_label = desc->axis_x_label.in();
			CORBA::WString_var axis_y_label = desc->axis_y_label.in();

            adutils::AcquiredConf::insert( fs_->db()
                                           , objId
                                           , pobjId
                                           , std::wstring( clsid.in() )
                                           , uint64_t( desc->trace_method )
                                           , uint64_t( desc->spectrometer )
                                           , std::wstring( trace_id.in() )
                                           , std::wstring( trace_display_name.in() )
                                           , std::wstring( axis_x_label.in() )
                                           , std::wstring( axis_y_label.in() )
                                           , uint64_t( desc->axis_x_decimals )
                                           , uint64_t( desc->axis_y_decimals ) );
        }

        for ( CORBA::ULong i = 0; i < vec->length(); ++i )
            populate_descriptions( vec[ i ] );

    }
#endif
}
示例#3
0
void UAKGQueryBase::getField(RecordSet* rs, 
                             CORBA::ULong row, 
                             CORBA::ULong col, 
                             Field& fld)
{
    fld.setNull();
    if ( rs->isNullAt(row,col) ) return;
    switch ( rs->getFieldTypeAt(col) ) {
      case TypeBoolean:
            fld.setBoolean(rs->getBooleanAt(row,col));
            break;
      case TypeChar:
      case TypeCharacter:
            fld.setChar(rs->getCharAt(row,col));
            break;
      case TypeOctet:
            fld.setOctet(rs->getOctetAt(row,col));
            break;
      case TypeShort:
      case TypeSmallInt:
        fld.setShort(rs->getShortAt(row,col));
            break;
      case TypeUShort:
        fld.setUShort(rs->getUShortAt(row,col));
            break;
      case TypeLong:
      case TypeInteger:
            fld.setLong(rs->getLongAt(row,col));
            break;
      case TypeULong:
            fld.setULong(rs->getULongAt(row,col));
            break;
      case TypeFloat:
      case TypeReal:
            fld.setFloat(rs->getFloatAt(row,col));
            break;
      case TypeDouble:
      case TypeDoublePrecision:
            fld.setDouble(rs->getDoubleAt(row,col));
            break;
      case TypeString:
            {
             CORBA::String_var s = rs->getStringAt(row,col);
             fld.setString(s);
            }
            break;
      case TypeNumeric:
      case TypeDecimal:           
            {
             Numeric_var num = rs->getNumericAt(row,col);
             fld.setNumeric(num);
            }
            break;
      case TypeDateTime:
            fld.setDateTime(rs->getDateTimeAt(row,col));
            break;
      case TypeRaw:
            {
             OctSeq_var oct = rs->getRawAt(row,col);
             fld.setRaw(oct);
            }
            break;
      case TypeBlob:
        {
        Blob_var bl = rs->getBlobAt(row,col);
        fld.setBlob(bl);
        }
        break;
      case TypeClob:
            {
                Clob_var cl = rs->getClobAt(row,col);
                fld.setClob(cl);
            }
            break;
      case TypeWString:
        {
                CORBA::WString_var wstr = rs->getWStringAt(row,col);
        fld.setWString(wstr.in());
        }
            break;
      case TypeWclob:
            {
                Wclob_var wcl = rs->getWclobAt(row,col);
                fld.setWclob(wcl);
            }
            break;
      case TypeLongLong:
            fld.setLongLong(rs->getLongLongAt(row,col));
            break;
      case TypeULongLong:
            fld.setULongLong(rs->getULongLongAt(row,col));
            break;
      default:
          errors() << "Unknown field type to get:" << rs->getFieldTypeAt(col) <<
                     "[ " __FILE__ << ":" << __LINE__ << "]" << endl;
     }
}