本文整理汇总了C++中Sequence::get方法的典型用法代码示例。如果您正苦于以下问题:C++ Sequence::get方法的具体用法?C++ Sequence::get怎么用?C++ Sequence::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sequence
的用法示例。
在下文中一共展示了Sequence::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: waitFor
long waitFor(long sequence, const Sequence& cursor,
const SequenceGroup& dependent,
const AlertableBarrier& barrier) {
long availableSequence;
if ((availableSequence = cursor.get()) < sequence) {
std::unique_lock<std::mutex> ulock(m_mutex);
while ((availableSequence = cursor.get()) < sequence) {
barrier.checkAlert();
std::cv_status status =
m_condition.wait_for(ulock, std::chrono::microseconds(m_timeout_micros));
if (status == std::cv_status::timeout) {
break;
}
}
}
if (!dependent.isEmpty()) {
while ((availableSequence = dependent.get()) < sequence) {
barrier.checkAlert();
}
}
return availableSequence;
}
示例2: test
void test()
{
Sequence s;
assert(s.insert(0, 10));
assert(s.insert(0, 20));
assert(s.size() == 2);
ItemType x = 999;
assert(s.get(0, x) && x == 20);
assert(s.get(1, x) && x == 10);
}
示例3: size
virtual bool operator==(const Sequence<T>& seq) const {
index_t len = size();
if (len != seq.size()) return false;
for (index_t i = 0; i < len; ++i)
if ( ! (this->get(i) == seq.get(i)) )
return false;
return true;
}
示例4: getSummationSeq
Sequence* getSummationSeq(Sequence * seq)
{
Sequence * res = new Sequence(seq->getLength());
res->set(1, seq->get(1));
for(int i = 2; i <= res->getLength(); i++)
{
res->set(i, res->get(i-1) + seq->get(i));
}
return res;
}
示例5: waitFor
long waitFor(const long& sequence, const Sequence& cursor,
const SequenceGroup& dependents, const AlertableBarrier& barrier) {
long available_sequence = 0;
if (dependents.isEmpty()) {
while ((available_sequence = cursor.get()) < sequence) {
barrier.checkAlert();
}
} else {
while ((available_sequence = dependents.get()) < sequence) {
barrier.checkAlert();
}
}
return available_sequence;
}
示例6: operator
void operator()() {
sequenceBarrier_.waitFor(0L);
sequence_.set(sequence_.get() + 1L);
}