wiRedPanda
Logic Circuit Simulator
Loading...
Searching...
No Matches
Enums.h
Go to the documentation of this file.
1// Copyright 2015 - 2026, GIBIS-UNIFESP and the wiRedPanda contributors
2// SPDX-License-Identifier: GPL-3.0-or-later
3
7
8#pragma once
9
10#include <QObject>
11
15class Enums
16{
17 Q_GADGET
18
19public:
20 Enums() = delete;
21
29 enum class Status { Unknown = -1, Inactive = 0, Active = 1, Error = 2 };
30 Q_ENUM(Status)
31
32
33 enum class WirelessMode {
34 None = 0,
35 Tx = 1,
36 Rx = 2,
37 };
38 Q_ENUM(WirelessMode)
39
40
41 enum class ElementType { // last element is 33
42 And = 5,
43 AudioBox = 31,
44 Buzzer = 26,
45 Clock = 9,
46 DFlipFlop = 17,
47 DLatch = 15,
48 Demux = 25,
49 Display14 = 27,
50 Display16 = 33,
51 Display7 = 14,
52 IC = 22,
54 InputGnd = 13,
57 InputVcc = 12,
59 JKLatch = 16,
60 Led = 3,
61 Line = 29,
62 Mux = 24,
63 Nand = 7,
64 Node = 23,
65 Nor = 8,
66 Not = 4,
67 Or = 6,
69 SRLatch = 32,
70 TFlipFlop = 20,
71 Text = 28,
73 Unknown = 0,
74 Xnor = 11,
75 Xor = 10,
76 };
77 Q_ENUM(ElementType)
78
79
80 enum class ElementGroup {
81 Gate = 4,
82 IC = 2,
83 Input = 3,
84 Memory = 5,
85 Mux = 7,
86 Other = 1,
87 Output = 6,
89 Unknown = 0,
90 };
91 Q_ENUM(ElementGroup)
92
93
98
104};
105
110
114QDataStream &operator>>(QDataStream &stream, ElementType &type);
116QDataStream &operator<<(QDataStream &stream, const ElementType &type);
Enums::ElementType ElementType
Definition Enums.h:107
QDataStream & operator<<(QDataStream &stream, const ElementType &type)
Serializes type into stream.
Definition Enums.cpp:83
ElementType & operator++(ElementType &type)
Pre-increment operator; advances type to the next ElementType in sequence.
Definition Enums.cpp:67
Enums::Status Status
Definition Enums.h:106
QDataStream & operator>>(QDataStream &stream, ElementType &type)
Deserializes an ElementType from stream into type.
Definition Enums.cpp:74
Enums::WirelessMode WirelessMode
Definition Enums.h:109
Enums::ElementGroup ElementGroup
Definition Enums.h:108
Graphical representation of an AND gate (2–8 inputs, 1 output).
Definition And.h:17
Audio output element that streams an external audio file when its input is logic-1.
Definition AudioBox.h:24
Event-driven real-time clock input element.
Definition Clock.h:23
Graphical representation of an edge-triggered D flip-flop.
Definition DFlipFlop.h:21
Graphical representation of a level-sensitive D latch.
Definition DLatch.h:20
Graphical representation of a demultiplexer (1-to-2^N).
Definition Demux.h:20
14-segment LED display output element (14 segments + decimal point = 15 inputs).
Definition Display14.h:24
16-segment LED display output element (16 segments + decimal point = 17 inputs).
Definition Display16.h:24
7-segment LED display output element (7 segments + decimal point = 8 inputs).
Definition Display7.h:25
ElementType
Numeric identifiers for every concrete element type.
Definition Enums.h:41
WirelessMode
Wireless routing mode for Node elements.
Definition Enums.h:33
@ Tx
Transmitter: broadcasts input signal to all Rx nodes sharing the same label.
Definition Enums.h:35
@ None
Normal pass-through node (no wireless routing).
Definition Enums.h:34
@ Rx
Receiver: receives signal from the Tx node that shares the same label.
Definition Enums.h:36
static ElementType nextElmType(ElementType type)
Returns the ElementType that follows type in the defined sequence.
Definition Enums.cpp:49
static ElementType prevElmType(ElementType type)
Returns the ElementType that precedes type in the defined sequence.
Definition Enums.cpp:57
Status
Definition Enums.h:29
Enums()=delete
ElementGroup
Logical grouping used to organise elements in the UI palette.
Definition Enums.h:80
@ Output
Output indicators (LEDs, displays, buzzers).
Definition Enums.h:87
@ Input
User-interactive inputs (buttons, switches, rotary).
Definition Enums.h:83
@ Memory
Sequential elements (flip-flops, latches).
Definition Enums.h:84
@ Other
Miscellaneous elements (nodes, lines, text, truth tables).
Definition Enums.h:86
@ StaticInput
Constant-value inputs (VCC, GND).
Definition Enums.h:88
@ Gate
Combinational logic gates (AND, OR, NOT, etc.).
Definition Enums.h:81
Graphic element representing an Integrated Circuit (sub-circuit) box.
Definition IC.h:31
Momentary push-button input element that is active only while pressed.
Definition InputButton.h:20
Static GND element that always drives logic-0 on its output.
Definition InputGND.h:17
Rotary switch input that activates one output port at a time.
Definition InputRotary.h:20
Toggle switch input element that maintains its on/off state between clicks.
Definition InputSwitch.h:20
Static VCC element that always drives logic-1 on its output.
Definition InputVCC.h:17
Graphical representation of an edge-triggered JK flip-flop.
Definition JKFlipFlop.h:20
LED output element that lights up when its input is logic-1.
Definition Led.h:20
Decorative line element used for annotating circuit diagrams.
Definition Line.h:19
Graphical representation of a multiplexer (2^N-to-1).
Definition Mux.h:20
Graphical representation of a NAND gate (2–8 inputs, 1 output).
Definition Nand.h:17
Visible wire junction (T-junction) element with 1 input and 1 output.
Definition Node.h:24
Graphical representation of a NOR gate (2–8 inputs, 1 output).
Definition Nor.h:17
Graphical representation of a NOT gate (1 input, 1 output).
Definition Not.h:17
Graphical representation of an OR gate (2–8 inputs, 1 output).
Definition Or.h:17
Graphical representation of an edge-triggered SR flip-flop.
Definition SRFlipFlop.h:20
Graphical representation of a level-sensitive SR latch.
Definition SRLatch.h:20
Graphical representation of an edge-triggered T (toggle) flip-flop.
Definition TFlipFlop.h:20
Free-text annotation element used for labelling circuit diagrams.
Definition Text.h:19
Programmable truth-table element with configurable inputs and outputs.
Definition TruthTable.h:20
Graphical representation of an XNOR gate (2–8 inputs, 1 output).
Definition Xnor.h:17
Graphical representation of an XOR gate (2–8 inputs, 1 output).
Definition Xor.h:17