# hdps/core architecture

> Architecture diagram of the GitHub repository hdps/core, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hdps/core
- Repository: https://github.com/hdps/core

## Overview

##### Project type and purpose
- Type: Desktop application framework built in C++ using Qt6 and CMake.
- Purpose: Provide a core “host” application with a plugin architecture for visual analytics of high-dimensional data.

##### File structure
- Top-level CMakeLists.txt, conanfile.py and cmake/ folder show it’s built with CMake + CPM for dependency management.
- ManiVault/src contains:
– core entry points (Main.cpp, Application.cpp)
– abstract interfaces (Abstract*Manager, Abstract*Plugin)
– private implementations (src/private)
– modular subsystems (event, managers, renderers, models, widgets, util).
- ManiVault/src/plugins contains many per-plugin directories, each with its own CMakeLists, JSON metadata, and source implementing plugin interfaces.

##### README for insights
- “Core” hosts fully self-encapsulated plugins communicating via the core.
- Plugins types: Loader, Writer, Analysis, Transformation, View, Task.
- Core subsystems manage data, events, tasks, UI, settings, scripting, error logging.

##### Main components & interactions
a. Application Layer (Frontend/UI):
– MainWindow / CentralDockWidget / various Widget classes (in src/private & src/widgets)
– Actions (src/actions) implement UI commands
– Models (src/models) back MVC views in Qt
b. Core Framework Layer:
– Managers (src private & src): PluginManager, DataManager, TaskManager, EventManager, SettingsManager, ScriptingManager, ErrorManager, WorkspaceManager, HelpManager, ThemeManager
– CoreInterface façade exposing manager services to plugins
– Event system (src/event) for pub/sub
– Abstract interfaces (Abstract*Manager, Abstract*Plugin)
c. Plugin Layer:
– Each plugin folder under src/plugins implements one or more plugin types via JSON metadata + C++ classes
– They register with PluginManager at startup
– They use CoreInterface to request data, dispatch events, spawn tasks, update UI
d. Utility Layer:
– src/util: JSON handling, logging, file I/O, network, serialization, mathematical & rendering helpers
– external dependencies: Qt6, FontAwesome (downloaded via cmake), Googletest for plugin tests
e. Resource Layer:
– cmake scripts to install dependencies and embed resources

