Notification Center. More...
#include <rnotificationcenter.h>
Public Member Functions | |
RNotificationCenter (void) | |
hNotification | GetNotificationHandle (const RCString &name) |
RCString | GetNotificationName (hNotification handle) const |
void | InsertObserver (tNotificationHandler handler, RObject *observer, const hNotification handle=0, RObject *object=0) |
void | InsertObserver (tNotificationHandler handler, RObject *observer, const RCString &name=RCString::Null, RObject *object=0) |
void | PostNotification (const RNotification ¬ification) |
template<class T > | |
void | PostNotification (const hNotification handle, T data) |
template<class T > | |
void | PostNotification (const RCString &name, T data) |
void | PostNotification (const hNotification handle) |
void | PostNotification (const RCString &name) |
void | DeleteObserver (RObject *observer) |
void | DeleteObserver (RObject *observer, const hNotification handle, RObject *object) |
void | DeleteObserver (RObject *observer, const RCString &name, RObject *object) |
~RNotificationCenter (void) | |
Private Member Functions | |
void | DeleteObject (RObject *obj) |
Private Attributes | |
Intern * | Data |
Detailed Description
Notification Center.
The RNotificationCenter class provides a representation for a notification center that dispatch notifications send by objects.
Constructor & Destructor Documentation
RNotificationCenter | ( | void | ) |
Constructor of a notification center.
~RNotificationCenter | ( | void | ) |
Destruct the notification center.
Member Function Documentation
hNotification GetNotificationHandle | ( | const RCString & | name | ) |
Get a handle for a given notification.
- Parameters
-
name Name of the notification.
- Returns
- Handle.
RCString GetNotificationName | ( | hNotification | handle | ) | const |
Get the name of a notification.
- Parameters
-
handle Handle of the notification.
void InsertObserver | ( | tNotificationHandler | handler, |
RObject * | observer, | ||
const hNotification | handle = 0 , |
||
RObject * | object = 0 |
||
) |
Add an observer, eventually for a particular object and/or a particular notification.
- Parameters
-
handler Method that should handle the notification. observer Observer of the notification. handle Handle of the notification. object Object which notifications must be handle. Several possibilities exists: - handle is not null, but object is. The handler catches a particular notification for any object.
- handle is null, but object isn't. The handler catches every notification for a particular object.
- handle and object are null. The handler catches every notification of every object.
- Warning
- The same combination of (handler,observer,handle,object) can be inserted multiple times.
void InsertObserver | ( | tNotificationHandler | handler, |
RObject * | observer, | ||
const RCString & | name = RCString::Null , |
||
RObject * | object = 0 |
||
) |
Add an observer, eventually for a particular object and/or a particular notification.
- Parameters
-
handler Method that should handle the notification. observer Observer of the notification. name Name of the notification to handle. object Object which notifications must be handle. Several possibilities exists: - name is not null, but object is. The handler catches a particular notification for any object.
- name is null, but object isn't. The handler catches every notification for a particular object.
- name and object are null. The handler catches every notification of every object.
- Warning
- The same combination of (handler,observer,name,object) can be inserted multiple times.
void PostNotification | ( | const RNotification & | notification | ) |
Post a notification.
- Parameters
-
notification Notification.
void PostNotification | ( | const hNotification | handle, |
T | data | ||
) |
Post a notification.
- Template Parameters
-
T Class of the data to the send with the notification.
- Parameters
-
handle Handle of the notification. data Data associated to the notification.
void PostNotification | ( | const RCString & | name, |
T | data | ||
) |
Post a notification.
- Template Parameters
-
T Class of the data to the send with the notification.
- Parameters
-
name Name of the notification. data Data associated to the notification.
void PostNotification | ( | const hNotification | handle | ) |
Post a notification without any data.
- Parameters
-
handle Handle of the notification.
void PostNotification | ( | const RCString & | name | ) |
Post a notification without any data.
- Parameters
-
name Name of the notification.
void DeleteObserver | ( | RObject * | observer | ) |
Delete a given observer.
- Parameters
-
observer Observer to delete.
void DeleteObserver | ( | RObject * | observer, |
const hNotification | handle, | ||
RObject * | object | ||
) |
Delete a given handler of a given observer.
- Parameters
-
observer Observer of the handle. handle Handle of the notification. object Object which notifications must be handle. Several possibilities exists: - handle is not null, but object is. All handlers defined for the particular notification are deleted.
- handle is null, but object isn't. All handlers defined for the object are deleted.
- handle and object are null. All default handlers are deleted.
Delete a given handler of a given observer.
- Parameters
-
observer Observer of the handle. name Name of the notification to handle. object Object which notifications must be handle. Several possibilities exists: - name is not null, but object is. All handlers defined for the particular notification are deleted.
- name is null, but object isn't. All handlers defined for the object are deleted.
- name and object are null. All default handlers are deleted.
|
private |
An object is deleted. It must be removed from the observer and no other objects can observed it anymore.
- Parameters
-
obj
Field Documentation
|
private |