|
BurgerLib
|
Simple manager of a list of function pointers. More...
#include <rqrunqueue.h>

Classes | |
| struct | FunctionEntry_t |
Public Types | |
| typedef void(BURGER_API * | Callback )(void *) |
| Function pointer type for callbacks. | |
Public Member Functions | |
| FunctionList () | |
| FunctionList constructor. | |
| ~FunctionList () | |
| FunctionList destructor. | |
| void | Call (void) |
| Invoke every function stored within the list. | |
| Word | Add (Callback pProc, void *pData=NULL) |
| Add a function to the head of the list. | |
| Word | Find (Callback pProc) |
| Return TRUE if a function is in the list. | |
| Word | Find (Callback pProc, void *pData) |
| Return TRUE if a function is in the list. | |
| Word | RemoveAll (Callback pProc) |
| Remove all entries to a function from the list. | |
| Word | Remove (Callback pProc, void *pData=NULL) |
| Remove a function from the list. | |
| void | Clear (void) |
| Release all function entries. | |
Private Member Functions | |
| FunctionList (const FunctionList &) | |
| Don't use. | |
| FunctionList | operator= (const FunctionList &) |
| Don't use. | |
Private Attributes | |
| FunctionEntry_t * | m_pFirst |
| Pointer to the first entry. | |
| Word | m_Recurse |
| TRUE if this class is the process of executing. | |
Simple manager of a list of function pointers.
FunctionList will hold a list of simple function pointers and call them when the Call() member is invoked. It's useful for creating a list of functions to be called in the background on a demand basis, such as polling tasks and game logic objects.
Each function is of a type of void (BURGER_API *)(void *pData);
Function pointer type for callbacks.
When the Call() function is invoked, all functions will be called using this type of "void (BURGER_API *)(void *pData);" with a single parameter that will have either a user supplied void * or a zero if none was supplied.
| Burger::FunctionList::FunctionList | ( | ) | [inline] |
FunctionList constructor.
Initialize the class to contain no list. This is inlined due to its only zeroing out members.
FunctionList destructor.
This will call Clear() and dispose of all the memory allocated. No functions will be called.
| Burger::FunctionList::FunctionList | ( | const FunctionList & | ) | [private] |
Don't use.
| Word Burger::FunctionList::Add | ( | Callback | pProc, |
| void * | pData = NULL |
||
| ) |
Add a function to the head of the list.
Given a function pointer and a pointer to data to pass to the function pointer, add this entry to the list of functions that are to be called with each call to Call(). The pointer pData is not used by this class and it's solely used as a parameter when the function pointer is called.
| pProc | Pointer to a function of type Burger::FunctionList::Callback. |
| pData | Pointer to be passed to the function when called. |
Invoke every function stored within the list.
Traverse the array of functions to call and invoke each and every one of them. The functions may add new entries to the list or remove themselves if they need to. If Add() is called, execution of the new entry will be deferred until the next time Call() is invoked.
The function called is of type Burger::FunctionList::Callback.
Release all function entries.
Release all of the allocated memory and discard all function and data pointers.
| Word Burger::FunctionList::Find | ( | Callback | pProc | ) |
Return TRUE if a function is in the list.
Given a function pointer, search the list to see if there is a match. If a match is found, return TRUE.
| pProc | Pointer to the function. |
| Word Burger::FunctionList::Find | ( | Callback | pProc, |
| void * | pData | ||
| ) |
Return TRUE if a function is in the list.
Given a function pointer and a pointer to data to pass to the function pointer, search the list to see if there is a match. If a match is found, return TRUE.
| pProc | Pointer to the function. |
| pData | Void pointer to pass to the function if called. |
| FunctionList Burger::FunctionList::operator= | ( | const FunctionList & | ) | [private] |
Don't use.
| Word Burger::FunctionList::Remove | ( | Callback | pProc, |
| void * | pData = NULL |
||
| ) |
Remove a function from the list.
Given a function pointer and a pointer to data to pass to the function pointer, search the list to see if there is a match. If a match is found, remove the entry and return TRUE, saying I found it.
| pProc | Pointer to the function. |
| pData | Void pointer to pass to the function if called. |
| Word Burger::FunctionList::RemoveAll | ( | Callback | pProc | ) |
Remove all entries to a function from the list.
Given a function pointer and a pointer to data to pass to the function pointer, search the list to see if there is a match. If a match is found, remove the entry and return TRUE, saying I found it.
| pProc | Pointer to the function. |
FunctionEntry_t* Burger::FunctionList::m_pFirst [private] |
Pointer to the first entry.
Word Burger::FunctionList::m_Recurse [private] |
TRUE if this class is the process of executing.
1.8.0