ML Reference
ml::Notify Class 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 &notifyObj)
 Copy constructor.
 
 ~Notify ()
 Destructor. Destroys the Notify object after removing all registered callbacks.
 
Notifyoperator= (const Notify &notifyObj)
 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.
 

Detailed Description

Class to handle all ML Notify prints, errors and warnings.

Definition at line 42 of file mlNotify.h.

Constructor & Destructor Documentation

◆ Notify() [1/2]

ml::Notify::Notify ( )

Constructor. Creates a Notify object without registered callbacks.

◆ Notify() [2/2]

ml::Notify::Notify ( const Notify & notifyObj)

Copy constructor.

◆ ~Notify()

ml::Notify::~Notify ( )

Destructor. Destroys the Notify object after removing all registered callbacks.

Member Function Documentation

◆ addNotifyCB()

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.

◆ getCallbackList()

const std::vector< MLNotifyCB * > & ml::Notify::getCallbackList ( ) const

Returns const access to callback function pointers.

◆ getNumNotifyCBs()

size_t ml::Notify::getNumNotifyCBs ( ) const

Returns the number of registered callbacks.

◆ getUserDataList()

const std::vector< void * > & ml::Notify::getUserDataList ( ) const

Returns const access to user data pointers.

◆ isEnabled()

bool ml::Notify::isEnabled ( ) const

Returns true if notifications are enabled.

◆ notify()

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.

◆ operator=()

Notify & ml::Notify::operator= ( const Notify & notifyObj)

Assignment operator.

◆ removeAllNotifyCBs()

void ml::Notify::removeAllNotifyCBs ( )

Removes all registered callback functions.

Avoid using this because all registered functions from other applications or modules are also removed.

◆ removeNotifyCB()

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.

◆ reset()

void ml::Notify::reset ( )

Resets instance to construction state.

◆ setEnabled()

void ml::Notify::setEnabled ( bool flag)

Enables/disables whether notifications are to be sent; default is true;.

Member Data Documentation

◆ _enabled

bool ml::Notify::_enabled
protected

Flag if notify sends notifications; enabled by default.

Definition at line 113 of file mlNotify.h.

◆ _notifyCBList

std::vector<MLNotifyCB*> ml::Notify::_notifyCBList
protected

List of function pointers for error printing.

Definition at line 110 of file mlNotify.h.

◆ _notifyCBUserDataList

std::vector<void*> ml::Notify::_notifyCBUserDataList
protected

User data for registered notify callbacks.

Definition at line 107 of file mlNotify.h.


The documentation for this class was generated from the following file: