# devopstem/plna-core-cpp architecture

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

- Interactive diagram: https://gitdiagram.com/devopstem/plna-core-cpp
- Repository: https://github.com/devopstem/plna-core-cpp

## Overview

PLNA is a native C++ core for retail-store maps, routing and product-location lookup, exposed through a stable C ABI and Android JNI. The main workflow loads Firebase-style store-map JSON into a shared scene, then computes routes and emits a cached draw list for a platform renderer. Separate capabilities include shelf geometry/product caching and TCP task networking. Source excerpts show the map, ABI and loader calls; platform rendering and some integration details are documented but not fully sampled.

Main entry points: [`core/src/c_api.cpp`](https://github.com/devopstem/plna-core-cpp/blob/main/core/src/c_api.cpp) (C API), [`platform/android/jni_map_bridge.cpp`](https://github.com/devopstem/plna-core-cpp/blob/main/platform/android/jni_map_bridge.cpp) (Android map JNI), [`core/src/store_map_loader.cpp`](https://github.com/devopstem/plna-core-cpp/blob/main/core/src/store_map_loader.cpp) (Store-map loader), [`core/src/map_scene.cpp`](https://github.com/devopstem/plna-core-cpp/blob/main/core/src/map_scene.cpp) (Map scene)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_map_data["Map ingestion"]
  node_map_loader["Store-map loader"]
  node_color["Color parsing<br/>[color.hpp]"]
end

subgraph group_map_runtime["Map runtime"]
  node_scene["Map scene<br/>[map_scene.cpp]"]
  node_geometry["Geometry and products<br/>[map_geometry.cpp]"]
end

subgraph group_interfaces["Platform interfaces"]
  node_c_api["C API<br/>[c_api.cpp]"]
  node_android_map["Android map JNI<br/>[jni_map_bridge.cpp]"]
end

subgraph group_networking["Task networking"]
  node_android_network["Android network JNI"]
  node_socket["TCP client<br/>[socket_client.cpp]"]
end

node_host(("Host application"))
node_firebase[("Firebase RTDB")]
node_renderer["Platform renderer"]
node_task_server(("Task server"))

node_firebase -->|"provides JSON"| node_host
node_host -->|"loads map"| node_c_api
node_c_api -->|"loads JSON"| node_map_loader
node_map_loader -->|"populates scene"| node_scene
node_map_loader -->|"parses colors"| node_color
node_c_api -->|"manages scene"| node_scene
node_c_api -->|"manages products"| node_geometry
node_host -->|"calls JNI"| node_android_map
node_android_map -->|"updates and draws"| node_scene
node_android_map -->|"loads JSON"| node_map_loader
node_android_map -->|"routes and looks up"| node_geometry
node_geometry -->|"uses scene"| node_scene
node_host -->|"paints draw list"| node_renderer
node_host -.->|"calls JNI"| node_android_network
node_android_network -->|"controls client"| node_socket
node_socket -.->|"sends and receives"| node_task_server

click node_map_loader "https://github.com/devopstem/plna-core-cpp/blob/main/core/src/store_map_loader.cpp"
click node_color "https://github.com/devopstem/plna-core-cpp/blob/main/core/include/plna/color.hpp"
click node_scene "https://github.com/devopstem/plna-core-cpp/blob/main/core/src/map_scene.cpp"
click node_geometry "https://github.com/devopstem/plna-core-cpp/blob/main/core/src/map_geometry.cpp"
click node_c_api "https://github.com/devopstem/plna-core-cpp/blob/main/core/src/c_api.cpp"
click node_android_map "https://github.com/devopstem/plna-core-cpp/blob/main/platform/android/jni_map_bridge.cpp"
click node_android_network "https://github.com/devopstem/plna-core-cpp/blob/main/platform/android/jni_network_bridge.cpp"
click node_socket "https://github.com/devopstem/plna-core-cpp/blob/main/core/src/socket_client.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_map_loader,node_color toneBlue
class node_scene,node_geometry,node_firebase toneAmber
class node_c_api,node_android_map toneMint
class node_android_network,node_socket,node_task_server toneRose
class node_host,node_renderer toneIndigo
```

## Components

### Map ingestion

- [Store-map loader](https://github.com/devopstem/plna-core-cpp/blob/main/core/src/store_map_loader.cpp): `core/src/store_map_loader.cpp`
- [Color parsing](https://github.com/devopstem/plna-core-cpp/blob/main/core/include/plna/color.hpp): `core/include/plna/color.hpp`

### Map runtime

- [Map scene](https://github.com/devopstem/plna-core-cpp/blob/main/core/src/map_scene.cpp): `core/src/map_scene.cpp`
- [Geometry and products](https://github.com/devopstem/plna-core-cpp/blob/main/core/src/map_geometry.cpp): `core/src/map_geometry.cpp`

### Platform interfaces

- [C API](https://github.com/devopstem/plna-core-cpp/blob/main/core/src/c_api.cpp): `core/src/c_api.cpp`
- [Android map JNI](https://github.com/devopstem/plna-core-cpp/blob/main/platform/android/jni_map_bridge.cpp): `platform/android/jni_map_bridge.cpp`

### Task networking

- [Android network JNI](https://github.com/devopstem/plna-core-cpp/blob/main/platform/android/jni_network_bridge.cpp): `platform/android/jni_network_bridge.cpp`
- [TCP client](https://github.com/devopstem/plna-core-cpp/blob/main/core/src/socket_client.cpp): `core/src/socket_client.cpp`

### Other components

- **Host application**
- **Firebase RTDB**
- **Platform renderer**
- **Task server**

## Connections

- Firebase RTDB → Host application: provides JSON (evidence: `README.md`)
- Host application → C API: loads map (evidence: `README.md`)
- C API → Store-map loader: loads JSON (evidence: `core/src/c_api.cpp`)
- Store-map loader → Map scene: populates scene (evidence: `core/src/store_map_loader.cpp`)
- Store-map loader → Color parsing: parses colors (evidence: `core/src/store_map_loader.cpp`)
- C API → Map scene: manages scene (evidence: `core/src/c_api.cpp`)
- C API → Geometry and products: manages products (evidence: `core/src/c_api.cpp`)
- Host application → Android map JNI: calls JNI (evidence: `README.md`)
- Android map JNI → Map scene: updates and draws (evidence: `platform/android/jni_map_bridge.cpp`)
- Android map JNI → Store-map loader: loads JSON (evidence: `platform/android/jni_map_bridge.cpp`)
- Android map JNI → Geometry and products: routes and looks up (evidence: `platform/android/jni_map_bridge.cpp`)
- Geometry and products → Map scene: uses scene (evidence: `core/src/map_geometry.cpp`)
- Host application → Platform renderer: paints draw list (evidence: `README.md`)
- Host application → Android network JNI: calls JNI
- Android network JNI → TCP client: controls client (evidence: `platform/android/jni_network_bridge.cpp`)
- TCP client → Task server: sends and receives
