# nasa/safe-dart architecture

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

- Interactive diagram: https://gitdiagram.com/nasa/safe-dart
- Repository: https://github.com/nasa/safe-dart

## Overview

##### Project Type and Purpose
- SAFE-DART is a framework that separates core functionality into a shared library (libsafedart) and an optional executable (safedart). Its goal is to facilitate modular design by allowing application components to be developed as independent shared libraries (modules) and loaded at run-time.
- The README highlights key use cases such as dynamically loading modules, building applications that depend on these modules (for example, the sample “GreetApplication” provided in the examples/greet directory) and setting up interfaces/implementations with extensibility in mind.

##### File Structure
- Top-Level Structure:
- Core files such as LICENSE.txt, Doxyfile, and README.md.
- Two main directories:
- “libsafedart”: Contains the source for the SAFE-DART library (components like builder, configuration, module loading classes, and reflection support).
- “safedart”: Contains the executable source code that starts an application using SAFE-DART modules.
- “examples”: Provides sample projects (e.g., the greet example) demonstrating how users can create modules (like Greeter and GreetApplication) to interact with safeDART’s builder and configuration.
- “tests”: Contains subdirectories with test cases verifying the functionality of various parts of SAFE-DART, thereby hinting at component boundaries.
- Notice the use of .pro (Qt project) files, suggesting a Qt-oriented build structure.

- Another for application-specific components (safedart, examples/greet),
- And a third for testing or auxiliary modules if desired.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Configuration"
        CONFIG["Configuration File (safedart.ini)"]:::config
    end

    subgraph "Core Library (libsafedart)"
        LIB["SAFE-DART Library (libsafedart)"]:::library
        BUILDER["Builder"]:::library
        CONFIG_COMP["Configuration Components"]:::library
        MODULE_LOADER["Module Loader (LibraryModuleLoader)"]:::library
        REFLECTION["Reflection Utilities"]:::library
    end

    subgraph "Executable (safedart)"
        EXE["SAFE-DART Executable (safedart)"]:::executable
    end

    subgraph "Example Modules"
        APP["GreetApplication Module"]:::example
        GREETER["Greeter Module (EnglishGreeter)"]:::example
    end

    subgraph "Testing"
        TESTS["Tests Suite"]:::testing
    end

    CONFIG -->|"feeds"| EXE
    CONFIG -->|"feeds"| CONFIG_COMP
    EXE -->|"uses"| LIB
    EXE -->|"injectsBuilder"| BUILDER
    CONFIG_COMP -->|"initializes"| BUILDER
    BUILDER -->|"usesReflection"| REFLECTION
    LIB -->|"providesBuilderTo"| APP
    LIB -->|"providesBuilderTo"| GREETER
    LIB -->|"moduleDiscovery"| MODULE_LOADER
    MODULE_LOADER -->|"loads"| APP
    MODULE_LOADER -->|"loads"| GREETER
    TESTS -->|"verifies"| LIB
    TESTS -->|"verifies"| EXE

    click LIB "https://github.com/nasa/safe-dart/tree/master/libsafedart/"
    click BUILDER "https://github.com/nasa/safe-dart/blob/master/libsafedart/builder.h"
    click BUILDER "https://github.com/nasa/safe-dart/blob/master/libsafedart/builder.cpp"
    click CONFIG_COMP "https://github.com/nasa/safe-dart/blob/master/libsafedart/configuration.h"
    click CONFIG_COMP "https://github.com/nasa/safe-dart/blob/master/libsafedart/configuration.cpp"
    click CONFIG_COMP "https://github.com/nasa/safe-dart/blob/master/libsafedart/memoryconfiguration.h"
    click CONFIG_COMP "https://github.com/nasa/safe-dart/blob/master/libsafedart/memoryconfiguration.cpp"
    click CONFIG_COMP "https://github.com/nasa/safe-dart/blob/master/libsafedart/settingsconfiguration.h"
    click CONFIG_COMP "https://github.com/nasa/safe-dart/blob/master/libsafedart/settingsconfiguration.cpp"
    click MODULE_LOADER "https://github.com/nasa/safe-dart/blob/master/libsafedart/librarymoduleloader.h"
    click MODULE_LOADER "https://github.com/nasa/safe-dart/blob/master/libsafedart/librarymoduleloader.cpp"
    click REFLECTION "https://github.com/nasa/safe-dart/blob/master/libsafedart/reflectable.h"
    click EXE "https://github.com/nasa/safe-dart/tree/master/safedart/"
    click APP "https://github.com/nasa/safe-dart/tree/master/examples/greet/greetapplication/"
    click GREETER "https://github.com/nasa/safe-dart/blob/master/examples/greet/common/greeter.h"
    click GREETER "https://github.com/nasa/safe-dart/tree/master/examples/greet/englishgreeter/"
    click CONFIG "https://github.com/nasa/safe-dart/blob/master/examples/greet/safedart.ini"
    click TESTS "https://github.com/nasa/safe-dart/tree/master/tests/"

    classDef library fill:#ffdddd,stroke:#ff0000,stroke-width:2px;
    classDef executable fill:#ddffdd,stroke:#00aa00,stroke-width:2px;
    classDef example fill:#ddddff,stroke:#0000ff,stroke-width:2px;
    classDef config fill:#ffffcc,stroke:#cccc00,stroke-width:2px;
    classDef testing fill:#e6e6e6,stroke:#999999,stroke-width:2px;
```
