|
wiRedPanda
Logic Circuit Simulator
|
Model Context Protocol processor for wiRedPanda. More...
#include <MCPProcessor.h>
Public Member Functions | |
| MCPProcessor (MainWindow *mainWindow, QObject *parent=nullptr) | |
| void | startProcessing () |
| void | stopProcessing () |
| ~MCPProcessor () | |
Static Public Member Functions | |
| static QStringList | extractStdinLines (QByteArray &buffer, const QByteArray &data) |
Static Public Attributes | |
| static constexpr qint64 | kMaxStdinLineBytes = 16 * 1024 * 1024 |
Model Context Protocol processor for wiRedPanda.
Provides simple, elegant programmatic control of circuit design and simulation through stdin/stdout JSON command processing. stdin is read event-driven: a main-thread QSocketNotifier on POSIX, a dedicated StdinReader thread on Windows. A closed stdin (EOF) shuts the processor down cleanly.
Definition at line 72 of file MCPProcessor.h.
|
explicit |
Definition at line 91 of file MCPProcessor.cpp.
| MCPProcessor::~MCPProcessor | ( | ) |
Definition at line 146 of file MCPProcessor.cpp.
References stopProcessing().
|
static |
Appends data to buffer and returns every complete ('
'-terminated) line found, removing them from buffer. If more than kMaxStdinLineBytes accumulates with no newline, clears buffer instead of growing it without bound — stdin is not a trusted channel in –mcp/–mcp-gui mode (any local process that can pipe into wiRedPanda's stdin can write it). A pure static method, independent of any live file descriptor, so the buffering/cap logic is directly unit-testable.
Definition at line 234 of file MCPProcessor.cpp.
References kMaxStdinLineBytes.
| void MCPProcessor::startProcessing | ( | ) |
Definition at line 152 of file MCPProcessor.cpp.
Referenced by main().
| void MCPProcessor::stopProcessing | ( | ) |
Definition at line 175 of file MCPProcessor.cpp.
Referenced by ~MCPProcessor().
|
staticconstexpr |
Maximum bytes buffered while waiting for a newline-terminated JSON-RPC command — see extractStdinLines(). Public so tests can reference the real limit instead of a duplicated magic number.
Definition at line 86 of file MCPProcessor.h.
Referenced by extractStdinLines().