HAL
gate_pins_tree_model.h
Go to the documentation of this file.
1 // MIT License
2 //
3 // Copyright (c) 2019 Ruhr University Bochum, Chair for Embedded Security. All Rights reserved.
4 // Copyright (c) 2019 Marc Fyrbiak, Sebastian Wallat, Max Hoffmann ("ORIGINAL AUTHORS"). All rights reserved.
5 // Copyright (c) 2021 Max Planck Institute for Security and Privacy. All Rights reserved.
6 // Copyright (c) 2021 Jörn Langheinrich, Julian Speith, Nils Albartus, René Walendy, Simon Klix ("ORIGINAL AUTHORS"). All Rights reserved.
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in all
16 // copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 // SOFTWARE.
25 
26 #pragma once
27 
28 //#include "gui/new_selection_details_widget/models/base_tree_model.h"
29 #include "hal_core/defines.h"
33 #include <QMap>
34 #include <QList>
35 
36 namespace hal
37 {
38 
39  class Gate;
40 
42  {
43  public:
44  enum Type {None, Pin, Group};
45 
46  private:
47  Type mType;
48  QList<u32> mNetIds;
49  std::string mPinName;
50  PinDirection mPinDirection;
51  PinType mPinType;
52  QString mNetName;
53  int mIndex;
54  public:
55 
56  GatePinsTreeItem(const std::string& pinName, PinDirection pinDirection, PinType pinTypee, QString netName, int inx);
58  QVariant getData(int column) const override;
59  void setData(QList<QVariant> data) override;
60  void setDataAtColumn(int column, QVariant& data) override;
61  void appendData(QVariant data) override;
62  int getColumnCount() const override;
63  void setType(Type tp) { mType = tp; }
64 
70  Type type() const { return mType; }
71  std::string pinName() const { return mPinName; }
72  PinDirection direction() const { return mPinDirection; }
73  void setNetIds(const QList<u32>& nids) { mNetIds = nids; }
74 
82  QList<u32> netIds() const { return mNetIds; }
83  };
84 
90 {
91  Q_OBJECT
92 
93 public:
94 
100  GatePinsTreeModel(QObject* parent = nullptr);
101 
106 
110  void clear() override;
111 
117  void setGate(Gate* g);
118 
125  int getCurrentGateID();
126 
133 
134 
135  //column identifier
136  static const int sNameColumn = 0;
137  static const int sDirectionColumn = 1;
138  static const int sTypeColumn = 2;
139  static const int sConnectedNetColumn = 3;
140 
141 private:
142  int mGateId;
143  QMap<std::string, BaseTreeItem*> mPinGroupToTreeItem;
144 
145 };
146 
147 }
(Future) Base class for all tree models related to the details widget.
The BaseTreeModel implements generic standard functions of a tree model.
Definition: gate.h:58
void appendData(QVariant data) override
int getColumnCount() const override
void setDataAtColumn(int column, QVariant &data) override
void setData(QList< QVariant > data) override
std::string pinName() const
QVariant getData(int column) const override
void setNetIds(const QList< u32 > &nids)
PinDirection direction() const
QList< u32 > netIds() const
A model to display the pins of a gate.
GatePinsTreeModel(QObject *parent=nullptr)
static const int sConnectedNetColumn
static const int sDirectionColumn
PinDirection
Definition: pin_direction.h:36
PinType
Definition: pin_type.h:36
Q_OBJECTQ_OBJECT
QObject * parent() const const