# griglapidus/cycflow architecture

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

## Overview

CycFlow is a C++ streaming-data framework with a reusable Qt charting component and two GUI applications. Its principal live workflow defines a runtime record schema, writes records into a ring buffer, serves the buffer over TCP, receives it into a local buffer, and visualizes the data. The repository also supports offline CBF viewing and CBF/CSV serialization, plus asynchronous and zero-copy reader/writer strategies. Relationships are based on the README and shown source references; some GUI and transport internals were not sampled, so their finer call paths are omitted.

Main entry points: [`CycLib/Core/RecBuffer.cpp`](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/RecBuffer.cpp) (Ring Buffer), [`CycLib/Core/RecRule.cpp`](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/RecRule.cpp) (Record Schema), [`ChartWidget/ChartWidget.cpp`](https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartWidget.cpp) (Chart Widget), [`CycTestServer/main.cpp`](https://github.com/griglapidus/cycflow/blob/develop/CycTestServer/main.cpp) (Data Generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_schema["Record Schema"]
  node_schema_fields["Field Attributes<br/>[PAttr.h]"]
  node_registry["Parameter Registry<br/>[PReg.h]"]
  node_record_rule["Record Schema<br/>[RecRule.cpp]"]
  node_record["Typed Record<br/>[Record.cpp]"]
  node_core_support["Core Utilities<br/>[Common.h]"]
end

subgraph group_buffering["Buffering Pipelines"]
  node_buffer[("Ring Buffer<br/>[RecBuffer.cpp]")]
  node_writer["Writer Strategies<br/>[RecordWriter.cpp]"]
  node_reader["Reader Strategies<br/>[RecordReader.cpp]"]
  node_producer["Record Producer<br/>[RecordProducer.h]"]
  node_consumer["Record Consumer<br/>[RecordConsumer.h]"]
  node_logger["Logging<br/>[CycLogger.h]"]
end

subgraph group_transport["TCP Streaming"]
  node_tcp_server["TCP Server<br/>[TcpServer.cpp]"]
  node_server_manager["Server Manager"]
  node_tcp_sender["TCP Sender<br/>[TcpDataSender.cpp]"]
  node_tcp_receiver["TCP Receiver"]
  node_service_client["Service Discovery"]
end

subgraph group_visualization["Visualization"]
  node_receiver_app["Receiver UI<br/>[MainWindow.cpp]"]
  node_session["TCP Session"]
  node_chart_consumer["Chart Data Feed<br/>[ChartConsumer.cpp]"]
  node_chart_widget["Chart Widget<br/>[ChartWidget.cpp]"]
  node_chart_model["Chart Model<br/>[ChartModel.cpp]"]
  node_chart_delegate["Chart Delegate<br/>[ChartDelegate.cpp]"]
  node_chart_view["Chart View<br/>[ChartView.cpp]"]
  node_file_viewer["Offline Viewer<br/>[CbfReader.cpp]"]
  node_chart_defs["Chart Definitions<br/>[ChartDefs.h]"]
  node_app_config["Receiver Configuration<br/>[AppConfig.h]"]
end

subgraph group_serialization["File Serialization"]
  node_cbf_reader["CBF Reader<br/>[CbfReader.cpp]"]
  node_cbf_file["CBF File Access<br/>[CbfFile.cpp]"]
  node_cbf_writer["CBF Writer<br/>[CbfWriter.cpp]"]
  node_csv_writer["CSV Writer<br/>[CsvWriter.cpp]"]
end

node_sensor(("Data Generator<br/>[main.cpp]"))
node_initiator(("Viewer User"))
node_tcp_network["TCP Network"]
node_cbf_storage["CBF File"]

node_schema_fields -->|"registers names"| node_registry
node_record_rule -->|"lays out fields"| node_schema_fields
node_record_rule -->|"caches offsets"| node_registry
node_record -->|"accesses schema"| node_record_rule
node_buffer -->|"stores schema"| node_record_rule
node_sensor -->|"defines schema"| node_record_rule
node_sensor -->|"initializes buffer"| node_buffer
node_sensor -->|"writes records"| node_writer
node_writer -->|"appends records"| node_buffer
node_reader -->|"reads batches"| node_buffer
node_producer -->|"writes through"| node_writer
node_consumer -->|"reads through"| node_reader
node_server_manager -->|"owns server"| node_tcp_server
node_tcp_server -->|"registers buffers"| node_buffer
node_tcp_server -->|"spawns sessions"| node_tcp_sender
node_tcp_sender -->|"streams records"| node_tcp_network
node_tcp_network -->|"delivers stream"| node_tcp_receiver
node_tcp_receiver -->|"fills local buffer"| node_buffer
node_service_client -->|"discovers buffers"| node_tcp_network
node_session -->|"manages connection"| node_tcp_receiver
node_receiver_app -->|"hosts sessions"| node_session
node_session -->|"uses data feed"| node_chart_consumer
node_chart_consumer -->|"supplies chart data"| node_chart_widget
node_chart_widget -->|"uses model"| node_chart_model
node_chart_widget -->|"provides navigation"| node_chart_view
node_chart_delegate -->|"renders model"| node_chart_model
node_cbf_reader -->|"reads sections"| node_cbf_file
node_cbf_writer -->|"writes sections"| node_cbf_file
node_csv_writer -->|"consumes records"| node_consumer
node_file_viewer -->|"opens file"| node_cbf_storage
node_cbf_storage -->|"provides bytes"| node_cbf_reader
node_file_viewer -->|"displays series"| node_chart_widget
node_initiator -->|"opens CBF"| node_file_viewer
node_initiator -->|"connects to stream"| node_receiver_app

click node_sensor "https://github.com/griglapidus/cycflow/blob/develop/CycTestServer/main.cpp"
click node_schema_fields "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/PAttr.h"
click node_registry "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/PReg.h"
click node_record_rule "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/RecRule.cpp"
click node_record "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/Record.cpp"
click node_buffer "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/RecBuffer.cpp"
click node_writer "https://github.com/griglapidus/cycflow/blob/develop/CycLib/RecordWriter.cpp"
click node_reader "https://github.com/griglapidus/cycflow/blob/develop/CycLib/RecordReader.cpp"
click node_producer "https://github.com/griglapidus/cycflow/blob/develop/CycLib/RecordProducer.h"
click node_consumer "https://github.com/griglapidus/cycflow/blob/develop/CycLib/RecordConsumer.h"
click node_tcp_server "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpServer.cpp"
click node_server_manager "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpServerManager.cpp"
click node_tcp_sender "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpDataSender.cpp"
click node_tcp_receiver "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpDataReceiver.cpp"
click node_service_client "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpServiceClient.cpp"
click node_receiver_app "https://github.com/griglapidus/cycflow/blob/develop/CycBufReceiver/MainWindow.cpp"
click node_session "https://github.com/griglapidus/cycflow/blob/develop/CycBufReceiver/TcpSessionWidget.cpp"
click node_chart_consumer "https://github.com/griglapidus/cycflow/blob/develop/CycBufReceiver/ChartConsumer.cpp"
click node_chart_widget "https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartWidget.cpp"
click node_chart_model "https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartModel.cpp"
click node_chart_delegate "https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartDelegate.cpp"
click node_chart_view "https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartView.cpp"
click node_cbf_reader "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Cbf/CbfReader.cpp"
click node_cbf_file "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Cbf/CbfFile.cpp"
click node_cbf_writer "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Cbf/CbfWriter.cpp"
click node_csv_writer "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Csv/CsvWriter.cpp"
click node_file_viewer "https://github.com/griglapidus/cycflow/blob/develop/CbfView/CbfReader.cpp"
click node_core_support "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/Common.h"
click node_logger "https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/CycLogger.h"
click node_chart_defs "https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartDefs.h"
click node_app_config "https://github.com/griglapidus/cycflow/blob/develop/CycBufReceiver/AppConfig.h"

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_schema_fields,node_registry,node_record_rule,node_record,node_core_support,node_initiator toneBlue
class node_buffer,node_writer,node_reader,node_producer,node_consumer,node_logger toneAmber
class node_tcp_server,node_server_manager,node_tcp_sender,node_tcp_receiver,node_service_client toneMint
class node_receiver_app,node_session,node_chart_consumer,node_chart_widget,node_chart_model,node_chart_delegate,node_chart_view,node_file_viewer,node_chart_defs,node_app_config toneRose
class node_cbf_reader,node_cbf_file,node_cbf_writer,node_csv_writer,node_tcp_network,node_cbf_storage toneIndigo
class node_sensor toneTeal
```

## Components

### Record Schema

- [Field Attributes](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/PAttr.h): `CycLib/Core/PAttr.h`
- [Parameter Registry](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/PReg.h): `CycLib/Core/PReg.h`
- [Record Schema](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/RecRule.cpp): `CycLib/Core/RecRule.cpp`
- [Typed Record](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/Record.cpp): `CycLib/Core/Record.cpp`
- [Core Utilities](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/Common.h): `CycLib/Core/Common.h`

### Buffering Pipelines

- [Ring Buffer](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/RecBuffer.cpp): `CycLib/Core/RecBuffer.cpp`
- [Writer Strategies](https://github.com/griglapidus/cycflow/blob/develop/CycLib/RecordWriter.cpp): `CycLib/RecordWriter.cpp`
- [Reader Strategies](https://github.com/griglapidus/cycflow/blob/develop/CycLib/RecordReader.cpp): `CycLib/RecordReader.cpp`
- [Record Producer](https://github.com/griglapidus/cycflow/blob/develop/CycLib/RecordProducer.h): `CycLib/RecordProducer.h`
- [Record Consumer](https://github.com/griglapidus/cycflow/blob/develop/CycLib/RecordConsumer.h): `CycLib/RecordConsumer.h`
- [Logging](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Core/CycLogger.h): `CycLib/Core/CycLogger.h`

### TCP Streaming

- [TCP Server](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpServer.cpp): `CycLib/Tcp/TcpServer.cpp`
- [Server Manager](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpServerManager.cpp): `CycLib/Tcp/TcpServerManager.cpp`
- [TCP Sender](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpDataSender.cpp): `CycLib/Tcp/TcpDataSender.cpp`
- [TCP Receiver](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpDataReceiver.cpp): `CycLib/Tcp/TcpDataReceiver.cpp`
- [Service Discovery](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Tcp/TcpServiceClient.cpp): `CycLib/Tcp/TcpServiceClient.cpp`

### Visualization

- [Receiver UI](https://github.com/griglapidus/cycflow/blob/develop/CycBufReceiver/MainWindow.cpp): `CycBufReceiver/MainWindow.cpp`
- [TCP Session](https://github.com/griglapidus/cycflow/blob/develop/CycBufReceiver/TcpSessionWidget.cpp): `CycBufReceiver/TcpSessionWidget.cpp`
- [Chart Data Feed](https://github.com/griglapidus/cycflow/blob/develop/CycBufReceiver/ChartConsumer.cpp): `CycBufReceiver/ChartConsumer.cpp`
- [Chart Widget](https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartWidget.cpp): `ChartWidget/ChartWidget.cpp`
- [Chart Model](https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartModel.cpp): `ChartWidget/ChartModel.cpp`
- [Chart Delegate](https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartDelegate.cpp): `ChartWidget/ChartDelegate.cpp`
- [Chart View](https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartView.cpp): `ChartWidget/ChartView.cpp`
- [Offline Viewer](https://github.com/griglapidus/cycflow/blob/develop/CbfView/CbfReader.cpp): `CbfView/CbfReader.cpp`
- [Chart Definitions](https://github.com/griglapidus/cycflow/blob/develop/ChartWidget/ChartDefs.h): `ChartWidget/ChartDefs.h`
- [Receiver Configuration](https://github.com/griglapidus/cycflow/blob/develop/CycBufReceiver/AppConfig.h): `CycBufReceiver/AppConfig.h`

### File Serialization

- [CBF Reader](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Cbf/CbfReader.cpp): `CycLib/Cbf/CbfReader.cpp`
- [CBF File Access](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Cbf/CbfFile.cpp): `CycLib/Cbf/CbfFile.cpp`
- [CBF Writer](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Cbf/CbfWriter.cpp): `CycLib/Cbf/CbfWriter.cpp`
- [CSV Writer](https://github.com/griglapidus/cycflow/blob/develop/CycLib/Csv/CsvWriter.cpp): `CycLib/Csv/CsvWriter.cpp`

### Other components

- [Data Generator](https://github.com/griglapidus/cycflow/blob/develop/CycTestServer/main.cpp): `CycTestServer/main.cpp`
- **Viewer User**
- **TCP Network**
- **CBF File**

## Connections

- Field Attributes → Parameter Registry: registers names (evidence: `CycLib/Core/PAttr.h`)
- Record Schema → Field Attributes: lays out fields
- Record Schema → Parameter Registry: caches offsets (evidence: `CycLib/Core/RecRule.cpp`)
- Typed Record → Record Schema: accesses schema
- Ring Buffer → Record Schema: stores schema
- Data Generator → Record Schema: defines schema (evidence: `CycTestServer/main.cpp`)
- Data Generator → Ring Buffer: initializes buffer (evidence: `CycTestServer/main.cpp`)
- Data Generator → Writer Strategies: writes records (evidence: `CycTestServer/main.cpp`)
- Writer Strategies → Ring Buffer: appends records
- Reader Strategies → Ring Buffer: reads batches
- Record Producer → Writer Strategies: writes through (evidence: `CycLib/RecordProducer.h`)
- Record Consumer → Reader Strategies: reads through (evidence: `CycLib/RecordConsumer.h`)
- Server Manager → TCP Server: owns server
- TCP Server → Ring Buffer: registers buffers
- TCP Server → TCP Sender: spawns sessions
- TCP Sender → TCP Network: streams records
- TCP Network → TCP Receiver: delivers stream
- TCP Receiver → Ring Buffer: fills local buffer
- Service Discovery → TCP Network: discovers buffers
- TCP Session → TCP Receiver: manages connection
- Receiver UI → TCP Session: hosts sessions
- TCP Session → Chart Data Feed: uses data feed
- Chart Data Feed → Chart Widget: supplies chart data
- Chart Widget → Chart Model: uses model
- Chart Widget → Chart View: provides navigation
- Chart Delegate → Chart Model: renders model
- CBF Reader → CBF File Access: reads sections
- CBF Writer → CBF File Access: writes sections
- CSV Writer → Record Consumer: consumes records
- Offline Viewer → CBF File: opens file (evidence: `CbfView/CbfReader.cpp`)
- CBF File → CBF Reader: provides bytes
- Offline Viewer → Chart Widget: displays series
- Viewer User → Offline Viewer: opens CBF
- Viewer User → Receiver UI: connects to stream
