ML Reference
|
Class to handle all ML Notify prints, errors and warnings. More...
#include <mlNotify.h>
Public Member Functions | |
Functions | |
Notify () | |
Constructor. Creates a Notify object without registered callbacks. | |
Notify (const Notify ¬ifyObj) | |
Copy constructor. | |
~Notify () | |
Destructor. Destroys the Notify object after removing all registered callbacks. | |
Notify & | operator= (const Notify ¬ifyObj) |
Assignment operator. | |
void | reset () |
Resets instance to construction state. | |
void | setEnabled (bool flag) |
Enables/disables whether notifications are to be sent; default is true;. | |
bool | isEnabled () const |
Returns true if notifications are enabled. | |
void | addNotifyCB (void *userData, MLNotifyCB *callback) |
Registers a function callback callback that is called if any error, warning, Notify or cout/cerr print occurs. | |
void | removeNotifyCB (void *userData, MLNotifyCB *callback) |
Unregisters a given callback function with its user data. | |
void | removeAllNotifyCBs () |
Removes all registered callback functions. | |
size_t | getNumNotifyCBs () const |
Returns the number of registered callbacks. | |
const std::vector< void * > & | getUserDataList () const |
Returns const access to user data pointers. | |
const std::vector< MLNotifyCB * > & | getCallbackList () const |
Returns const access to callback function pointers. | |
void | notify (MLuint32 objType, void *objData1=NULL, void *objData2=NULL) |
Calls all registered functions and pass object type code in objType . | |
Protected Attributes | |
Members | |
std::vector< void * > | _notifyCBUserDataList |
User data for registered notify callbacks. | |
std::vector< MLNotifyCB * > | _notifyCBList |
List of function pointers for error printing. | |
bool | _enabled |
Flag if notify sends notifications; enabled by default. |
Class to handle all ML Notify prints, errors and warnings.
Definition at line 35 of file mlNotify.h.
ml::Notify::Notify | ( | ) |
Constructor. Creates a Notify
object without registered callbacks.
ml::Notify::Notify | ( | const Notify & | notifyObj | ) |
Copy constructor.
ml::Notify::~Notify | ( | ) |
Destructor. Destroys the Notify
object after removing all registered callbacks.
void ml::Notify::addNotifyCB | ( | void * | userData, |
MLNotifyCB * | callback | ||
) |
Registers a function callback callback
that is called if any error, warning, Notify or cout/cerr print occurs.
const std::vector<MLNotifyCB*>& ml::Notify::getCallbackList | ( | ) | const |
Returns const access to callback function pointers.
size_t ml::Notify::getNumNotifyCBs | ( | ) | const |
Returns the number of registered callbacks.
const std::vector<void*>& ml::Notify::getUserDataList | ( | ) | const |
Returns const access to user data pointers.
bool ml::Notify::isEnabled | ( | ) | const |
Returns true
if notifications are enabled.
void ml::Notify::notify | ( | MLuint32 | objType, |
void * | objData1 = NULL , |
||
void * | objData2 = NULL |
||
) |
Calls all registered functions and pass object type code in objType
.
Additional information can be passed to all calls with objData1
and objData2
.
void ml::Notify::removeAllNotifyCBs | ( | ) |
Removes all registered callback functions.
Avoid using this because all registered functions from other applications or modules are also removed.
void ml::Notify::removeNotifyCB | ( | void * | userData, |
MLNotifyCB * | callback | ||
) |
Unregisters a given callback
function with its user data.
Note that userData
and callback
must exist and fit to be removed.
void ml::Notify::reset | ( | ) |
Resets instance to construction state.
void ml::Notify::setEnabled | ( | bool | flag | ) |
Enables/disables whether notifications are to be sent; default is true;.
bool ml::Notify::_enabled [protected] |
Flag if notify sends notifications; enabled by default.
Definition at line 106 of file mlNotify.h.
std::vector<MLNotifyCB*> ml::Notify::_notifyCBList [protected] |
List of function pointers for error printing.
Definition at line 103 of file mlNotify.h.
std::vector<void*> ml::Notify::_notifyCBUserDataList [protected] |
User data for registered notify callbacks.
Definition at line 100 of file mlNotify.h.