# hanlinaumonde/projet-comput-science architecture

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

- Interactive diagram: https://gitdiagram.com/hanlinaumonde/projet-comput-science
- Repository: https://github.com/hanlinaumonde/projet-comput-science

## Overview

##### Project Type and Purpose
- The project is a calculator application that supports various numerical literal types (e.g., integers, complexes, reals, rationals, expressions, and even programs) and uses a stack mechanism. Additionally, there are GUI components (suggested by files prefixed with “q” such as qcalculateur, qclavier, and qvue_secondaire) likely built using a Qt interface.
- The README provides build instructions with CMake, indicating that it’s a C++ project with a focus on modular design.

##### Analyzing the File Structure
- Top-level directories include:
- – Contains header files for all major classes (e.g., controleur, various litterale types, operator classes, and the stack “pile”).
- src – Contains the implementation (.cpp) files corresponding to the headers.
- Notable naming patterns:
- “litterale_*” indicates different classes representing numerical or programmatic literal types.
- “operateur_*” indicates the hierarchy of operator classes (directory distinguishes between accessible, binary, evaluative, numerical, and unary variants).
- “q…” classes (qcalculateur, qclavier, qvue_secondaire) imply that there is an interactive or GUI-based component.
- Other key files include CMakeLists.txt (build configuration) and Erreurs.txt (maybe for logging error or exception messages).

##### Main Components of the System (for Diagramming)
a. Core Calculation Engine:
- Controller (controleur): Acts as the central coordinator managing input, operation execution, and stack interactions.
- Literals Module:
- Different “litterale_” classes: Represent various numeric types; structure the domain-level objects.
- Operators Module:
- Different “operateur_” classes: Define arithmetic or evaluative operations and their relationships with literals.
- Pile/Stack:
- Manages operational stacks (pile) used by the calculator for storing operands and results.
- Exception Handling:
- Header files like exceptions.h for managing errors.

b. User Interface (UI) Layer:
- Qt-based GUI Components:
- qcalculateur: Likely the main calculator interface.
- qclavier: Represents the on-screen keypad.
- qvue_secondaire: Might serve as a secondary view (could be for displaying detailed results or logs).

c. Resource Management:

d. Integration & Data Flow:
- The main.cpp file is the entry point that initializes both the calculation engine and the UI.
- Interaction flows from UI components (user input) to the controller, which then applies operator logic to literals, manages the stack, and updates the UI accordingly.

##### Relationships and Interactions
- The user interacts with the UI, and these interactions are transmitted via the controller.
- The controller uses operator classes to process input and perform calculations on the various literal types.
- The stack (pile) maintains intermediate or past results, while exception handling monitors erroneous operations.
- Data and configuration from the “res” folder are loaded at startup to support the UI and domain definitions.

##### Architectural Patterns and Design Principles
- Separation of Concerns:
- The project is clearly modular with distinct layers: UI (presentation) vs. calculation logic (business logic).
- MVC-like Approach (or at least some controller-based design):
- The “controleur” acts as the mediator between the model (literals, operators, and the stack) and the view (Qt-based UI components).
- Object-oriented design:
- Inheritance is used to extend functionalities of operators and literal types.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Application Entry
    subgraph "Application Entry"
        A1("Main Entry (src/main.cpp)"):::build
        A2("Build Config (CMakeLists.txt)"):::build
    end

    %% Core Calculation Engine
    subgraph "Core Calculation Engine"
        C("Controller"):::core
        L("Literals Module"):::core
        O("Operators Module"):::core
        P("Stack (Pile)"):::core
        E("Exception Handling"):::core
        M("Memento (Stack)"):::core
    end

    %% User Interface (Qt Components)
    subgraph "User Interface (Qt Components)"
        QC("Calculator UI"):::ui
        QK("Keypad UI"):::ui
        QV("Secondary View"):::ui
    end

    %% Resource Management
    subgraph "Resource Management"
        R("Resources"):::resource
    end

    %% Connections
    A1 -->|"initializes"| C
    A1 -->|"initializes"| QC
    A2 -->|"builds"| A1

    QC -->|"triggers"| C
    QK -->|"triggers"| C
    QV -->|"updates"| C

    C -->|"processes"| L
    C -->|"processes"| O
    C -->|"manages"| P
    C -->|"handles"| E
    C -->|"utilizes"| M

    O -->|"uses"| P

    R -->|"provides"| QC
    R -->|"provides"| C

    %% Class Definitions (Colors)
    classDef core fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef ui fill:#ccffcc,stroke:#008000,stroke-width:2px;
    classDef resource fill:#ccccff,stroke:#0000cc,stroke-width:2px;
    classDef build fill:#ffffcc,stroke:#999900,stroke-width:2px;

    %% Click Events for Core Calculation Engine - Controller
    click C "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/controleur.h"
    click C "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/controleur.cpp"

    %% Click Events for Literals Module
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/litterale.h"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/litterale_complexe.h"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/litterale_entiere.h"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/litterale_expression.h"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/litterale_programme.h"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/litterale_rationnelle.h"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/litterale_reelle.h"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/litterale.cpp"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/litterale_complexe.cpp"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/litterale_entiere.cpp"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/litterale_expression.cpp"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/litterale_programme.cpp"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/litterale_rationnelle.cpp"
    click L "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/litterale_reelle.cpp"

    %% Click Events for Operators Module
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/operateur.h"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/operateur_accessible.h"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/operateur_binaire.h"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/operateur_evaluatif.h"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/operateur_numerique.h"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/operateur_unaire.h"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/operateur_accessible.cpp"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/operateur_binaire.cpp"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/operateur_evaluatif.cpp"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/operateur_numerique.cpp"
    click O "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/operateur_unaire.cpp"

    %% Click Events for Stack (Pile) Management
    click P "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/pile.h"
    click P "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/pile.cpp"

    %% Click Events for Exception Handling
    click E "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/exceptions.h"
    click E "https://github.com/hanlinaumonde/projet-comput-science/blob/main/Erreurs.txt"

    %% Click Events for Memento Pattern
    click M "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/memento_pile.h"

    %% Click Events for User Interface Components
    click QC "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/qcalculateur.h"
    click QC "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/qcalculateur.cpp"
    click QK "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/qclavier.h"
    click QK "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/qclavier.cpp"
    click QV "https://github.com/hanlinaumonde/projet-comput-science/blob/main/include/qvue_secondaire.h"
    click QV "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/qvue_secondaire.cpp"

    %% Click Events for Resources
    click R "https://github.com/hanlinaumonde/projet-comput-science/tree/main/res"

    %% Click Events for Application Entry
    click A1 "https://github.com/hanlinaumonde/projet-comput-science/blob/main/src/main.cpp"
    click A2 "https://github.com/hanlinaumonde/projet-comput-science/blob/main/CMakeLists.txt"
```
