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  public:
52 
53  PinTreeItem(const std::string& pinName, QString pinDirection, QString pinTypee, QString netName);
54  PinTreeItem();
55  QVariant getData(int column) const override;
56  void setData(QList<QVariant> data) override;
57  void setDataAtIndex(int index, QVariant& data) override;
58  void appendData(QVariant data) override;
59  int getColumnCount() const override;
60  void setType(Type tp) { mType = tp; }
61 
67  Type type() const { return mType; }
68  void setNetIds(const QList<u32>& nids) { mNetIds = nids; }
69 
77  QList<u32> netIds() const { return mNetIds; }
78  };
79 
85 {
86  Q_OBJECT
87 
88 public:
89 
95  GatePinsTreeModel(QObject* parent = nullptr);
96 
101 
105  void clear() override;
106 
112  void setGate(Gate* g);
113 
120  int getCurrentGateID();
121 
128 
129 
130  //column identifier
131  static const int sNameColumn = 0;
132  static const int sDirectionColumn = 1;
133  static const int sTypeColumn = 2;
134  static const int sConnectedNetColumn = 3;
135 
136 private:
137  int mGateId;
138  QMap<std::string, BaseTreeItem*> mPinGroupToTreeItem;
139 
140 };
141 
142 }
(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