本文整理汇总了C++中setOutputStreamSRI函数的典型用法代码示例。如果您正苦于以下问题:C++ setOutputStreamSRI函数的具体用法?C++ setOutputStreamSRI怎么用?C++ setOutputStreamSRI使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setOutputStreamSRI函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
void fft_vfc_base::processStreamIdChanges()
{
boost::mutex::scoped_lock lock(_sriMutex);
LOG_TRACE( fft_vfc_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( fft_vfc_base, " SETTING IN_STREAM ID/STREAM_ID :" << idx << "/" << sid );
istream->sri(true);
istream->spe(mode);
LOG_DEBUG( fft_vfc_base, " SETTING OUT_STREAM ID/STREAM_ID :" << idx << "/" << sid );
setOutputStreamSRI( idx, item->second );
}
}
}
_sriQueue.clear();
} else {
LOG_WARN( fft_vfc_base, " NEW STREAM ID, NO GNU RADIO BLOCK DEFINED, SRI QUEUE SIZE:" << _sriQueue.size() );
}
}
示例2: lock
void sig_source_f_i::changedSamplingFreq(const std::string &id)
{
boost::mutex::scoped_lock lock(serviceThreadLock);
BULKIO::StreamSRI sri = BULKIO::StreamSRI();
sri.hversion = 1;
sri.xstart = 0.0;
if (this->gr_sptr->sampling_freq() > 0.0)
sri.xdelta = 1/this->gr_sptr->sampling_freq();
else
sri.xdelta = 1.0;
sri.xunits = BULKIO::UNITS_TIME;
sri.subsize = 0;
sri.ystart = 0.0;
sri.ydelta = 0.0;
sri.yunits = BULKIO::UNITS_NONE;
sri.mode = 0;
sri.streamID = CORBA::string_dup(this->naming_service_name.c_str());
setOutputStreamSRI(sri);
this->gr_sptr->set_sampling_freq(this->sampling_freq);
}
示例3: lock
template < typename IN_PORT_TYPE, typename OUT_PORT_TYPE > int randomizer_base::_transformerServiceFunction( typename std::vector< gr_istream< IN_PORT_TYPE > > &istreams ,
typename std::vector< gr_ostream< OUT_PORT_TYPE > > &ostreams )
{
typedef typename std::vector< gr_istream< IN_PORT_TYPE > > _IStreamList;
typedef typename std::vector< gr_ostream< OUT_PORT_TYPE > > _OStreamList;
boost::mutex::scoped_lock lock(serviceThreadLock);
if ( validGRBlock() == false ) {
// create our processing block, and setup property notifiers
createBlock();
LOG_DEBUG( randomizer_base, " FINISHED BUILDING GNU RADIO BLOCK");
}
//process any Stream ID changes this could affect number of io streams
processStreamIdChanges();
if ( !validGRBlock() || istreams.size() == 0 || ostreams.size() == 0 ) {
LOG_WARN( randomizer_base, "NO STREAMS ATTACHED TO BLOCK..." );
return NOOP;
}
_input_ready.resize( istreams.size() );
_ninput_items_required.resize( istreams.size() );
_ninput_items.resize( istreams.size() );
_input_items.resize( istreams.size() );
_output_items.resize( ostreams.size() );
//
// RESOLVE: need to look at forecast strategy,
// 1) see how many read items are necessary for N number of outputs
// 2) read input data and see how much output we can produce
//
//
// Grab available data from input streams
//
typename _OStreamList::iterator ostream;
typename _IStreamList::iterator istream = istreams.begin();
int nitems=0;
for ( int idx=0 ; istream != istreams.end() && serviceThread->threadRunning() ; idx++, istream++ ) {
// note this a blocking read that can cause deadlocks
nitems = istream->read();
if ( istream->overrun() ) {
LOG_WARN( randomizer_base, " NOT KEEPING UP WITH STREAM ID:" << istream->streamID );
}
if ( istream->sriChanged() ) {
// RESOLVE - need to look at how SRI changes can affect Gnu Radio BLOCK state
LOG_DEBUG( randomizer_base, "SRI CHANGED, STREAMD IDX/ID: "
<< idx << "/" << istream->pkt->streamID );
setOutputStreamSRI( idx, istream->pkt->SRI );
}
}
LOG_TRACE( randomizer_base, "READ NITEMS: " << nitems );
if ( nitems <= 0 && !_istreams[0].eos() ) {
return NOOP;
}
bool eos = false;
int nout = 0;
bool workDone = false;
while ( nout > -1 && serviceThread->threadRunning() ) {
eos = false;
nout = _forecastAndProcess( eos, istreams, ostreams );
if ( nout > -1 ) {
workDone = true;
// we chunked on data so move read pointer..
istream = istreams.begin();
for ( ; istream != istreams.end(); istream++ ) {
int idx=std::distance( istreams.begin(), istream );
// if we processed data for this stream
if ( _input_ready[idx] ) {
size_t nitems = 0;
try {
nitems = gr_sptr->nitems_read( idx );
} catch(...){}
if ( nitems > istream->nitems() ) {
LOG_WARN( randomizer_base, "WORK CONSUMED MORE DATA THAN AVAILABLE, READ/AVAILABLE "
<< nitems << "/" << istream->nitems() );
nitems = istream->nitems();
}
istream->consume( nitems );
LOG_TRACE( randomizer_base, " CONSUME READ DATA ITEMS/REMAIN " << nitems << "/" << istream->nitems());
}
}
gr_sptr->reset_read_index();
}
// check for not enough data return
if ( nout == -1 ) {
// check for end of stream
//.........这里部分代码省略.........
示例4: lock
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() );
}