本文整理汇总了C++中typenamestd::vector::erase方法的典型用法代码示例。如果您正苦于以下问题:C++ vector::erase方法的具体用法?C++ vector::erase怎么用?C++ vector::erase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类typenamestd::vector
的用法示例。
在下文中一共展示了vector::erase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lock
//.........这里部分代码省略.........
int nout = 0;
while ( nout > -1 && !exitServiceFunction && serviceThread->threadRunning() ) {
eos = false;
nout = _forecastAndProcess( eos, istreams, ostreams );
if ( nout > -1 ) {
// 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(...){}
istream->consume( nitems );
LOG_TRACE( copy_octet_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
istream = istreams.begin();
for ( ; istream != istreams.end() ; istream++) if ( istream->eos() ) eos=true;
if ( eos ) {
LOG_TRACE( copy_octet_base, " DATA NOT READY, EOS:" << eos );
_forecastAndProcess( eos, istreams, ostreams);
}
exitServiceFunction = true;
}
}
if ( eos ) {
istream = istreams.begin();
for ( ; istream != istreams.end() ; ) {
int idx=std::distance( istreams.begin(), istream );
if ( istream->eos() || eos == true ) {
LOG_DEBUG( copy_octet_base, " CLOSING INPUT STREAM IDX:" << idx );
istream->close();
//
// if we are variable input list of input streams and fixed output...... humm
//
if ( gr_sptr->get_max_input_streams() == -1 ) {
LOG_DEBUG( copy_octet_base, " REMOVE VARIABLE INPUT STREAM IDX:" << idx );
istream=istreams.erase( istream );
gr_sptr->remove_read_index( idx );
// if output is variable then close the corresponding output stream
if ( gr_sptr->get_max_output_streams() == -1 && outPorts.size() == 1 ) {
ostream = ostreams.begin();
for ( int i=0; ostream != ostreams.end(); i++, ostream++) {
if ( i == idx ) {
LOG_DEBUG( copy_octet_base, " REMOVE VARIABLE OUTPUT STREAM IDX:" << idx );
ostream=ostreams.erase(ostream);
break;
}
}
}
}
else {
istream++;
}
}
}
// close remaining output streams
ostream = ostreams.begin();
for ( ; eos && ostream != ostreams.end(); ostream++ ) ostream->close();
}
//
// set the read pointers of the GNU Radio Block to start at the beginning of the
// supplied buffers
//
gr_sptr->reset_read_index();
LOG_TRACE( copy_octet_base, " END OF TRANSFORM SERVICE FUNCTION....." << noutput_items );
if ( nout == -1 && eos == false )
return NOOP;
else
return NORMAL;
}