#include <mlFieldSensor.h>
Public Types | |
| enum | Strength { NO_NOTIFICATION = 0, NO_CHANGE = 1, CHANGED = 2 } |
| Enumeration type describing the strength of notifications. More... | |
Public Member Functions | |
| FieldSensor (MLSensorCB *callbackFunction, void *userData) | |
Creates a field sensor with callback function callback and a parameter userData. | |
| virtual | ~FieldSensor () |
| Destructor: Disconnects field sensor from the connected field and clear. | |
| void | callback (Strength notificationStrength=CHANGED) |
| Executes the callback function set by the constructor. | |
| void | attachField (Field *field) |
| Attaches a field sensor to a the field field. | |
| void | detachField () |
| Detaches the field sensor from the most recently attached field. | |
| Field * | getField () const |
| Returns the field connected to the field sensor. | |
| Strength | getNotificationStrength () const |
| Returns the notification level, i.e., how strong the current notification is. | |
Friends | |
| class | Field |
A field sensor contains a reference to a callback function and a callback function argument.
Definition at line 35 of file mlFieldSensor.h.
Enumeration type describing the strength of notifications.
| NO_NOTIFICATION | Default when sensor is asked outside a notification. |
| NO_CHANGE | Subject (i.e., the field) is notified but not changed. |
| CHANGED | Subject (i.e., the field) is notified and/or changed. |
Definition at line 41 of file mlFieldSensor.h.
| ml::FieldSensor::FieldSensor | ( | MLSensorCB * | callbackFunction, | |
| void * | userData | |||
| ) |
Creates a field sensor with callback function callback and a parameter userData.
The method callback executes the callback function. Note: userData is usually a pointer to the instance of a class and callbackFunction is a static function of that class.
| virtual ml::FieldSensor::~FieldSensor | ( | ) | [virtual] |
Destructor: Disconnects field sensor from the connected field and clear.
| void ml::FieldSensor::attachField | ( | Field * | field | ) |
Attaches a field sensor to a the field field.
If the field value changes callback() of the sensor is called. A previously attached field will automatically be detached before attaching the new one.
| void ml::FieldSensor::callback | ( | Strength | notificationStrength = CHANGED |
) |
Executes the callback function set by the constructor.
While the callback is executed with getNotificationStrength() the value passed to this callback can be retrieved. Outside it always will be NO_NOTIFICATION.
| void ml::FieldSensor::detachField | ( | ) |
Detaches the field sensor from the most recently attached field.
The callback() method is not called any more if the field is changed. After this call getField() will return NULL.
| Field* ml::FieldSensor::getField | ( | ) | const |
Returns the field connected to the field sensor.
| Strength ml::FieldSensor::getNotificationStrength | ( | ) | const |
Returns the notification level, i.e., how strong the current notification is.
Level CHANGED or higher usually means "changed object" and level NO_CHANGE usually means only notification. Is is returned always NO_NOTIFICATION if not called from within a callback call.
friend class Field [friend] |
Definition at line 83 of file mlFieldSensor.h.
1.5.8