void addEvent(Event* newEvent) { Event* compareDeadline; set_imask(15); compareDeadline = DEADLINE_QUEUE_HEAD; if (compareDeadline == NULL) { DEADLINE_QUEUE_HEAD = newEvent; DEADLINE_QUEUE_TAIL = newEvent; newEvent->prevEvent = NULL; newEvent->nextEvent = NULL; } else { if (compareEvent(newEvent, DEADLINE_QUEUE_HEAD) <= 0) { newEvent->nextEvent = DEADLINE_QUEUE_HEAD; DEADLINE_QUEUE_HEAD->prevEvent = newEvent; newEvent->prevEvent = NULL; DEADLINE_QUEUE_HEAD = newEvent; } else { compareDeadline = DEADLINE_QUEUE_TAIL; while (compareEvent(newEvent, compareDeadline) < 0) { compareDeadline = compareDeadline->prevEvent; if (compareDeadline == NULL) { DBG(("compareDeadline == NULL!\r\n")); } } newEvent->prevEvent = compareDeadline; newEvent->nextEvent = compareDeadline->nextEvent; compareDeadline->nextEvent = newEvent; if (compareDeadline != DEADLINE_QUEUE_TAIL) { newEvent->nextEvent->prevEvent = newEvent; } else { DEADLINE_QUEUE_TAIL = newEvent; } } } set_imask(0); }
/* * Compare base class and then compare type specific. */ void compareFeature( const GfxFeature& first, const GfxFeature& second ) { MC2_TEST_REQUIRED( first.getType() == second.getType() ); MC2_TEST_REQUIRED( first.getSize() == second.getSize() ); MC2_TEST_REQUIRED( strcmp( first.getName(), second.getName() ) == 0 ); MC2_TEST_REQUIRED( first.getNbrPolygons() == second.getNbrPolygons() ); MC2_TEST_REQUIRED( first.getScaleLevel() == second.getScaleLevel() ); MC2_TEST_REQUIRED( first.getTextLat() == second.getTextLat() ); MC2_TEST_REQUIRED( first.getTextLon() == second.getTextLon() ); MC2_TEST_REQUIRED( first.getDisplayText() == second.getDisplayText() ); MC2_TEST_REQUIRED( first.getFontSize() == second.getFontSize() ); MC2_TEST_REQUIRED( first.getDrawTextStart() == second.getDrawTextStart() ); MC2_TEST_REQUIRED( first.getNameIsAbbreviated() == second.getNameIsAbbreviated() ); MC2_TEST_REQUIRED( first.getLangType() == second.getLangType() ); MC2_TEST_REQUIRED( first.getCountryCode() == second.getCountryCode() ); MC2_TEST_REQUIRED( first.getBasename() == second.getBasename() ); switch ( first.getType() ) { case GfxFeature::STREET_MAIN: case GfxFeature::STREET_FIRST: case GfxFeature::STREET_SECOND: case GfxFeature::STREET_THIRD: case GfxFeature::STREET_FOURTH: compareStreet( dynamic_cast< const GfxRoadFeature& >( first ), dynamic_cast< const GfxRoadFeature& >( second ) ); break; case GfxFeature::POI: comparePOI( dynamic_cast< const GfxPOIFeature& >( first ), dynamic_cast< const GfxPOIFeature& >( second ) ); break; case GfxFeature::SYMBOL: compareSymbol( dynamic_cast< const GfxSymbolFeature& >( first ), dynamic_cast< const GfxSymbolFeature& >( second ) ); break; case GfxFeature::TRAFFIC_INFO: compareTraffic( dynamic_cast< const GfxTrafficInfoFeature& >( first ), dynamic_cast< const GfxTrafficInfoFeature& >( second ) ); break; case GfxFeature::EVENT: compareEvent( dynamic_cast< const GfxEventFeature& >( first ), dynamic_cast< const GfxEventFeature& >( second ) ); break; default: break; } }