wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
MCPProcessor Class Reference

Model Context Protocol processor for wiRedPanda. More...

#include <MCPProcessor.h>

Inheritance diagram for MCPProcessor:
[legend]

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ MCPProcessor()

MCPProcessor::MCPProcessor ( MainWindow * mainWindow,
QObject * parent = nullptr )
explicit

Definition at line 91 of file MCPProcessor.cpp.

◆ ~MCPProcessor()

MCPProcessor::~MCPProcessor ( )

Definition at line 146 of file MCPProcessor.cpp.

References stopProcessing().

Member Function Documentation

◆ extractStdinLines()

QStringList MCPProcessor::extractStdinLines ( QByteArray & buffer,
const QByteArray & data )
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.

◆ startProcessing()

void MCPProcessor::startProcessing ( )

Definition at line 152 of file MCPProcessor.cpp.

Referenced by main().

◆ stopProcessing()

void MCPProcessor::stopProcessing ( )

Definition at line 175 of file MCPProcessor.cpp.

Referenced by ~MCPProcessor().

Member Data Documentation

◆ kMaxStdinLineBytes

qint64 MCPProcessor::kMaxStdinLineBytes = 16 * 1024 * 1024
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().


The documentation for this class was generated from the following files: