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=nullptr, void *objData2=nullptr) |
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 42 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 = nullptr, | ||
void * | objData2 = nullptr ) |
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;.
|
protected |
Flag if notify sends notifications; enabled by default.
Definition at line 113 of file mlNotify.h.
|
protected |
List of function pointers for error printing.
Definition at line 110 of file mlNotify.h.
|
protected |
User data for registered notify callbacks.
Definition at line 107 of file mlNotify.h.