Free Electron
ReactorI.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __signal_ReactorI_h__
8 #define __signal_ReactorI_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 /** @brief Enable specification of named 'reactions', presumably to anticipated
16  conditions
17 
18  @ingroup signal
19 
20  For example, it may be useful for a GUI selection component to fire
21  off an application specific signal when it actually starts and ends a
22  selection. These could be well-known (documented by the selection
23  component) named conditions of 'on_select' and 'off_select'.
24 
25  The application could then specify records to fire on such conditions:
26 
27  @code
28 
29  sp<ReactorI> spSelectionComponent;
30  Record r_on_select;
31  Record r_off_select;
32 
33  ...
34  // create component and records, etc
35  ...
36 
37  spSelectionComponent->add("on_select", spSignaler, r_on_select);
38  spSelectionComponent->add("off_select", spSignaler, r_off_select);
39 
40  @endcode
41 
42 
43  Within the component itself the signals are fired like this:
44 
45  @code
46  // near code of selection starting
47  react("on_select");
48 
49  ...
50 
51  // near code of selection ending
52  react("off_select");
53  @endcode
54 
55  */
56 class FE_DL_EXPORT ReactorI:
57  virtual public Component,
58  public CastableAs<ReactorI>
59 {
60  public:
61 virtual void add(const String &a_name,
62  sp<SignalerI> a_signaler, Record r_sig) = 0;
63 virtual void react(const String &a_name) = 0;
64 };
65 
66 } /* namespace ext */
67 } /* namespace fe */
68 
69 #endif /* __signal_ReactorI_h__ */
70 
kernel
Definition: namespace.dox:3
Enable specification of named &#39;reactions&#39;, presumably to anticipated conditions.
Definition: ReactorI.h:56
Automatically reference-counted string container.
Definition: String.h:128
Reference to an instance of a Layout.
Definition: RecordSB.h:35
Base for all interfacable components.
Definition: Component.h:20
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192