# isweendyy/infotecs_test_task architecture

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

- Interactive diagram: https://gitdiagram.com/isweendyy/infotecs_test_task
- Repository: https://github.com/isweendyy/infotecs_test_task

## Overview

This repository implements a two-program C++ socket workflow backed by a shared dynamic library. The user enters a digit string in Program 1; it validates and transforms the string, hands it through a synchronized buffer for summing, then sends the sum to Program 2. Program 2 accepts connections, checks each sum through the library, and displays the result. Program 1 also retries connections. The check uses the number of digits in the sum and whether the sum is a nonzero multiple of 32. Relationships shown are based on the sampled source excerpts.

Main entry points: [`program1/src/main.cpp`](https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp) (Input Validation), [`program2/src/main.cpp`](https://github.com/isweendyy/infotecs_test_task/blob/main/program2/src/main.cpp) (Socket Server), [`library/src/mylib.cpp`](https://github.com/isweendyy/infotecs_test_task/blob/main/library/src/mylib.cpp) (String Transform)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_program1["Program 1"]
  node_input["Input Validation<br/>[main.cpp]"]
  node_buffer["Shared Buffer<br/>[main.cpp]"]
  node_processing["Sum Processing<br/>[main.cpp]"]
  node_reconnect["Reconnect Loop<br/>[main.cpp]"]
  node_client["Socket Client<br/>[main.cpp]"]
end

subgraph group_sharedlib["Shared Library"]
  node_transform["String Transform<br/>[mylib.cpp]"]
  node_sum["Digit Sum<br/>[mylib.cpp]"]
  node_check["Sum Check<br/>[mylib.cpp]"]
end

subgraph group_program2["Program 2"]
  node_server["Socket Server<br/>[main.cpp]"]
  node_display["Result Display<br/>[main.cpp]"]
end

node_user(("User"))

node_user -->|"enters digits"| node_input
node_input -->|"calls transform"| node_transform
node_input -->|"writes string"| node_buffer
node_buffer -->|"signals data"| node_processing
node_processing -->|"calls sum"| node_sum
node_reconnect -->|"retries connection"| node_client
node_processing -->|"sends sum"| node_server
node_server -->|"calls check"| node_check
node_server -->|"prints result"| node_display

click node_input "https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp"
click node_transform "https://github.com/isweendyy/infotecs_test_task/blob/main/library/src/mylib.cpp"
click node_buffer "https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp"
click node_processing "https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp"
click node_sum "https://github.com/isweendyy/infotecs_test_task/blob/main/library/src/mylib.cpp"
click node_reconnect "https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp"
click node_client "https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp"
click node_server "https://github.com/isweendyy/infotecs_test_task/blob/main/program2/src/main.cpp"
click node_check "https://github.com/isweendyy/infotecs_test_task/blob/main/library/src/mylib.cpp"
click node_display "https://github.com/isweendyy/infotecs_test_task/blob/main/program2/src/main.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_input,node_buffer,node_processing,node_reconnect,node_client,node_user toneBlue
class node_transform,node_sum,node_check toneAmber
class node_server,node_display toneMint
```

## Components

### Program 1

- [Input Validation](https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp): `program1/src/main.cpp`
- [Shared Buffer](https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp): `program1/src/main.cpp`
- [Sum Processing](https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp): `program1/src/main.cpp`
- [Reconnect Loop](https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp): `program1/src/main.cpp`
- [Socket Client](https://github.com/isweendyy/infotecs_test_task/blob/main/program1/src/main.cpp): `program1/src/main.cpp`

### Shared Library

- [String Transform](https://github.com/isweendyy/infotecs_test_task/blob/main/library/src/mylib.cpp): `library/src/mylib.cpp`
- [Digit Sum](https://github.com/isweendyy/infotecs_test_task/blob/main/library/src/mylib.cpp): `library/src/mylib.cpp`
- [Sum Check](https://github.com/isweendyy/infotecs_test_task/blob/main/library/src/mylib.cpp): `library/src/mylib.cpp`

### Program 2

- [Socket Server](https://github.com/isweendyy/infotecs_test_task/blob/main/program2/src/main.cpp): `program2/src/main.cpp`
- [Result Display](https://github.com/isweendyy/infotecs_test_task/blob/main/program2/src/main.cpp): `program2/src/main.cpp`

### Other components

- **User**

## Connections

- User → Input Validation: enters digits (evidence: `program1/src/main.cpp`)
- Input Validation → String Transform: calls transform (evidence: `program1/src/main.cpp`)
- Input Validation → Shared Buffer: writes string (evidence: `program1/src/main.cpp`)
- Shared Buffer → Sum Processing: signals data (evidence: `program1/src/main.cpp`)
- Sum Processing → Digit Sum: calls sum (evidence: `program1/src/main.cpp`)
- Reconnect Loop → Socket Client: retries connection (evidence: `program1/src/main.cpp`)
- Sum Processing → Socket Server: sends sum (evidence: `program1/src/main.cpp`)
- Socket Server → Sum Check: calls check (evidence: `program2/src/main.cpp`)
- Socket Server → Result Display: prints result (evidence: `program2/src/main.cpp`)
