本文整理汇总了C++中EventQueue::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ EventQueue::clear方法的具体用法?C++ EventQueue::clear怎么用?C++ EventQueue::clear使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EventQueue
的用法示例。
在下文中一共展示了EventQueue::clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testSpeedDensity
void testSpeedDensity(void) {
printf("*************************************************** testSpeedDensity\r\n");
EngineTestHelper eth(FORD_INLINE_6_1995);
EXPAND_EngineTestHelper;
schedulingQueue.clear(); // todo: there must be a better place for this
eth.ec->trigger.customTotalToothCount = 8;
eth.applyTriggerShape();
eth.fireTriggerEvents(36);
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_F));
// 427 cubic inches, that's a LOT of engine
eth.ec->specs.displacement = 6.99728;
eth.ec->specs.cylindersCount = 8;
eth.ec->injector.flow = gramm_second_to_cc_minute(5.303);
float airMass = getAirMass(eth.ec, 0.92, 98, 293.16);
assertEquals(0.9371, airMass);
// 0.01414 sec or 14.14 ms
assertEquals(0.01414, sdMath(eth.ec, airMass, 12.5));
}
示例2:
static void testSignalExecutor2(void) {
print("*************************************** testSignalExecutor2\r\n");
eq.clear();
TestPwm p1;
TestPwm p2;
p1.period = 2;
p2.period = 3;
complexTestNow = 0;
callbackCounter = 0;
eq.insertTask(&p1.s, 0, (schfunc_t) complexCallback, &p1);
eq.insertTask(&p2.s, 0, (schfunc_t) complexCallback, &p2);
eq.executeAll(complexTestNow);
assertEqualsM("callbackCounter #1", 2, callbackCounter);
assertEquals(2, eq.size());
eq.executeAll(complexTestNow = 2);
assertEqualsM("callbackCounter #2", 3, callbackCounter);
assertEquals(2, eq.size());
eq.executeAll(complexTestNow = 3);
assertEqualsM("callbackCounter #3", 4, callbackCounter);
assertEquals(2, eq.size());
}
示例3: testSignalExecutor
void testSignalExecutor(void) {
testSignalExecutor3();
print("*************************************** testSignalExecutor\r\n");
eq.clear();
assertEquals(EMPTY_QUEUE, eq.getNextEventTime(0));
scheduling_s s1;
scheduling_s s2;
scheduling_s s3;
scheduling_s s4;
eq.insertTask(&s1, 10, callback, NULL);
eq.insertTask(&s4, 10, callback, NULL);
eq.insertTask(&s3, 12, callback, NULL);
eq.insertTask(&s2, 11, callback, NULL);
assertEquals(4, eq.size());
assertEquals(10, eq.getHead()->momentX);
assertEquals(10, eq.getHead()->next->momentX);
assertEquals(11, eq.getHead()->next->next->momentX);
assertEquals(12, eq.getHead()->next->next->next->momentX);
callbackCounter = 0;
eq.executeAll(10);
assertEqualsM("callbackCounter/2", 2, callbackCounter);
callbackCounter = 0;
eq.executeAll(11);
assertEqualsM("callbackCounter/1#1", 1, callbackCounter);
eq.executeAll(100);
assertEquals(0, eq.size());
eq.insertTask(&s1, 12, callback, NULL);
eq.insertTask(&s2, 11, callback, NULL);
eq.insertTask(&s3, 10, callback, NULL);
callbackCounter = 0;
eq.executeAll(10);
assertEqualsM("callbackCounter/1#2", 1, callbackCounter);
callbackCounter = 0;
eq.executeAll(11);
assertEquals(1, callbackCounter);
eq.executeAll(100);
assertEquals(0, eq.size());
callbackCounter = 0;
eq.insertTask(&s1, 10, callback, NULL);
assertEquals(10, eq.getNextEventTime(0));
eq.executeAll(1);
assertEqualsM("callbacks not expected", 0, callbackCounter);
eq.executeAll(11);
assertEquals(1, callbackCounter);
assertEquals(EMPTY_QUEUE, eq.getNextEventTime(0));
eq.insertTask(&s1, 10, callback, NULL);
eq.insertTask(&s2, 13, callback, NULL);
assertEquals(10, eq.getNextEventTime(0));
eq.executeAll(1);
assertEquals(10, eq.getNextEventTime(0));
eq.executeAll(100);
assertEquals(0, eq.size());
callbackCounter = 0;
// both events are scheduled for the same time
eq.insertTask(&s1, 10, callback, NULL);
eq.insertTask(&s2, 10, callback, NULL);
eq.executeAll(11);
assertEquals(2, callbackCounter);
testSignalExecutor2();
}