SAMSON has a signals and slots mechanism on which SAMSON Extensions may rely to develop adaptive and incremental algorithms.
We use the following definitions:
Assume an app implements an adaptive algorithm that needs to be notified when some atoms changes their positions. An atom is a structural node, and the position is a property of this structural node. A position change is thus a structural event, and the app will implement a slot that receives a structural event:
and connect this slot to the structural signal of some atoms:
Whenever an atom position changes, the slot will be called immediately. When the app does not need to be notified anymore, it can disconnect atoms:
SAMSON's data graph nodes may send ten types of events:
In general, events signal changes in attributes of event senders. For example, when the position of an atom is changed, the atom emits the structural event SBMStructuralModelEvent::AtomPositionChanged.
The type of event associated to a property is determined by the class that defines the relevant property. For example, an atom is a structural node, so a change in its position is a structural event. Similarly, the list of structural models contained in a document or in a folder is a property of the document or the folder, so the events that signal changes in this list are document events: SBDDocumentEvent::StructuralModelAdded and SBDDocumentEvent::StructuralModelRemoved.
Note that a class has to be a reference target in order to be able to receive signals. As a result, slots are typically added to non-GUI classes (e.g. SBDApp instead of SBGApp), which (indirectly) derive from the SBCReferenceTarget class. Please refer to the chapter about references for more information.