MeVisLab Toolbox Reference
mlFieldSensor.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_FIELD_SENSOR_H
14 #define ML_FIELD_SENSOR_H
15 
21 
22 //ML-includes
23 #include "mlInitSystemML.h"
24 
25 ML_START_NAMESPACE
26 
28 class Field;
30 
31 //------------------------------------------------------------------------------------
37 //------------------------------------------------------------------------------------
39 {
40 
41 public:
42 
44  enum Strength { NO_NOTIFICATION = 0,
45  NO_CHANGE = 1,
46  CHANGED = 2
47  };
48 
54  FieldSensor(MLSensorCB* callbackFunction, void* userData);
55 
57  virtual ~FieldSensor();
58 
63  void callback(Strength notificationStrength=CHANGED);
64 
68  void attachField(Field* field);
69 
73  void detachField();
74 
76  Field* getField() const;
77 
84 
85 private:
86  friend class Field;
87 
89  void attachFieldInternal(Field* field);
90 
92  Field* _attachedField;
93 
95  MLSensorCB* _callbackFunc;
96 
98  void* _userData;
99 
101  Strength _notificationStrength;
102 };
103 
104 
105 ML_END_NAMESPACE
106 
107 #endif // __mlFieldSensor_H
108 
109 
110 
111 
112 
113 
Class to define and to manage field sensors.
Definition: mlFieldSensor.h:39
virtual ~FieldSensor()
Destructor: Disconnects field sensor from the connected field and clear.
FieldSensor(MLSensorCB *callbackFunction, void *userData)
Creates a field sensor with callback function callback and a parameter userData.
void attachField(Field *field)
Attaches a field sensor to a the field field.
void callback(Strength notificationStrength=CHANGED)
Executes the callback function set by the constructor.
Strength getNotificationStrength() const
Returns the notification level, i.e., how strong the current notification is.
void detachField()
Detaches the field sensor from the most recently attached field.
Field * getField() const
Returns the field connected to the field sensor.
Strength
Enumeration type describing the strength of notifications.
Definition: mlFieldSensor.h:44
Base class for all fields used in the ML.
Definition: mlField.h:73
#define MLEXPORT
To export symbols from a dll/shared object, we need to mark them with the MLEXPORT symbol.
void MLSensorCB(void *usrData, void *sensor)
Definition: mlTypeDefs.h:1315