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 }
void orb_i::handle_update_data( unsigned long objId, long pos ) { ACE_UNUSED_ARG( pos ); try { std::lock_guard< std::mutex > lock( task_->mutex_ ); if ( observerMap_.find( objId ) == observerMap_.end() ) { SignalObserver::Observer_var tgt = observer_->findObserver( objId, true ); if ( CORBA::is_nil( tgt.in() ) ) return; CORBA::String_var name = tgt->dataInterpreterClsid(); if ( auto spectrometer = adcontrols::MassSpectrometerBroker::make_massspectrometer( name.in() )) { SignalObserver::Description_var desc = tgt->getDescription(); observerMap_[ objId ] = std::make_tuple( tgt, desc, adportable::utf::to_wstring( name.in() ), false, spectrometer ); npos_map_[ objId ] = pos; } else { ADTRACE() << "receive data from unavilable spectrometer: " << name.in(); return; } } } catch ( ... ) { ADDEBUG() << boost::current_exception_diagnostic_information(); } try { long& npos = npos_map_[ objId ]; if ( pos < npos ) return; auto it = observerMap_.find( objId ); SignalObserver::Observer_ptr tgt = std::get<0>( it->second ).in(); SignalObserver::Description_var& desc = std::get<1>( it->second ); auto spectrometer = std::get<4>( it->second ); CORBA::String_var name = tgt->dataInterpreterClsid(); auto interpreter = adcontrols::DataInterpreterBroker::make_datainterpreter( name.in() ); if ( !interpreter ) return; const adcontrols::DataInterpreter& dataInterpreter = *interpreter; //spectrometer->getDataInterpreter(); if ( desc->trace_method == SignalObserver::eTRACE_SPECTRA ) { // ADDEBUG() << "handle_updae_data( " << objId << ", " << pos << ") npos=" << npos; if ( !std::get<3>( it->second ) ) std::get<3>( it->second ) = readCalibrations( it->second ); try { SignalObserver::DataReadBuffer_var rb; while ( tgt->readData( npos, rb ) && npos <= pos ) { ADDEBUG() << "\treadData( " << npos << " ) " << rb->pos; ++npos; impl_->readMassSpectra( rb, *spectrometer, dataInterpreter, objId ); } emit onUpdateUIData( objId, pos ); } catch ( CORBA::Exception& ex ) { ADTRACE() << "handle_update_data got an corba exception: " << ex._info().c_str(); } catch ( ... ) { ADTRACE() << boost::current_exception_diagnostic_information(); } } else if ( desc->trace_method == SignalObserver::eTRACE_TRACE ) { try { SignalObserver::DataReadBuffer_var rb; while ( tgt->readData( npos, rb ) ) { npos = rb->pos + rb->ndata; impl_->readTrace( desc, rb, dataInterpreter, objId ); emit onUpdateUIData( objId, pos ); return; } } catch ( CORBA::Exception& ex ) { ADTRACE() << "handle_update_data got an corba exception: " << ex._info().c_str(); } } } catch ( ... ) { ADDEBUG() << boost::current_exception_diagnostic_information(); } }