wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
DolphinEdits Namespace Reference

Pure mutations of a SignalModel's value grid — the data side of the editor's commands (set/invert/clear/clock/combinational/auto-crop/length). More...

Functions

void applyToCells (SignalModel &model, const QModelIndexList &cells, const std::function< int(int)> &valueFn)
 Sets each cell in cells to valueFn(currentValue).
void clearInputs (SignalModel &model, int inputPorts)
 Sets every input cell (the first inputPorts rows, over the model's columns) to 0.
void clockWave (SignalModel &model, const QModelIndexList &cells, const int firstCol, const int period)
void combinational (SignalModel &model, const int inputPorts, const int columns)
void growInputColumns (SignalModel &model, const int inputPorts, const int oldLength, const int newLength)
int lastNonZeroColumn (const SignalModel &model, int inputPorts)
 Returns the index of the last column with any non-zero input value, or 0 if none.

Detailed Description

Pure mutations of a SignalModel's value grid — the data side of the editor's commands (set/invert/clear/clock/combinational/auto-crop/length).

No view, selection model, dialog, simulation, or edited-flag bookkeeping — the controller's slots own those and call these to change the cells. Functions touch only input rows where that is the editor's contract (clear/combinational/grow); cell-list variants act on whatever cells the caller passes (output rows are never selectable).

Function Documentation

◆ applyToCells()

void DolphinEdits::applyToCells ( SignalModel & model,
const QModelIndexList & cells,
const std::function< int(int)> & valueFn )

Sets each cell in cells to valueFn(currentValue).

Definition at line 12 of file DolphinEdits.cpp.

References SignalModel::setValue(), and SignalModel::value().

◆ clearInputs()

void DolphinEdits::clearInputs ( SignalModel & model,
const int inputPorts )

Sets every input cell (the first inputPorts rows, over the model's columns) to 0.

Definition at line 52 of file DolphinEdits.cpp.

References SignalModel::setValue().

◆ clockWave()

void DolphinEdits::clockWave ( SignalModel & model,
const QModelIndexList & cells,
int firstCol,
int period )

Writes a 50%-duty clock into cells: LOW for the first half of each period, HIGH for the second, with the phase anchored at column firstCol.

Definition at line 20 of file DolphinEdits.cpp.

References SignalModel::setValue().

◆ combinational()

void DolphinEdits::combinational ( SignalModel & model,
int inputPorts,
int columns )

Fills the first inputPorts rows over columns with the Gray-code-style enumeration of all input combinations (the combinational truth table).

Definition at line 33 of file DolphinEdits.cpp.

References SignalModel::setValue().

Referenced by BewavedDolphin::saveToTxt().

◆ growInputColumns()

void DolphinEdits::growInputColumns ( SignalModel & model,
int inputPorts,
int oldLength,
int newLength )

Zero-fills the newly added input cells in columns [oldLength, newLength) across the first inputPorts rows (used after the model grows).

Definition at line 75 of file DolphinEdits.cpp.

References SignalModel::setValue().

Referenced by BewavedDolphin::setLength().

◆ lastNonZeroColumn()

int DolphinEdits::lastNonZeroColumn ( const SignalModel & model,
const int inputPorts )

Returns the index of the last column with any non-zero input value, or 0 if none.

Definition at line 62 of file DolphinEdits.cpp.

References SignalModel::value().