# etcetra7n/gryphon architecture

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

- Interactive diagram: https://gitdiagram.com/etcetra7n/gryphon
- Repository: https://github.com/etcetra7n/gryphon

## Overview

##### Main Components
- Main Application Flow – The entry point is found in src/Main/main.cpp, which orchestrates the overall processing.
- Input Parsing – The src/Parser directory (with files like parser.cpp, parser.h, endian.cpp) handles reading and interpreting the various input formats.
- Data Handling – The src/Data directory (with parseGDT.cpp, data.h, roll.cpp/roll.h) is responsible for reading and structuring graph related data.
- Layout Computation – In src/Layout, modules like layout.h and parseGGL.cpp likely compute node positioning and relationships.
- Template & DOM Manipulation – The src/Template folder (with files such as dom.cpp, gtml.h, parseGTML.cpp) handles the HTML-like templating, resembling a DOM tree for graph elements.
- Plotting & Export – The src/Plot (composeGPLT.cpp, plot.h) and src/Export (exportBmp.cpp, export.h) modules transform processed data into visual representations (bitmap exports) and possibly plotting instructions.
- Raster Processing – In src/Raster (raster.cpp), the system might convert vector graphics to a raster format, complementing the export/plot process.

##### Relationships and Interactions
- The Main Module functions as the controller—it invokes the Parser to interpret input files provided by the user.
- Once parsed, the Data module creates internal representations of the graph’s elements.
- The Layout module then takes these structured data and computes spatial arrangements.
- The Template system may be used to further “decorate” or structure graph elements in an HTML-like style, providing extensibility and reusability.
- Next, the Plot module composes the visual output, potentially using inputs from Layout and Template, while the Export module finally converts the resultant composition (e.g., into BMP format).
- The Raster module supports this by handling any necessary rasterization steps.

##### Architectural Patterns
- Modular Design – Each major function (parsing, data, layout, templating, plotting, exporting, and rasterization) is encapsulated in its own module. This promotes separation of concerns.
- Layered Processing Pipeline – The workflow follows a pipeline: input is parsed → data structured → layout defined → template applied → plotting/visual output → export. This sequential flow is central to the system’s design.
- Extensibility – The presence of a Template system suggests an intention to allow users to extend or customize the graph’s presentation, similar to how HTML and CSS work together.

##### Relevant Technologies and Frameworks
- C++ for core implementation.
- CMake (with CMakeLists.txt and cmake/CxxWarnings.cmake) for build configuration.
- GitHub Workflows for CI/CD (build.yml and codeql.yml).
- Documentation using Sphinx (evidenced by docs/conf.py and accompanying reStructuredText files).
- The project might also integrate external libraries (not directly shown but implied by the modularized design) for tasks such as graphics rendering or image exporting.

##### Specific Elements
– Main Controller (entry point)
– Parsing Module
– Data Handling Module
– Layout Computation Module
– Template/DOM Module
– Plot Composition Module
– Export Module
– Raster Processing Module
– From Main to Parser, then to Data, followed by Layout.
– From Layout to Template and/or Plot.
– Plot feeding into Export and Raster for final image production.
- Optionally, annotate with the key C++ files or directories that back each module for clarity.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CI["Build & CI/CD"]:::ci
    MC["Main Controller"]:::controller
    PAR["Parsing Module"]:::parsing
    DAT["Data Handling Module"]:::data
    LAY["Layout Computation Module"]:::layout
    TEMP["Template/DOM Module"]:::template
    PLOT["Plot Composition Module"]:::plot
    EXP["Export Module"]:::export
    RAST["Raster Processing Module"]:::raster

    CI --> MC
    MC --> PAR
    PAR --> DAT
    DAT --> LAY
    LAY --> TEMP
    LAY --> PLOT
    TEMP --> PLOT
    PLOT --> EXP
    PLOT --> RAST

    click MC "https://github.com/etcetra7n/gryphon/blob/main/src/Main/main.cpp"
    click PAR "https://github.com/etcetra7n/gryphon/tree/main/src/Parser/"
    click DAT "https://github.com/etcetra7n/gryphon/tree/main/src/Data/"
    click LAY "https://github.com/etcetra7n/gryphon/tree/main/src/Layout/"
    click TEMP "https://github.com/etcetra7n/gryphon/tree/main/src/Template/"
    click PLOT "https://github.com/etcetra7n/gryphon/tree/main/src/Plot/"
    click EXP "https://github.com/etcetra7n/gryphon/tree/main/src/Export/"
    click RAST "https://github.com/etcetra7n/gryphon/tree/main/src/Raster/"

    classDef controller fill:#FFCC00,stroke:#333,stroke-width:2px;
    classDef parsing fill:#B3E5FC,stroke:#333,stroke-width:2px;
    classDef data fill:#C8E6C9,stroke:#333,stroke-width:2px;
    classDef layout fill:#FFAB91,stroke:#333,stroke-width:2px;
    classDef template fill:#CE93D8,stroke:#333,stroke-width:2px;
    classDef plot fill:#F48FB1,stroke:#333,stroke-width:2px;
    classDef export fill:#FFF59D,stroke:#333,stroke-width:2px;
    classDef raster fill:#A5D6A7,stroke:#333,stroke-width:2px;
    classDef ci fill:#E0E0E0,stroke:#333,stroke-width:2px;
```
