Object. More...
#include <robject.h>
Protected Attributes | |
RString | Name |
Private Attributes | |
void * | Handlers |
Detailed Description
Object.
The RObject class provides a representation for a generic object that can send and receive notifications. The deriving objects should overload the GetClassName method.
It may append that a call to a method InsertObserver does not work well when objects inheriting from RObject also inherit from other objects libraries (such as Qt). The results is that the 'this' may not point to the real address. To avoid this, you must explicitly cast 'this':
Constructor & Destructor Documentation
RObject | ( | const RString & | name = RString::Null | ) |
Constructor of the object.
- Parameters
-
name Name given to the object.
|
virtual |
Destruct the object.
Member Function Documentation
int Compare | ( | const RObject & | obj | ) | const |
Compare method used by R::RContainer.
- Parameters
-
obj Object to compare with.
RString GetName | ( | void | ) | const |
Get the name of the object.
|
virtual |
This is the handler that is called when an object does not find any handler for a sended notification. By default, it prints the name of the message.
- Parameters
-
notification Notification.
|
virtual |
Get the name of the class of the object.
void PostNotification | ( | const hNotification | handle | ) |
Post a notification to the notification center.
- Parameters
-
handle Handle of the notification.
void PostNotification | ( | const RCString & | name | ) |
Post a notification to the notification center.
- Parameters
-
name Name of the notification.
void PostNotification | ( | const hNotification | handle, |
T | data | ||
) |
Post a notification to the notification center.
- Template Parameters
-
T TYpe of the data to post 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 to the notification center.
- Template Parameters
-
T TYpe of the data to post with the notification.
- Parameters
-
name Name of the notification. data Data associated to the notification.
void InsertObserver | ( | tNotificationHandler | handler, |
const hNotification | handle, | ||
RObject * | object | ||
) |
Add a handler for a particular notification for a particular object.
- Parameters
-
handler Handler of the notification. handle Handle of the notification. object Object posting the notification.
- Warning
- The same combination of (handler,handle,object) can be inserted multiple times.
void InsertObserver | ( | tNotificationHandler | handler, |
const RCString & | name, | ||
RObject * | object | ||
) |
Add a handler for a particular notification for a particular object.
- Parameters
-
handler Handler of the notification. name Name of the notification. object Object emitting the notification.
- Warning
- The same combination of (handler,name,object) can be inserted multiple times.
void InsertObserver | ( | tNotificationHandler | handler, |
const hNotification | handle | ||
) |
Add a handler for a particular notification of every object.
- Parameters
-
handler Handler of the notification. handle Handle of the notification.
- Warning
- The same combination of (handler,handle) can be inserted multiple times.
void InsertObserver | ( | tNotificationHandler | handler, |
const RCString & | name | ||
) |
Add a handler for a particular notification of every object.
- Parameters
-
handler Handler of the notification. name Name of the notification.
- Warning
- The same combination of (handler,name) can be inserted multiple times.
void InsertObserver | ( | tNotificationHandler | handler, |
RObject * | object | ||
) |
Add a handler for every notification of a particular object.
- Parameters
-
handler Handler of the notification. object Object posting the notification.
- Warning
- The same combination of (handler,object) can be inserted multiple times.
void InsertObserver | ( | tNotificationHandler | handler | ) |
Add a handler for every notification of every object.
- Parameters
-
handler Handler of the notification.
- Warning
- The same handler can be inserted multiple times.
void DeleteObserver | ( | void | ) |
Delete the object as observer.
void DeleteObserver | ( | const hNotification | handle, |
RObject * | object | ||
) |
Delete a given handler.
- Parameters
-
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.
- Parameters
-
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.
hNotification GetNotificationHandle | ( | const RCString & | name | ) | const |
Get a handle for a given notification.
- Parameters
-
name Name of the notification.
- Returns
- Handle.
RCString GetNotificationName | ( | const hNotification | handle | ) | const |
Get the name of a notification.
- Parameters
-
handle Handle of the notification.
Field Documentation
|
private |
Handlers of the object.
|
protected |
Name of the object.