本文整理汇总了C++中PtrLList::resetGet方法的典型用法代码示例。如果您正苦于以下问题:C++ PtrLList::resetGet方法的具体用法?C++ PtrLList::resetGet怎么用?C++ PtrLList::resetGet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PtrLList
的用法示例。
在下文中一共展示了PtrLList::resetGet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteEvent
/**
* Delete an event, given the eventId
*/
int Cron::deleteEvent (int iEventId)
{
Event *pEvent;
PtrLList<Cron::Event> *pEventList = (PtrLList<Cron::Event>*) _pEventList;
pEventList->resetGet();
while ((pEvent = pEventList->getNext()) != NULL) {
if (pEvent->_id == iEventId) {
pEventList->remove (pEvent);
return 1;
}
}
return 0;
}
示例2: run
/**
* The run method. Sits in a while loop checking to
* see if any of the events in the list are at a time
* when they should fire
*/
int Cron::run (void)
{
while (1) {
Event *pEvent; // temporary event
PtrLList<Cron::Event> *pEventList = (PtrLList<Cron::Event>*) _pEventList;
pEventList->resetGet(); // start at the beginning of the list
// Go through the list
while ((pEvent = pEventList->getNext()) != NULL) {
ATime currentTime; // get the current time
// check to see if the event should happen at this time
if (pEvent->getStartTime() == currentTime) {
// if the event should happen at this time, check to see whether
// the event should happen on this day
int dayOfMonth = currentTime.dayOfMonth();
int dayOfWeek = currentTime.dayOfWeek();
if ((pEvent->getDaysOfMonth() & ((0x00000001UL) << (dayOfMonth - 1))) > 0) {
if ((pEvent->getDaysOfWeek() & ((0x01) << (dayOfWeek - 1))) > 0) {
(*pEvent->getEventCallback()) (pEvent); // call the function
// check the count
if (pEvent->getCurrentCount() == pEvent->getCount()) {
deleteEvent (pEvent->_id);
} else {
pEvent->incrCount();
}
// update the time
ATime tmpTime = pEvent->getStartTime() + pEvent->getPeriod();
pEvent->setTime(tmpTime);
}
}
}
}
sleepForMilliseconds (60000);
}
}