本文整理汇总了C++中sequence函数的典型用法代码示例。如果您正苦于以下问题:C++ sequence函数的具体用法?C++ sequence怎么用?C++ sequence使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sequence函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: THREAD_ASSERT
/** read /nframes/ from the attached track into /buf/ */
void
Playback_DS::read_block ( sample_t *buf, nframes_t nframes )
{
THREAD_ASSERT( Playback );
memset( buf, 0, nframes * sizeof( sample_t ) * channels() );
/* stupid chicken/egg */
if ( ! timeline )
return;
// printf( "IO: attempting to read block @ %lu\n", _frame );
if ( ! sequence() )
{
/* FIXME: what to do here? */
// _frame += _nframes;
return;
}
timeline->rdlock();
/* FIXME: how does this work if _delay is not a multiple of bufsize? */
if ( _frame >= _delay )
{
if ( ! sequence()->play( buf, _frame - _delay, nframes, channels() ) )
WARNING( "Programming error?" );
}
_frame += nframes;
timeline->unlock();
}
示例2: THREAD_ASSERT
/** read /nframes/ from the attached track into /buf/ */
void
Playback_DS::read_block ( sample_t *buf, nframes_t nframes )
{
THREAD_ASSERT( Playback );
memset( buf, 0, nframes * sizeof( sample_t ) * channels() );
// printf( "IO: attempting to read block @ %lu\n", _frame );
if ( !timeline )
return;
while ( timeline->sequence_lock.tryrdlock() )
{
if ( _terminate )
return;
usleep( 1000 * 10 );
}
if ( sequence() )
{
if ( ! sequence()->play( buf, _frame + _undelay, nframes, channels() ) )
WARNING( "Programming error?" );
_frame += nframes;
}
timeline->sequence_lock.unlock();
}
示例3: main
int main()
{
for (auto i : sequence(-5, +5))
{
std::cout << i << " ";
}
std::cout << std::endl << std::endl;
for (auto i : sequence(+5, -5, -1))
{
std::cout << i << " ";
}
std::cout << std::endl << std::endl;
std::vector<int> v{1, 2, 3, 4, 5, 6};
for (auto i : sequence(0, v.size()))
{
std::cout << "Element " << i << ": " << v[i] << std::endl;
}
std::cout << std::endl;
for (auto i : sequence(0, v.size(), 2))
{
std::cout << "Element " << i << ": " << v[i] << std::endl;
}
}
示例4: context
QNFA* context(const QString& start, const QString& stop, const QString&, int action, QNFA **handler, bool cs)
{
QNFA *nfa, *end, *beg = sequence(start.constData(), start.length(), &end, cs);
nfa = new QNFA;
nfa->type = ContextBegin;
nfa->actionid = action;
nfa->out.branch = new QNFABranch;
if ( handler )
*handler = nfa;
//else
// qDebug("no handler set [0x%x]", nfa);
end->out.next = nfa;
end = nfa;
QNFA *endmark, *begendmark = sequence(stop.constData(), stop.length(), &endmark, cs);
nfa = new QNFA;
nfa->type = ContextEnd;
nfa->actionid = action;
endmark->out.next = nfa;
//end->out->branch->append(endmark);
addNFA(end, begendmark);
return beg;
}
示例5: sequence
int Line::GetSeg(double y) {
for(unsigned i = 0; i < size() - 1; i += degree)
if(sequence(double(at(i).y),y,double(at(i+degree).y)) ||
sequence(double(at(i+degree).y),y,double(at(i).y)))
return i;
return -1;
}
示例6: DMESSAGE
void
Track::sequence ( Audio_Sequence * t )
{
if ( sequence() == t )
{
DMESSAGE( "Attempt to set sequence twice" );
return;
}
t->track( this );
if ( sequence() )
add( sequence() );
_sequence = t;
/* insert following the annotation pack */
pack->insert( *t, 1 );
/* hide the take header */
t->child(0)->hide();
t->color( FL_GRAY );
t->labeltype( FL_NO_LABEL );
adjust_size();
}
示例7: assert
void NameParser::Item::calc_padding (size_t maxval)
{
for (size_t i = 0; i < sequence().size(); i++) {
assert (sequence() [i] >= 0);
if (maxval < (size_t) sequence() [i]) maxval = sequence() [i];
}
seq_length = 1;
for (size_t num = 10; maxval >= num; num *= 10)
seq_length += 1;
}
示例8: test
void test() {
try {
throw;
} catch (xa& a) {
sequence( 0, __LINE__ );
} catch (xb& b) {
sequence( 1, __LINE__ );
} catch (...) {
sequence( 2, __LINE__ );
}
}
示例9: sequence
int sequence(int n, int length) {
length++;
if (n==1) {
return length;
}
if (n%2==0) {
return sequence(n/2, length);
} else {
return sequence(n*3+1, length);
}
}
示例10: main
int main( int argc, char* argv [ ] )
{
// In order to compile this, you need C ++ 11. If it doesn't compile, then
// you can replace it by a sequence of push_backs.
sequence seq({ rotation( cube::left ),
rotation( cube::left, 1, 3 ),
rotation( cube::up ),
rotation( cube::left, -1, 3 ),
rotation( cube::up, -1, 1 ),
rotation( cube::left, -1, 1 ),
rotation( cube::up, 1, 1 ),
rotation( cube::left, 1, 3 ),
rotation( cube::up, -1, 1 ),
rotation( cube::left, -1, 3 ) });
std::cout << seq << "\n";
std::cout << repeat( seq, 5 ) << "\n";
sequence corners = repeat( sequence( { { cube::right },
{ cube::down, -1 },
{ cube::right, -1 },
{ cube::down } } ), 2 ) *
sequence( { rotation( cube::up ) } ) *
repeat( sequence( { { cube::down, -1 },
{ cube::right },
{ cube::down },
{ cube::right, -1 } } ), 2 ) *
sequence( { rotation( cube::up, -1 ) } );
std::cout << corners << "\n";
cube c(4);
// Open an SFML window. Switch it on, if you want to use
// graphics.
// sf::Window
// wind( sf::VideoMode( 1024, 500, 32 ), "Rubik Cube" );
char q = ' ';
while( q != 'q' )
{
std::cout << c << "\n";
// plot(c);
// wind. Display( );
// Plotting is nicer of course, but you need graphics.
c. rotate( corners );
q = getchar( );
}
return 0;
}
示例11: sequenceStr
void SequenceComponent::render(QPaintDevice * target, const QPoint & targetOffset, const QRect & sourceRect)
{
if (sequence())
{
QString sequenceStr(sequence()->toString());
QRect rect(sourceRect.left(), 0, sourceRect.width(), this->height());
QPainter painter(target);
painter.translate(targetOffset);
painter.translate(-rect.topLeft());
painter.setClipRect(rect);
// Find cell sizes
double unitSize = alignmentView()->unitSizeF();
int firstUnit = alignmentIndexAt(rect.topLeft());
int lastUnit = alignmentIndexAt(rect.topRight());
if (lastUnit >= sequenceStr.size()) { lastUnit = sequenceStr.size() - 1; }
int unitLeft = rectAt(firstUnit).left();
painter.save();
if (unitSize < 1)
{
painter.setRenderHint(QPainter::SmoothPixmapTransform);
}
painter.scale(unitSize, (double) height());
painter.drawPixmap(0, 0, d->background);
painter.restore();
if (unitSize > 8)
{
// Set font to be a little smaller than usual
painter.setPen(Qt::NoPen);
QFont font = painter.font();
font.setPixelSize((int) (unitSize * 0.6));
painter.setFont(font);
painter.setPen(Qt::NoPen);
for (int res = firstUnit; res <= lastUnit && res < sequenceStr.size(); ++res)
{
QColor col = Qt::red;
painter.drawPixmap(unitLeft, 0, d->pixmapFactory().pixmap(sequenceStr[res], (int) unitSize, col));
// Skip to next position
unitLeft += unitSize;
}
}
}
}
示例12: sequence
Track::~Track ( )
{
Loggable::block_start();
/* must destroy sequences first to preserve proper log order */
takes->clear();
control->clear();
annotation->clear();
delete sequence();
takes = NULL;
control = NULL;
annotation = NULL;
log_destroy();
/* ensure that soloing accounting is performed */
solo( false );
timeline->remove_track( this );
/* give up our ports */
configure_inputs( 0 );
configure_outputs( 0 );
_sequence = NULL;
if ( _name )
free( _name );
Loggable::block_end();
}
示例13: _log
int
Cursor_Region::handle ( int m )
{
Logger _log( this );
if ( m == FL_PUSH )
{
if ( test_press( FL_BUTTON3 ) )
{
char *s = fl_text_edit( "Cursor text:", "&Save", label() );
if ( s )
label( s );
free( s );
return 0;
}
}
int r = Sequence_Region::handle( m );
if ( m == FL_RELEASE )
{
sequence()->sort();
timeline->redraw();
}
return r;
}
示例14: sequence
/*
* Decode a BER encoded DistinguishedName
*/
void X509_DN::decode_from(BER_Decoder& source)
{
MemoryVector<byte> bits;
source.start_cons(SEQUENCE)
.raw_bytes(bits)
.end_cons();
BER_Decoder sequence(bits);
while(sequence.more_items())
{
BER_Decoder rdn = sequence.start_cons(SET);
while(rdn.more_items())
{
OID oid;
ASN1_String str;
rdn.start_cons(SEQUENCE)
.decode(oid)
.decode(str)
.verify_end()
.end_cons();
add_attribute(oid, str.value());
}
}
dn_bits = bits;
}
示例15: ACE_GUARD_RETURN
bool
TransportSendBuffer::resend(const SequenceRange& range)
{
ACE_GUARD_RETURN( TransportSendStrategy::LockType,
guard,
this->strategy_->lock_,
false);
for (SequenceNumber sequence(range.first);
sequence <= range.second; ++sequence) {
// Re-send requested sample if still buffered; missing samples
// will be scored against the given DisjointSequence:
BufferMap::iterator it(this->buffers_.find(sequence));
if (it != this->buffers_.end()) {
if (OpenDDS::DCPS::Transport_debug_level >= 4) {
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t) TransportSendBuffer::resend() - ")
ACE_TEXT("resending PDU: 0x%x, (0x%x,0x%x)\n"),
sequence.getValue(),
it->second.first,
it->second.second));
}
resend(it->second);
}
}
// Have we resent all requested data?
return range.first >= low() && range.second <= high();
}