##### Architectural patterns & design principles
- Plugin architecture (inversion of control): Core loads/discovers plugins at runtime, each plugin implements a well-defined interface.
- MVC/MVVM for UI: Models ⇄ Views via Qt Model classes + Actions as controllers.
- Event bus for loose coupling: Plugins and core subsystems communicate via the EventManager.
- Task handling strategy: tasks (modal, background, foreground) are executed via TaskManager and TaskHandler abstractions.
- Resource bundling: Qt QRC for cross-platform asset management.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% UI Layer
    subgraph "UI Layer"
        direction TB
        MW["MainWindow"]:::ui
        CDW["CentralDockWidget"]:::ui
        WID["Widgets"]:::ui
        ACT["Actions"]:::ui
        MODL["Models"]:::ui
        REND["Renderers"]:::ui
    end

    %% Framework Layer
    subgraph "Framework Layer"
        direction TB
        Main_cpp["Main.cpp"]:::framework
        App_cpp["Application.cpp"]:::framework
        CI["CoreInterface"]:::framework
        AI["Abstract Interfaces"]:::framework
        ESYS["Event System"]:::framework
        subgraph "Core Managers"
            direction TB
            PM["PluginManager"]:::framework
            DM["DataManager"]:::framework
            EM["EventManager"]:::framework
            TM["TaskManager"]:::framework
            SM["SettingsManager"]:::framework
            SiM["ScriptingManager"]:::framework
            ErM["ErrorManager"]:::framework
            WM["WorkspaceManager"]:::framework
            HM["HelpManager"]:::framework
            ThM["ThemeManager"]:::framework
        end
    end

    %% Plugin Layer
    subgraph "Plugin Layer"
        direction TB
        PLG["Plugins"]:::plugin
    end

    %% Utility Layer
    subgraph "Utility Layer"
        direction TB
        UTIL["Util"]:::util
        BUILD["Build & Dependency"]:::util
    end

    %% Resource Layer
    subgraph "Resource Layer"
        direction TB
        RES["Resources"]:::resource
    end

    %% Connections
    Main_cpp -->|"initializes"| CI
    App_cpp -->|"initializes"| CI
    CI -->|"façade to"| PM
    CI -->|"façade to"| DM
    CI -->|"façade to"| EM
    CI -->|"façade to"| TM
    CI -->|"façade to"| SM
    CI -->|"façade to"| SiM
    CI -->|"façade to"| ErM
    CI -->|"façade to"| WM
    CI -->|"façade to"| HM
    CI -->|"façade to"| ThM

    MW -->|"calls"| CI
    CDW -->|"uses"| CI
    WID -->|"interacts via"| CI
    ACT -->|"dispatches"| EM
    MODL -->|"binds to"| DM
    REND -->|"draws via OpenGL shaders"| RES

    PLG -->|"registered by"| PM
    PLG -->|"calls"| CI
    PM -->|"discovers"| PLG

    ESYS -->|"pub/sub bus"| EM
    EM -->|"routes events to"| PLG
    EM -->|"routes events to"| MW

    UTIL -->|"provides helpers to"| CI
    UTIL -->|"provides helpers to"| PLG

    BUILD -->|"manages build via CMake/Conan"| CI
    BUILD -->|"manages build via CMake/Conan"| PLG

    RES -->|"bundled into QRC"| MW
    RES -->|"bundled into QRC"| REND

    %% Click Events
    click Main_cpp "https://github.com/hdps/core/blob/master/ManiVault/src/Main.cpp"
    click App_cpp "https://github.com/hdps/core/blob/master/ManiVault/src/Application.cpp"
    click CI "https://github.com/hdps/core/blob/master/ManiVault/src/CoreInterface.h"
    click AI "https://github.com/hdps/core/blob/master/ManiVault/src/AbstractPluginManager.h"
    click ESYS "https://github.com/hdps/core/blob/master/ManiVault/src/event/Event.h"
    click PM "https://github.com/hdps/core/blob/master/ManiVault/src/private/PluginManager.h"
    click DM "https://github.com/hdps/core/blob/master/ManiVault/src/private/DataManager.h"
    click EM "https://github.com/hdps/core/blob/master/ManiVault/src/private/EventManager.h"
    click TM "https://github.com/hdps/core/blob/master/ManiVault/src/private/TaskManager.h"
    click SM "https://github.com/hdps/core/blob/master/ManiVault/src/private/SettingsManager.h"
    click SiM "https://github.com/hdps/core/blob/master/ManiVault/src/private/ScriptingManager.h"
    click ErM "https://github.com/hdps/core/blob/master/ManiVault/src/private/ErrorManager.h"
    click WM "https://github.com/hdps/core/blob/master/ManiVault/src/private/WorkspaceManager.h"
    click HM "https://github.com/hdps/core/blob/master/ManiVault/src/private/HelpManager.h"
    click ThM "https://github.com/hdps/core/blob/master/ManiVault/src/private/ThemeManager.h"
    click MW "https://github.com/hdps/core/blob/master/ManiVault/src/private/MainWindow.h"
    click CDW "https://github.com/hdps/core/blob/master/ManiVault/src/private/CentralDockWidget.h"
    click WID "https://github.com/hdps/core/tree/master/ManiVault/src/widgets/"
    click ACT "https://github.com/hdps/core/tree/master/ManiVault/src/actions/"
    click MODL "https://github.com/hdps/core/tree/master/ManiVault/src/models/"
    click REND "https://github.com/hdps/core/tree/master/ManiVault/src/renderers/"
    click UTIL "https://github.com/hdps/core/tree/master/ManiVault/src/util/"
    click BUILD "https://github.com/hdps/core/blob/master/ManiVault/CMakeLists.txt"
    click PLG "https://github.com/hdps/core/tree/master/ManiVault/src/plugins/"
    click RES "https://github.com/hdps/core/tree/master/ManiVault/res/"

    %% Styles
    classDef ui fill:#FFA500,stroke:#333,stroke-width:1px
    classDef framework fill:#87CEEB,stroke:#333,stroke-width:1px
    classDef plugin fill:#90EE90,stroke:#333,stroke-width:1px
    classDef util fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef resource fill:#FFD700,stroke:#333,stroke-width:1px
```
