.. index:: single: architecture single: source tree single: orchestration singletons single: threading model single: GUI thread single: HardwareManager thread single: AcquisitionManager thread single: per-device threads single: QtConcurrent single: QFutureWatcher single: QMetaObject::invokeMethod single: queued connections single: MainWindow; wiring Architecture ============ This page is the spine of the developer guide. The remaining sub-pages assume the reader has absorbed three things from this one: which top-level directory under ``src/`` owns which responsibility, the names of the orchestration singletons that compose a running program, and the threading model that connects them. Subsequent sub-pages reference the directories, the singletons, and the threads by name without re-introducing them. The design is conventional Qt: a ``QApplication`` event loop on the GUI thread, a small set of long-lived ``QObject`` orchestrators each on a dedicated ``QThread``, signal/slot wiring between them, and a ``QtConcurrent`` worker pool for the few operations whose duration would otherwise stall an event loop. The build system layout — which library produces which directory — is on :doc:`/developer_guide/build_system`; this page focuses on the runtime layout. For per-method contracts, follow the ``:doc:`` cross-links to the API reference. Source tree ----------- The application source lives under ``src/``. Every sub-directory below is one level deep from there. ``src/main.cpp`` Application entry point. Sets the ``QApplication`` identity, loads font and save-path configuration, opens the :cpp:class:`ApplicationConfigDialog` and :cpp:class:`RuntimeHardwareConfigDialog` on first run, registers meta-types and catalog parsers, then constructs ``MainWindow`` and enters the event loop. ``src/acquisition/`` The experiment-execution layer. ``acquisitionmanager.{cpp,h}`` declares :cpp:class:`AcquisitionManager`, which drives an in-progress experiment (waveform pipeline, aux/validation timer, backups, finalization). The ``batch/`` sub-directory holds :cpp:class:`BatchManager` and its concrete subclasses :cpp:class:`BatchSingle` and :cpp:class:`BatchSequence`, which coordinate across-experiment state. ``src/data/`` Data model, persistence, analysis, and application-wide singletons that are not hardware-specific. - ``data/experiment/`` — experiment configuration: :cpp:class:`Experiment`, the :cpp:class:`FtmwConfig` family, :cpp:class:`RfConfig`, :cpp:class:`ChirpConfig`, the :cpp:class:`DigitizerConfig` family, :cpp:class:`ExperimentObjective`, and :cpp:class:`ExperimentValidator`. - ``data/lif/`` — LIF-specific data: :cpp:class:`LifConfig`, :cpp:class:`LifDigitizerConfig`, :cpp:class:`LifStorage`, :cpp:class:`LifTrace`. - ``data/loadout/`` — :cpp:class:`HardwareLoadout`, :cpp:class:`LoadoutManager`, :cpp:class:`FtmwPreset`, and the loadout/preset snapshot helpers. - ``data/storage/`` — persistence: :cpp:class:`BlackchirpCSV`, the :cpp:class:`HeaderStorage` tree, :cpp:class:`DataStorageBase` and its concrete subclasses (:cpp:class:`FidStorageBase` and friends, :cpp:class:`LifStorage`, :cpp:class:`OverlayStorage`, :cpp:class:`AuxDataStorage`), :cpp:class:`SettingsStorage`, :cpp:class:`WaveformBuffer`, and :cpp:class:`ApplicationConfigManager`. - ``data/analysis/`` — :cpp:class:`FtWorker` (the FT processing worker), :cpp:class:`Analysis`, :cpp:class:`PeakFinder`, :cpp:class:`WaveformParser`, :cpp:class:`Ft`. - ``data/processing/`` — overlay processing/operations. - ``data/processing/parsers/`` — overlay/import file parsers (:cpp:class:`FileParser`, :cpp:class:`FileParserRegistry`, :cpp:class:`GenericXyParser`, :cpp:class:`SpcatParser`, :cpp:class:`XiamParser`, :cpp:class:`CatalogParser`). - ``data/model/`` — Qt item models for chirp, clock, marker, peak, and overlay tables. - ``data/settings/`` — the static key declarations ``hardwarekeys.h`` and ``guikeys.h``. - ``data/presentation/`` — :cpp:class:`CurveAppearance`. - ``data/loghandler.{cpp,h}`` — :cpp:class:`LogHandler` global diagnostic logging. - ``data/bcglobals.{cpp,h}`` — application-wide constants and persistent-key declarations. ``src/gui/`` Qt Widgets layer. ``mainwindow.{cpp,h}`` is the application's central window and the wiring hub for all the orchestration singletons (see *MainWindow as the wiring hub* below). - ``gui/dialog/`` — modal dialogs (Add Profile, Application Config, Hardware Configuration, FTMW Configuration, Batch Sequence, Communication, About, etc.). - ``gui/expsetup/`` — the experiment-setup wizard pages and the dialog that hosts them. - ``gui/widget/`` — embeddable widgets (FTMW view, chirp config, hardware status boxes, digitizer config, pulse config, …). - ``gui/plot/`` — Qwt-based scientific plots: :cpp:class:`ZoomPanPlot` base, :cpp:class:`MainFtPlot`, :cpp:class:`FidPlot`, :cpp:class:`ChirpConfigPlot`, :cpp:class:`PulsePlot`, :cpp:class:`TrackingPlot`, plot-curve helpers, and the custom tracker/zoomer. - ``gui/lif/gui/`` — LIF-specific widgets and plots. - ``gui/overlay/`` — overlay configuration widgets and the unified overlay dialog. - ``gui/style/`` — :cpp:class:`ThemeColors` theme management. - ``gui/util/`` — small GUI utilities (numeric formatting). ``src/hardware/`` Hardware abstraction and drivers. - ``hardware/core/`` — :cpp:class:`HardwareObject` (the abstract device base), :cpp:class:`HardwareManager`, :cpp:class:`HardwareRegistry`, the registration helpers in ``hardwareregistration.{cpp,h}`` and the aggregator headers ``hw_base.h`` / ``hw_h.h`` / ``hw_impl.h``, :cpp:class:`RuntimeHardwareConfig`, :cpp:class:`HardwareProfileManager`, the interface-class sub-directories (``clock/``, ``ftmwdigitizer/``, ``lifdigitizer/``, ``liflaser/``), and ``communication/``. - ``hardware/optional/`` — interfaces and drivers for hardware classes that are optional in any given experiment: ``chirpsource/`` (AWG), ``flowcontroller/``, ``gpibcontroller/``, ``ioboard/``, ``pressurecontroller/``, ``pulsegenerator/``, ``tempcontroller/``. - ``hardware/python/`` — Python trampoline classes (one per hardware type), the host process script ``python_hw_host.py``, and per-type template scripts. - ``hardware/library/`` — :cpp:class:`VendorLibrary` and concrete subclasses (:cpp:class:`LabjackLibrary`, :cpp:class:`SpectrumLibrary`). ``src/modules/`` Optional compile-conditional modules. ``modules/cuda/`` holds ``GpuAverager`` — CUDA-accelerated FID accumulation gated by the ``BC_ENABLE_CUDA`` build option. ``src/resources/`` Qt resource collection: icons, the ``resources.qrc`` manifest, and the udev rules file ``52-serial.rules``. Orchestration singletons ------------------------ A running Blackchirp instance is held together by a small cast of long-lived orchestrators. Most are application-wide singletons; the acquisition trio (:cpp:class:`HardwareManager`, :cpp:class:`AcquisitionManager`, :cpp:class:`BatchManager`) is owned by ``MainWindow``. Each entry below is a one-paragraph orientation; follow the cross-link for the per-method contract. :cpp:class:`HardwareRegistry` (compile-time catalog) :doc:`/classes/hardwareregistry` is the static catalog of every hardware driver linked into the binary. Each driver registers itself before ``main()`` runs (factory function, supported communication protocols, per-driver settings, inheritance chain) using the ``REGISTER_HARDWARE_*`` macros from ``hardwareregistration.h``. The registry is the authoritative answer to "what drivers exist for hardware type *X*?" and is the only place that constructs :cpp:class:`HardwareObject` instances by key. :cpp:class:`HardwareProfileManager` (profile metadata) :doc:`/classes/hardwareprofilemanager` owns the persistent profile records. A *profile* is an immutable ``(hardwareType, label, driver)`` triple with its own persisted settings and (for Python drivers) script path and class name; the ``.