SILICON
Loading...
Searching...
No Matches
graphicalMultiplexer.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
22
23
24namespace SILICON::ui {
25using namespace SILICON::core;
26using namespace SILICON::extra;
27
29 Q_OBJECT
30private:
31 void setupCallbacks();
32 void updateLayout(int selectionSize, int busSize);
33 int applySelectionSize(int selectionSize);
34 int applyBusSize(int busSize);
35
36 [[nodiscard]] Multiplexer* getComponentAsMultiplexer() const;
37
38public:
39 explicit GraphicalMultiplexer(QGraphicsItem* parent = nullptr);
40
41 int type() const override { return SiliconTypes::MULTIPLEXER; }
42
43 void setComponent(const Component_ptr& component) override;
44};
45
47 Q_OBJECT
48private:
49 void setupCallbacks();
50 void updateLayout(int selectionSize, int busSize);
51 int applySelectionSize(int selectionSize);
52 int applyBusSize(int busSize);
53
54 [[nodiscard]] Demultiplexer* getComponentAsDemultiplexer() const;
55
56public:
57 explicit GraphicalDemultiplexer(QGraphicsItem* parent = nullptr);
58
59 int type() const override { return SiliconTypes::DEMULTIPLEXER; }
60
61 void setComponent(const Component_ptr& component) override;
62};
63
65 Q_OBJECT
66private:
67 void setupCallbacks();
68 int applySelectionSize(int selectionSize);
69
70 [[nodiscard]] Decoder* getComponentAsDecoder() const;
71
72public:
73 explicit GraphicalDecoder(QGraphicsItem* parent = nullptr);
74
75 int type() const override { return SiliconTypes::DECODER; }
76
77 void setComponent(const Component_ptr& component) override;
78};
79
80} // namespace SILICON::ui
GraphicalDecoder(QGraphicsItem *parent=nullptr)
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
int applySelectionSize(int selectionSize)
GraphicalDemultiplexer(QGraphicsItem *parent=nullptr)
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
Demultiplexer * getComponentAsDemultiplexer() const
void updateLayout(int selectionSize, int busSize)
GraphicalLogicComponent(ItemCategory category, const Component_ptr &component, QGraphicsItem *shape, QGraphicsItem *parent, bool scanShape=false)
GraphicalMultiplexer(QGraphicsItem *parent=nullptr)
void setComponent(const Component_ptr &component) override
Sets the associated logical component.
void updateLayout(int selectionSize, int busSize)
std::shared_ptr< Component > Component_ptr
@ DEMULTIPLEXER
Definition enums.hpp:106