ICELIB_LIST_PAIR* pICELIB_triggeredFifoGet(ICELIB_CHECKLIST* checkList, ICELIB_CALLBACK_LOG* callbackLog, ICELIB_TRIGGERED_FIFO* fifo) { uint32_t pairId; ICELIB_LIST_PAIR* pair; do { if ( ICELIB_fifoIsEmpty(fifo) ) { ICELIB_log(callbackLog, ICELIB_logDebug, "Triggered Check FIFO is empty!"); return NULL; } pairId = ICELIB_fifoGet(fifo); } while (pairId == ICELIB_FIFO_ELEMENT_REMOVED); pair = ICELIB_getPairById(checkList, pairId); if (pair == NULL) { ICELIB_log1(callbackLog, ICELIB_logDebug, "Could not find pair by Id: %u", pairId); } return pair; }
bool ICELIB_isTriggeredFifoPairPresent(ICELIB_TRIGGERED_FIFO *fifo, ICELIB_LIST_PAIR *pair, ICELIB_CALLBACK_LOG *callbackLog) { uint32_t *pairId; ICELIB_TRIGGERED_FIFO_ITERATOR tfIterator; ICELIB_fifoIteratorConstructor(&tfIterator, fifo); while ((pairId = pICELIB_fifoIteratorNext(&tfIterator)) != NULL) { if (*pairId == pair->pairId) { ICELIB_log(callbackLog, ICELIB_logDebug, "pair already present in FIFO"); return true; } } return false; }