# yangosoft/cpputils2 architecture

> Architecture diagram of the GitHub repository yangosoft/cpputils2, 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/yangosoft/cpputils2
- Repository: https://github.com/yangosoft/cpputils2

## Overview

##### Main Components

A. Core Library Structure
- Divide into platform-specific and common components

B. Platform-Specific Implementations
- Linux Implementation Container
- Windows Implementation Container

C. Feature Modules
- Networking Module
- IPC Module
- Synchronization Module

##### Detailed Component Breakdown

A. Common Components (Platform Independent)
- Types.hpp
- Common interfaces (isocket.hpp)

B. Linux-Specific Implementation
- Futex Implementation
- Shared Memory Implementation
- Socket Implementation (TCP/UDP/UDS)

C. Windows-Specific Implementation
- Socket Implementation (TCP)
- Shared Memory Implementation

A. Interface Implementation

B. Dependencies
- Inheritance relationships where applicable

**[Common Components]**
- ↑

- [Interfaces]
- ↑
- ______|_______

**[Linux]      [Windows]**

##### Additional Elements

A. Include a "Build System" section
- CMake configuration
- Test framework integration

B. Add an "Examples" section
- Relationship to the shared memory example

- Common Layer       |

- ↓

- Interface Layer    |

- ↓

- Platform-Specific Layer|

Key Points to Emphasize:

##### Cross-Platform Nature
- Separation between platform-specific implementations
- Common interfaces that ensure consistency

##### Feature Sets
- Related functionalities (networking, IPC, synchronization)
- How they interact across platforms

##### Implementation Details
- Major classes and their relationships
- Inheritance hierarchies for socket implementations

##### Testing Integration
- Test components and their relationship to implementation

Remember to:
- Version information (C++23)
- Build system integration
- External dependencies

## Diagram (Mermaid)

```mermaid
graph TB
    %% Main Library Container
    subgraph Library["cpputils2 Library"]
        %% Common Layer
        subgraph Common["Common Layer"]
            CommonUtils["Common Utilities"]:::common
            CommonTypes["Types (types.hpp)"]:::common
            Interfaces["Socket Interface (isocket.hpp)"]:::interface
        end

        %% Platform-Specific Layer
        subgraph PlatformSpecific["Platform-Specific Implementations"]
            %% Linux Implementation
            subgraph Linux["Linux Features"]
                LinuxFutex["Futex Implementation"]:::linux
                LinuxShm["Shared Memory"]:::linux
                LinuxSockets["Socket Implementation"]:::linux
                subgraph LinuxSocketTypes["Socket Types"]
                    UDS["Unix Domain Sockets"]:::linux
                    UDP["UDP Sockets"]:::linux
                    LinuxTCP["TCP Sockets"]:::linux
                end
            end

            %% Windows Implementation
            subgraph Windows["Windows Features"]
                WinShm["Shared Memory"]:::windows
                WinSockets["Socket Implementation"]:::windows
                WinTCP["TCP Sockets"]:::windows
            end
        end

        %% Build System
        subgraph BuildSystem["Build System"]
            CMake["CMake Configuration"]:::build
            LibConfig["Library Config"]:::build
        end

        %% Testing and Examples
        Testing["Testing Framework"]:::test
        Examples["Examples"]:::example
    end

    %% Relationships
    CommonUtils --> Interfaces
    CommonTypes --> Interfaces
    Interfaces --> LinuxSockets
    Interfaces --> WinSockets
    LinuxSockets --> LinuxSocketTypes
    WinSockets --> WinTCP
    CMake --> LibConfig
    Examples --> LinuxShm
    Examples --> WinShm
    Testing --> Linux
    Testing --> Windows

    %% Click Events
    click CommonUtils "https://github.com/yangosoft/cpputils2/tree/main/src/include/cpputils2/common/"
    click CommonTypes "https://github.com/yangosoft/cpputils2/blob/main/src/include/cpputils2/common/types.hpp"
    click Interfaces "https://github.com/yangosoft/cpputils2/blob/main/src/include/cpputils2/net/socket/isocket.hpp"
    click LinuxFutex "https://github.com/yangosoft/cpputils2/tree/main/src/include/cpputils2/linux/futex/"
    click LinuxShm "https://github.com/yangosoft/cpputils2/tree/main/src/include/cpputils2/linux/shm/"
    click LinuxSockets "https://github.com/yangosoft/cpputils2/tree/main/src/include/cpputils2/linux/net/socket/"
    click UDS "https://github.com/yangosoft/cpputils2/blob/main/src/include/cpputils2/linux/net/socket/uds*.hpp"
    click UDP "https://github.com/yangosoft/cpputils2/blob/main/src/include/cpputils2/linux/net/socket/udpsocket*.hpp"
    click LinuxTCP "https://github.com/yangosoft/cpputils2/blob/main/src/include/cpputils2/linux/net/socket/tcpsocket*.hpp"
    click WinShm "https://github.com/yangosoft/cpputils2/tree/main/src/include/cpputils2/win/shm/"
    click WinSockets "https://github.com/yangosoft/cpputils2/tree/main/src/include/cpputils2/win/net/socket/"
    click WinTCP "https://github.com/yangosoft/cpputils2/blob/main/src/include/cpputils2/win/net/socket/tcpsocket*.hpp"
    click CMake "https://github.com/yangosoft/cpputils2/blob/main/CMakeLists.txt"
    click LibConfig "https://github.com/yangosoft/cpputils2/blob/main/src/cmake/Cpputils2Config.cmake.in"
    click Testing "https://github.com/yangosoft/cpputils2/tree/main/src/test/"
    click Examples "https://github.com/yangosoft/cpputils2/tree/main/examples/shared_memory/"

    %% Styles
    classDef common fill:#e1f5fe,stroke:#01579b
    classDef interface fill:#f5f5f5,stroke:#616161
    classDef linux fill:#fff3e0,stroke:#e65100
    classDef windows fill:#e8f5e9,stroke:#1b5e20
    classDef build fill:#ede7f6,stroke:#4527a0
    classDef test fill:#fce4ec,stroke:#880e4f
    classDef example fill:#f3e5f5,stroke:#4a148c
```
