SILICON
Loading...
Searching...
No Matches
graphicalArithmetic.hpp
Go to the documentation of this file.
1/*
2 Copyright (c) 2026. Giulio Cocconi
3
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation, either version 3 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
21
23
24namespace SILICON::ui {
25using namespace SILICON::core;
26using namespace SILICON::extra;
27
29 Q_OBJECT
30public:
31 GraphicalExtender(QGraphicsItem* parent = nullptr);
32
33 int type() const override { return SiliconTypes::EXTENDER; }
34};
35
37 Q_OBJECT
38public:
39 GraphicalComplementer(QGraphicsItem* parent = nullptr);
40
41 int type() const override { return SiliconTypes::COMPLEMENTER; }
42};
43
45 Q_OBJECT
46public:
47 explicit GraphicalHalfAdder(QGraphicsItem* parent = nullptr);
48
49 int type() const override { return SiliconTypes::HALF_ADDER; }
50};
51
53 Q_OBJECT
54public:
55 explicit GraphicalFullAdder(QGraphicsItem* parent = nullptr);
56
57 int type() const override { return SiliconTypes::FULL_ADDER; }
58};
59
61 Q_OBJECT
62public:
63 explicit GraphicalAdderNBits(QGraphicsItem* parent = nullptr);
64
65 int type() const override { return SiliconTypes::ADDER_N_BITS; }
66};
67
69 Q_OBJECT
70public:
71 explicit GraphicalMultiplier(QGraphicsItem* parent = nullptr);
72
73 int type() const override { return SiliconTypes::MULTIPLIER; }
74};
75
77 Q_OBJECT
78public:
79 explicit GraphicalDivider(QGraphicsItem* parent = nullptr);
80
81 int type() const override { return SiliconTypes::DIVIDER; }
82};
83
85 Q_OBJECT
86public:
87 explicit GraphicalShifter(QGraphicsItem* parent = nullptr);
88
89 int type() const override { return SiliconTypes::SHIFTER; }
90 void setComponent(const Component_ptr& component) override;
91
92private:
93 void setupCallbacks();
94 std::string applyMode(std::string mode);
95};
96
98 Q_OBJECT
99public:
100 explicit GraphicalComparator(QGraphicsItem* parent = nullptr);
101
102 int type() const override { return SiliconTypes::COMPARATOR; }
103
104 void setComponent(const Component_ptr& component) override;
105
106private:
107 void setupCallbacks();
108 std::string applyMode(std::string mode);
109};
110
111} // namespace SILICON::ui
GraphicalAdderNBits(QGraphicsItem *parent=nullptr)
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
GraphicalComparator(QGraphicsItem *parent=nullptr)
std::string applyMode(std::string mode)
GraphicalComplementer(QGraphicsItem *parent=nullptr)
GraphicalDivider(QGraphicsItem *parent=nullptr)
GraphicalExtender(QGraphicsItem *parent=nullptr)
GraphicalFullAdder(QGraphicsItem *parent=nullptr)
GraphicalHalfAdder(QGraphicsItem *parent=nullptr)
GraphicalLogicComponent(ItemCategory category, const Component_ptr &component, QGraphicsItem *shape, QGraphicsItem *parent, bool scanShape=false)
GraphicalMultiplier(QGraphicsItem *parent=nullptr)
GraphicalShifter(QGraphicsItem *parent=nullptr)
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
std::string applyMode(std::string mode)
std::shared_ptr< Component > Component_ptr