HAL
pin_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"
31 #include <QMap>
32 #include <QList>
33 
34 namespace hal
35 {
36 
37  class Gate;
38 
39  class PinTreeItem : public BaseTreeItem
40  {
41  public:
42  enum Type {None, Pin, Group};
43 
44  private:
45  Type mType;
46  QList<u32> mNetIds;
47  std::string mPinName;
48  QString mPinDirection;
49  QString mPinType;
50  QString mNetName;
51  int mIndex;
52  public:
53 
54  PinTreeItem(const std::string& pinName, QString pinDirection, QString pinTypee, QString netName, int inx);
55  PinTreeItem();
56  QVariant getData(int column) const override;
57  void setData(QList<QVariant> data) override;
58  void setDataAtIndex(int index, QVariant& data) override;
59  void appendData(QVariant data) override;
60  int getColumnCount() const override;
61  void setType(Type tp) { mType = tp; }
62 
68  Type type() const { return mType; }
69  void setNetIds(const QList<u32>& nids) { mNetIds = nids; }
70 
78  QList<u32> netIds() const { return mNetIds; }
79  };
80 
86 {
87  Q_OBJECT
88 
89 public:
90 
96  GatePinsTreeModel(QObject* parent = nullptr);
97 
102 
106  void clear() override;
107 
113  void setGate(Gate* g);
114 
121  int getCurrentGateID();
122 
129 
130 
131  //column identifier
132  static const int sNameColumn = 0;
133  static const int sDirectionColumn = 1;
134  static const int sTypeColumn = 2;
135  static const int sConnectedNetColumn = 3;
136 
137 private:
138  int mGateId;
139  QMap<std::string, BaseTreeItem*> mPinGroupToTreeItem;
140 
141 };
142 
143 }
(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
A model to display the pins of a gate.
GatePinsTreeModel(QObject *parent=nullptr)
static const int sTypeColumn
static const int sConnectedNetColumn
static const int sDirectionColumn
static const int sNameColumn
Type type() const
void setNetIds(const QList< u32 > &nids)
QVariant getData(int column) const override
int getColumnCount() const override
void setDataAtIndex(int index, QVariant &data) override
void setType(Type tp)
void appendData(QVariant data) override
void setData(QList< QVariant > data) override
QList< u32 > netIds() const
Q_OBJECTQ_OBJECT
QObject * parent() const const