Debian Codegraph @

docs-mini/README-structure.md

raw symbols SCIP
1 # Strucutral Overview
2
3 ## Foundation Components
4
5
6 There is a group os basic objects used widely throughout the codebase, which
7 are useful building blocks in all major simulation elements.
8
9 ### Properties
10
11 Properties form a hierarchy of named, typed values. The hierarchy can be extended
12 and modified at runtime by aircraft, simulation components and external protocols.
13
14 ### Listeners
15
16 Listeners are a callback interface `SGPropertyChangeListener` which can implemented
17 to receive notification when a property is modified, or its children added/removed.
18 Most commonly listeners are used to look for a user input or simulation event
19 changing some value (for example, a switch being turned from on to off), but it's
20 possible to monitor an entire sub-tree of properties.
21
22 It's important than listeners do not block or perform excessive amounts of work, since
23 the code modifying the property may not expect this. If non-trivial work needs to be
24 performed in response to a property changing, the listener should set a dirty flag
25 and a subsystem (etc) should check this in its `update()` method.
26
27 ### Tied properties
28
29 Tied properties allow a property to be defined by a C++ memory location (such as a class
30 member variable) or by callback functions implementation the get/set operations. This
31 is very convenient for the implementing code. However, by default it has the
32 problematic side-effect that listeners do not correctly, since they have no way to be
33 notified that the underlying value (or result of invoking the getter) has changed.
34
35 It is therefore critical, when using tied properties, to _manually_ invoke `fireValueChanged`
36 on dependent properties, when updating the internal state producing them. Care should be
37 taken to only fire the change, when the result of the getters would actually change; it is
38 _not_ acceptable to simply call `fireValueChanged` each iteration, since any connected
39 listener will be run at the simulation rate.
40
41 ### Conditions
42
43 _Conditions_ are predicates which can be evaluated on demand. They can contain
44 logical operations such as 'and' and 'or', and comparisons: for example checking that
45 a property is equal to a constant value, or that a property is less than another
46 property.
47
48 Conditions are widely used to drive other state from properties; for example
49 enabling or disabling user-interface in a dialog, or activating an autopilot
50 element.
51
52 ### Bindings
53
54 _Bindings_ are a command invocation with associated arguments. In the simplest case
55 this might be invoking the `property-set` command with an argument of 42. At its
56 most complex, the command might invoke a Nasal script, supplied as part of the
57 binding, and substituting a runtime value into the Nasal logic.
58
59 Bindings are typically used in response to user actions, such as a menu item, key
60 press or interacting with a cockpit control, to update some part of the simulator
61 state.
62
63 ## Structural Components
64
65 Most code within FlightGear is organized into subsystems. Subsystems are isolated from each other;
66 a well designed subsystem can be added, remove or restarting independently. Many subsystems do not
67 full conform to these goals, especially regarding runtime adding and removal, but an increasing
68 number do support it.
69
70 === Subsystems ===
71
72 === Commands ===
73
74
75 ## Finding data files
76
77 ## Subsystem Lifecycle