MeVisLab Toolbox Reference
|
Class to define and to manage field sensors. More...
#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 |
Class to define and to manage field sensors.
A field sensor contains a reference to a callback function and a callback function argument.
Definition at line 38 of file mlFieldSensor.h.
Enumeration type describing the strength of notifications.
Definition at line 44 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 |
Destructor: Disconnects field sensor from the connected field and clear.
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.
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.
Definition at line 86 of file mlFieldSensor.h.