void field_sync_mux_base::processStreamIdChanges() { boost::mutex::scoped_lock lock(_sriMutex); LOG_TRACE( field_sync_mux_base, "processStreamIDChanges QUEUE: " << _sriQueue.size() ); if ( _sriQueue.size() == 0 ) return; std::string sid(""); if ( validGRBlock() ) { IStreamList::iterator istream; int idx=0; std::string sid(""); int mode=0; SRIQueue::iterator item = _sriQueue.begin(); for ( ; item != _sriQueue.end(); item++ ) { idx = 0; sid = ""; mode= item->second.mode; sid = item->second.streamID; istream = _istreams.begin(); for ( ; istream != _istreams.end(); idx++, istream++ ) { if ( istream->port == item->first ) { LOG_DEBUG( field_sync_mux_base, " SETTING IN_STREAM ID/STREAM_ID :" << idx << "/" << sid ); istream->sri(true); istream->spe(mode); LOG_DEBUG( field_sync_mux_base, " SETTING OUT_STREAM ID/STREAM_ID :" << idx << "/" << sid ); setOutputStreamSRI( idx, item->second ); } } } _sriQueue.clear(); } else { LOG_WARN( field_sync_mux_base, " NEW STREAM ID, NO GNU RADIO BLOCK DEFINED, SRI QUEUE SIZE:" << _sriQueue.size() ); } }
void copy_octet_base::processStreamIdChanges() { boost::mutex::scoped_lock lock(_sriMutex); LOG_TRACE( copy_octet_base, "processStreamIDChanges QUEUE: " << _sriQueue.size() ); if ( _sriQueue.size() == 0 ) return; std::string sid(""); if ( validGRBlock() ) { int max_input = gr_sptr->get_max_input_streams(); int n_input = gr_sptr->get_num_input_streams(); LOG_TRACE( copy_octet_base, " IN_MAX=" << max_input << " N_IN:" << n_input); int max_output = gr_sptr->get_max_output_streams(); int n_output = gr_sptr->get_num_output_streams(); LOG_TRACE( copy_octet_base, " OUT_MAX=" << max_output << " N_OUT:" << n_output); bool var_istreams = false; if ( max_input == -1 && inPorts.size() == 1 ) var_istreams = true; bool var_ostreams = false; if ( max_output == -1 && outPorts.size() == 1 ) var_ostreams = true; IStreamList::iterator istream; int idx=0; std::string sid(""); int mode=0; SRIQueue::iterator item = _sriQueue.begin(); for ( ; item != _sriQueue.end(); item++ ) { idx = 0; sid = ""; mode= item->second.mode; sid = item->second.streamID; istream = _istreams.begin(); for ( ; istream != _istreams.end(); idx++, istream++ ) { if ( !var_istreams && istream->port == item->first ) { break; } else if ( var_istreams && (istream->port == item->first) && (istream->streamID == sid) ) { break; } } if ( istream == _istreams.end() ) { if ( var_istreams ) { if ( gr_sptr ) gr_sptr->add_read_index(); _istreams.push_back( gr_istream< BULKIO_dataOctet_In_i >( item->first, sid, gr_sptr, idx, mode ) ); LOG_TRACE( copy_octet_base, "GR_ISTREAM::ADD PORT:" << item->first->getName() << " STREAM_ID:" << sid << " NSTREAMS:" << _istreams.size()); if ( var_ostreams ) { RH_UsesPortMap::iterator p_out = outPorts.begin(); _ostreams.push_back( gr_ostream < BULKIO_dataOctet_Out_i >( dynamic_cast< BULKIO_dataOctet_Out_i *>(p_out->second), sid, gr_sptr, idx )); LOG_TRACE( copy_octet_base, "GR_OSTREAM::ADD PORT:" << p_out->second->getName() << " STREAM_ID:" << sid << " OSTREAMS:" << _ostreams.size()); } } else { LOG_WARN( copy_octet_base, " NEW STREAM ID, MISSING INPUT STREAM DEFINITION" ); } } else if ( !var_istreams ) { LOG_DEBUG( copy_octet_base, " SETTING GR_OSTREAM ID/STREAM_ID :" << idx << "/" << sid ); istream->sri(true); istream->spe(mode); } LOG_DEBUG( copy_octet_base, " GR_OSTREAM ID/STREAM_ID :" << idx << "/" << sid ); setOutputStreamSRI( idx, item->second ); } _sriQueue.clear(); } else { LOG_WARN( copy_octet_base, " NEW STREAM ID, NO GNU RADIO BLOCK DEFINED, SRI QUEUE SIZE:" << _sriQueue.size() ); } LOG_TRACE( copy_octet_base, "processStreamID, GR_ISTREAM MAP SIZE:" << _istreams.size() ); }