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

Handler for simulation operation commands (control, waveform generation/export). More...

#include <SimulationHandler.h>

Inheritance diagram for SimulationHandler:
[legend]

Public Member Functions

QJsonObject handleCommand (const QString &command, const QJsonObject &params, const QJsonValue &requestId) override
 SimulationHandler (MainWindow *mainWindow, const MCPValidator *validator)
 ~SimulationHandler ()
Public Member Functions inherited from BaseHandler
QString availableInputPorts (GraphicElement *element) const
QString availableOutputPorts (GraphicElement *element) const
 BaseHandler (MainWindow *mainWindow, const MCPValidator *validator)
QJsonObject createErrorResponse (const QString &error, const QJsonValue &requestId=QJsonValue(), int code=JsonRpcError::InternalError) const
QJsonObject createSuccessResponse (const QJsonObject &result={}, const QJsonValue &requestId=QJsonValue()) const
Scene * currentScene ()
const Scene * currentScene () const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool inputPortByLabel (GraphicElement *element, const QString &label, int &portIndex, QString &errorMsg) const
bool outputPortByLabel (GraphicElement *element, const QString &label, int &portIndex, QString &errorMsg) const
template<typename Fn>
QJsonObject tryCommand (Fn &&fn, const QString &action, const QJsonValue &requestId=QJsonValue())
 Wraps fn in a try/catch, returning an error response on exception.
GraphicElement * validatedElement (const QJsonObject &params, const QString &paramName, QString &errorMsg)
 Validates paramName in params, looks up the element, and returns it.
bool validateElementId (int elementId, const QString &paramName, QString &errorMsg) const
bool validateNonEmptyString (const QJsonValue &value, const QString &paramName, QString &errorMsg) const
bool validateNonNegativeInteger (const QJsonValue &value, const QString &paramName, QString &errorMsg) const
bool validateNumeric (const QJsonValue &value, const QString &paramName, QString &errorMsg) const
bool validateParameters (const QJsonObject &params, const QStringList &required) const
bool validatePortRange (GraphicElement *element, int portIndex, bool isOutput, const QString &paramName, QString &errorMsg) const
bool validatePositiveInteger (const QJsonValue &value, const QString &paramName, QString &errorMsg) const
virtual ~BaseHandler ()=default

Friends

class TestSimulationHandler

Additional Inherited Members

Protected Member Functions inherited from BaseHandler
QString availablePorts (GraphicElement *element, bool isOutput) const
Protected Attributes inherited from BaseHandler
MainWindow * m_mainWindow
const MCPValidator * m_validator

Detailed Description

Handler for simulation operation commands (control, waveform generation/export).

Handles simulation control (start/stop/restart/update) and waveform generation/export. IC creation/management moved to ICHandler; undo/redo moved to HistoryHandler.

Definition at line 17 of file SimulationHandler.h.

Constructor & Destructor Documentation

◆ SimulationHandler()

SimulationHandler::SimulationHandler ( MainWindow * mainWindow,
const MCPValidator * validator )
explicit

Definition at line 16 of file SimulationHandler.cpp.

References BaseHandler::BaseHandler().

Referenced by TestSimulationHandler.

◆ ~SimulationHandler()

SimulationHandler::~SimulationHandler ( )

Definition at line 22 of file SimulationHandler.cpp.

Member Function Documentation

◆ handleCommand()

QJsonObject SimulationHandler::handleCommand ( const QString & command,
const QJsonObject & params,
const QJsonValue & requestId )
overridevirtual

◆ TestSimulationHandler

friend class TestSimulationHandler
friend

Definition at line 26 of file SimulationHandler.h.

References SimulationHandler(), and TestSimulationHandler.

Referenced by TestSimulationHandler.


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