# thenumbat/rpp architecture

> Architecture diagram of the GitHub repository thenumbat/rpp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/thenumbat/rpp
- Repository: https://github.com/thenumbat/rpp

## Overview

##### Main Components Organization

a) Core Library Components:
- Related components into logical subsystems:
- Memory Management (alloc0.h, alloc1.h, pool.h, range_allocator.h)
- Data Structures (array.h, map.h, queue.h, stack.h, vec.h)
- Concurrency (async.h, thread.h)
- Math/SIMD (math.h, simd.h, vmath.h)
- Utilities (format.h, log.h, profile.h)

b) Platform-Specific Implementations:
- Create two parallel implementation branches:
- POSIX Implementation (pos/ directory)
- Windows Implementation (w32/ directory)

##### Component Relationships

- How higher-level components depend on core components
- Platform-specific implementations feeding into their respective abstractions

b) Cross-Component Interactions:
- How async/thread components interact with platform-specific code
- Memory allocator relationships with data structures

##### Specific Elements

- Component name
- Key files/classes contained
- Platform support indicators
- Version requirements (e.g., MSVC 19.39+, Clang 17+)

##### Architectural Patterns to Emphasize

- Platform Abstraction Layer pattern
- RAII and Resource Management
- Type-safe containers and smart pointers
- Reflection system
- Async/await pattern implementation

##### Platform-Specific Implementation Layer (bottom)

- Clean separation between platform-specific and platform-independent code
- Clear dependency chains
- Resource management and safety features
- Cross-platform compatibility

Keep the abstraction level focused on architectural components while including enough detail to show the library's key features like SIMD support, async operations, and memory management strategies.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#a8d1f0,stroke:#333
    classDef memory fill:#b8e6b8,stroke:#333
    classDef datastructures fill:#ffd7b5,stroke:#333
    classDef concurrency fill:#d7b5ff,stroke:#333
    classDef math fill:#ffb5d7,stroke:#333
    classDef utils fill:#e6e6b8,stroke:#333
    classDef posix fill:#98fb98,stroke:#333
    classDef windows fill:#ffa07a,stroke:#333

    %% Core Layer
    subgraph CoreLayer["Core Layer"]
        Core["Core Fundamentals"]:::core
        click Core "https://github.com/TheNumbat/rpp/blob/main/rpp/base.h"
        Memory["Memory Management"]:::memory
        click Memory "https://github.com/TheNumbat/rpp/blob/main/rpp/alloc0.h"
        DataStructures["Data Structures"]:::datastructures
        click DataStructures "https://github.com/TheNumbat/rpp/blob/main/rpp/vec.h"
        Concurrency["Concurrency System"]:::concurrency
        click Concurrency "https://github.com/TheNumbat/rpp/blob/main/rpp/async.h"
        Math["Math/SIMD"]:::math
        click Math "https://github.com/TheNumbat/rpp/blob/main/rpp/math.h"
        Utils["Utilities"]:::utils
        click Utils "https://github.com/TheNumbat/rpp/blob/main/rpp/format.h"
    end

    %% Platform-Specific Layer
    subgraph PlatformLayer["Platform Implementation Layer"]
        subgraph POSIX["POSIX Implementation"]
            PosAsync["Async POSIX"]:::posix
            click PosAsync "https://github.com/TheNumbat/rpp/blob/main/rpp/pos/async_pos.cpp"
            PosThread["Thread POSIX"]:::posix
            click PosThread "https://github.com/TheNumbat/rpp/blob/main/rpp/pos/thread_pos.cpp"
            PosFiles["Files POSIX"]:::posix
            click PosFiles "https://github.com/TheNumbat/rpp/blob/main/rpp/pos/files_pos.cpp"
            PosNet["Net POSIX"]:::posix
            click PosNet "https://github.com/TheNumbat/rpp/blob/main/rpp/pos/net_pos.cpp"
        end

        subgraph Windows["Windows Implementation"]
            W32Async["Async Win32"]:::windows
            click W32Async "https://github.com/TheNumbat/rpp/blob/main/rpp/w32/async_w32.cpp"
            W32Thread["Thread Win32"]:::windows
            click W32Thread "https://github.com/TheNumbat/rpp/blob/main/rpp/w32/thread_w32.cpp"
            W32Files["Files Win32"]:::windows
            click W32Files "https://github.com/TheNumbat/rpp/blob/main/rpp/w32/files_w32.cpp"
            W32Net["Net Win32"]:::windows
            click W32Net "https://github.com/TheNumbat/rpp/blob/main/rpp/w32/net_w32.cpp"
        end
    end

    %% Relationships
    Core --> Memory
    Core --> DataStructures
    Core --> Concurrency
    Core --> Math
    Core --> Utils

    Memory --> DataStructures
    Concurrency --> PosAsync
    Concurrency --> W32Async
    Concurrency --> PosThread
    Concurrency --> W32Thread

    %% Legend
    subgraph Legend["Legend"]
        L1["Core Components"]:::core
        L2["Memory Management"]:::memory
        L3["Data Structures"]:::datastructures
        L4["Concurrency"]:::concurrency
        L5["Math/SIMD"]:::math
        L6["Utilities"]:::utils
        L7["POSIX"]:::posix
        L8["Windows"]:::windows
    end
```
