void LLCallbackList::test() { S32 a = 1; S32 b = 2; LLCallbackList *list = new LLCallbackList; llinfos << "Testing LLCallbackList" << llendl; if (!list->deleteFunction(NULL)) { llinfos << "passed 1" << llendl; } else { llinfos << "error, removed function from empty list" << llendl; } // llinfos << "This should crash" << llendl; // list->addFunction(NULL); list->addFunction(&test1, &a); list->addFunction(&test1, &a); llinfos << "Expect: test1 1, test1 1" << llendl; list->callFunctions(); list->addFunction(&test1, &b); list->addFunction(&test2, &b); llinfos << "Expect: test1 1, test1 1, test1 2, test2 2" << llendl; list->callFunctions(); if (list->deleteFunction(&test1, &b)) { llinfos << "passed 3" << llendl; } else { llinfos << "error removing function" << llendl; } llinfos << "Expect: test1 1, test1 1, test2 2" << llendl; list->callFunctions(); list->deleteAllFunctions(); llinfos << "Expect nothing" << llendl; list->callFunctions(); llinfos << "nothing :-)" << llendl; delete list; llinfos << "test complete" << llendl; }
void doOnIdleRepeating(bool_func_t callable) { OnIdleCallbackRepeating* cb_functor = new OnIdleCallbackRepeating(callable); gIdleCallbacks.addFunction(&OnIdleCallbackRepeating::onIdle,cb_functor); }
void doOnIdleOneTime(nullary_func_t callable) { OnIdleCallbackOneTime* cb_functor = new OnIdleCallbackOneTime(callable); gIdleCallbacks.addFunction(&OnIdleCallbackOneTime::onIdle,cb_functor); }