# falahati/nvapiwrapper architecture

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

- Interactive diagram: https://gitdiagram.com/falahati/nvapiwrapper
- Repository: https://github.com/falahati/nvapiwrapper

## Overview

##### Main Components

a. Core Components:
- NVIDIA Driver Layer (External)
- Native API Interface Layer
- High-Level Wrapper Layer
- Client Application Layer

b. Major Functional Modules:
- Management
- GPU Management
- Mosaic/Surround
- Driver Settings (DRS)
- Stereo 3D
- General NVIDIA Functions

##### Architecture Pattern

**[Client Applications]**
- ↓
**[High-Level API Wrapper]**
- ↓
**[Native API Interface]**
- ↓
**[NVIDIA Driver]**

##### Component Details

a. Native Layer (Bottom):
- By functionality (Display, GPU, Mosaic, etc.)
- Native delegates and API calls
- Connection to NVIDIA driver

b. Wrapper Layer (Middle):
- Main wrapper classes organized by domain
- Management classes:
- /Monitor Management
- GPU Management
- Surround Configuration
- Driver Settings
- Stereo Control

c. Client Interface (Top):
- Public interfaces and main entry points
- Demonstrate how client applications interact with the wrapper

##### Specific Implementation Details

a. Native Layer:
**[Native API Layer]**
- DRS API
- Display API
- GPU API
- Mosaic API
- Stereo API
- General API

b. Wrapper Layer:
**[Wrapper Layer]**
- Display Management
- Display Control
- Resolution Management
- GPU Management
- Performance Control
- Thermal Management
- Memory Management
- Configuration
- Driver Settings
- Profile Management

##### Key Relationships

- Initialization flow from NVIDIA class
- Demonstrate error handling paths
- Resource management flow
- Configuration management paths

##### Additional Elements

- Version information
- Supported features status
- Deprecated or unsupported features
- Extension points for future development

##### Implementation Notes

- Use standard UML notation where appropriate
- Notes for important implementation details
- Interface boundaries clearly

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Applications"]
        App[Client Application]:::client
    end

    subgraph Wrapper["High-Level API Wrapper"]
        NVIDIA["NVIDIA Main Entry Point"]:::core
        click NVIDIA "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/NVIDIA.cs"

        subgraph DisplayMgmt["Display Management"]
            Display["Display Control"]:::wrapper
            DisplayDevice["Display Device"]:::wrapper
            click Display "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Display/Display.cs"
            click DisplayDevice "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Display/DisplayDevice.cs"
        end

        subgraph GPUMgmt["GPU Management"]
            PhysicalGPU["Physical GPU"]:::wrapper
            LogicalGPU["Logical GPU"]:::wrapper
            click PhysicalGPU "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/GPU/PhysicalGPU.cs"
            click LogicalGPU "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/GPU/LogicalGPU.cs"
        end

        subgraph DRSMgmt["Driver Settings Management"]
            DRSProfile["Driver Settings Profile"]:::wrapper
            DRSSession["Driver Settings Session"]:::wrapper
            click DRSProfile "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/DRS/DriverSettingsProfile.cs"
            click DRSSession "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/DRS/DriverSettingsSession.cs"
        end

        subgraph MosaicMgmt["Mosaic Management"]
            GridTopology["Grid Topology"]:::wrapper
            Topology["Topology"]:::wrapper
            click GridTopology "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Mosaic/GridTopology.cs"
            click Topology "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Mosaic/Topology.cs"
        end

        subgraph StereoMgmt["Stereo Management"]
            StereoDevice["Stereo Device Session"]:::wrapper
            click StereoDevice "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Stereo/StereoDeviceSession.cs"
        end
    end

    subgraph Native["Native API Interface Layer"]
        subgraph NativeAPI["Native APIs"]
            DisplayAPI["Display API"]:::native
            GPUAPI["GPU API"]:::native
            DRSAPI["DRS API"]:::native
            MosaicAPI["Mosaic API"]:::native
            StereoAPI["Stereo API"]:::native
            click DisplayAPI "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/DisplayApi.cs"
            click GPUAPI "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/GPUApi.cs"
            click DRSAPI "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/DRSApi.cs"
            click MosaicAPI "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/MosaicApi.cs"
            click StereoAPI "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/StereoApi.cs"
        end

        subgraph NativeComponents["Native Components"]
            Interfaces["Interfaces"]:::native
            Delegates["Delegates"]:::native
            Structures["Structures"]:::native
            click Interfaces "https://github.com/falahati/NvAPIWrapper/tree/master/NvAPIWrapper/Native/Interfaces"
            click Delegates "https://github.com/falahati/NvAPIWrapper/tree/master/NvAPIWrapper/Native/Delegates"
            click Structures "https://github.com/falahati/NvAPIWrapper/tree/master/NvAPIWrapper/Native/Structures"
        end

        subgraph ErrorHandling["Error Handling"]
            APIException["NVIDIA API Exception"]:::error
            NotSupportedException["Not Supported Exception"]:::error
            click APIException "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/Exceptions/NVIDIAApiException.cs"
            click NotSupportedException "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/Exceptions/NVIDIANotSupportedException.cs"
        end

        subgraph Helpers["API Helpers"]
            DelegateFactory["Delegate Factory"]:::helper
            Extensions["Extension Methods"]:::helper
            click DelegateFactory "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/Helpers/DelegateFactory.cs"
            click Extensions "https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/Native/Helpers/ExtensionMethods.cs"
        end
    end

    subgraph Driver["NVIDIA Driver Layer"]
        NVDriver["NVIDIA Graphics Driver"]:::external
    end

    %% Connections
    App --> NVIDIA
    NVIDIA --> DisplayMgmt & GPUMgmt & DRSMgmt & MosaicMgmt & StereoMgmt
    DisplayMgmt --> DisplayAPI
    GPUMgmt --> GPUAPI
    DRSMgmt --> DRSAPI
    MosaicMgmt --> MosaicAPI
    StereoMgmt --> StereoAPI
    NativeAPI --> NativeComponents
    NativeAPI --> ErrorHandling
    NativeAPI --> Helpers
    NativeAPI --> NVDriver

    %% Styles
    classDef client fill:#E1F5FE,stroke:#0288D1
    classDef core fill:#1976D2,stroke:#0D47A1,color:#fff
    classDef wrapper fill:#81C784,stroke:#388E3C
    classDef native fill:#FFD54F,stroke:#FFA000
    classDef error fill:#EF5350,stroke:#D32F2F
    classDef helper fill:#CE93D8,stroke:#7B1FA2
    classDef external fill:#90A4AE,stroke:#546E7A
```
