LibrePCB Developers Documentation
componentsignalinstance.h
Go to the documentation of this file.
1/*
2 * LibrePCB - Professional EDA for everyone!
3 * Copyright (C) 2013 LibrePCB Developers, see AUTHORS.md for contributors.
4 * https://librepcb.org/
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef LIBREPCB_CORE_COMPONENTSIGNALINSTANCE_H
21#define LIBREPCB_CORE_COMPONENTSIGNALINSTANCE_H
22
23/*******************************************************************************
24 * Includes
25 ******************************************************************************/
26#include "../../types/circuitidentifier.h"
27
28#include <QtCore>
29
30/*******************************************************************************
31 * Namespace / Forward Declarations
32 ******************************************************************************/
33namespace librepcb {
34
35class BI_FootprintPad;
36class Circuit;
37class ComponentInstance;
38class ComponentSignal;
39class NetSignal;
40class SI_SymbolPin;
41
42/*******************************************************************************
43 * Class ComponentSignalInstance
44 ******************************************************************************/
45
49class ComponentSignalInstance final : public QObject {
50 Q_OBJECT
51
52public:
53 // Constructors / Destructor
56 explicit ComponentSignalInstance(Circuit& circuit,
57 ComponentInstance& cmpInstance,
58 const ComponentSignal& cmpSignal,
59 NetSignal* netsignal = nullptr);
60 ~ComponentSignalInstance() noexcept;
61
62 // Getters
63 Circuit& getCircuit() const noexcept { return mCircuit; }
64 const ComponentSignal& getCompSignal() const noexcept {
65 return mComponentSignal;
66 }
67 NetSignal* getNetSignal() const noexcept { return mNetSignal; }
69 return mComponentInstance;
70 }
71 bool isNetSignalNameForced() const noexcept;
72 QString getForcedNetSignalName() const noexcept;
73 const QStringList& getPadNames() const noexcept { return mPadNames; }
74 const QList<SI_SymbolPin*>& getRegisteredSymbolPins() const noexcept {
76 }
77 const QList<BI_FootprintPad*>& getRegisteredFootprintPads() const noexcept {
79 }
80 int getRegisteredElementsCount() const noexcept;
81 bool isUsed() const noexcept { return (getRegisteredElementsCount() > 0); }
82 bool arePinsOrPadsUsed() const noexcept;
83
84 // Setters
85
97 void setNetSignal(NetSignal* netsignal);
98
99 // General Methods
100 void addToCircuit();
101 void removeFromCircuit();
106
112 void serialize(SExpression& root) const;
113
114 // Operator Overloadings
116 delete;
117
118signals:
120 void padNamesChanged(const QStringList& names);
121
122private: // Methods
123 void updatePadNames() noexcept;
124
125private: // Data
130
131 // Attributes
133
134 // Cached Properties
135 QStringList mPadNames;
136
137 // Registered Elements
140};
141
142/*******************************************************************************
143 * End of File
144 ******************************************************************************/
145
146} // namespace librepcb
147
148#endif
The BI_FootprintPad class.
Definition: bi_footprintpad.h:48
The Circuit class represents all electrical connections in a project (drawn in the schematics)
Definition: circuit.h:70
The ComponentInstance class.
Definition: componentinstance.h:54
The ComponentSignal class represents one signal of a component.
Definition: componentsignal.h:45
The ComponentSignalInstance class.
Definition: componentsignalinstance.h:49
void netSignalChanged(NetSignal *from, NetSignal *to)
QStringList mPadNames
Definition: componentsignalinstance.h:135
const QStringList & getPadNames() const noexcept
Definition: componentsignalinstance.h:73
ComponentInstance & getComponentInstance() const noexcept
Definition: componentsignalinstance.h:68
bool arePinsOrPadsUsed() const noexcept
Definition: componentsignalinstance.cpp:90
void padNamesChanged(const QStringList &names)
const ComponentSignal & getCompSignal() const noexcept
Definition: componentsignalinstance.h:64
Circuit & mCircuit
Definition: componentsignalinstance.h:126
void registerSymbolPin(SI_SymbolPin &pin)
Definition: componentsignalinstance.cpp:167
int getRegisteredElementsCount() const noexcept
Definition: componentsignalinstance.cpp:83
ComponentInstance & mComponentInstance
Definition: componentsignalinstance.h:127
NetSignal * mNetSignal
Definition: componentsignalinstance.h:132
QList< SI_SymbolPin * > mRegisteredSymbolPins
Definition: componentsignalinstance.h:138
bool isUsed() const noexcept
Definition: componentsignalinstance.h:81
bool isNetSignalNameForced() const noexcept
Definition: componentsignalinstance.cpp:73
NetSignal * getNetSignal() const noexcept
Definition: componentsignalinstance.h:67
const ComponentSignal & mComponentSignal
Definition: componentsignalinstance.h:128
~ComponentSignalInstance() noexcept
Definition: componentsignalinstance.cpp:63
const QList< BI_FootprintPad * > & getRegisteredFootprintPads() const noexcept
Definition: componentsignalinstance.h:77
void setNetSignal(NetSignal *netsignal)
(Re-)Connect/Disconnect this component signal to/from a circuit's netsignal
Definition: componentsignalinstance.cpp:108
QString getForcedNetSignalName() const noexcept
Definition: componentsignalinstance.cpp:77
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: componentsignalinstance.cpp:199
void unregisterSymbolPin(SI_SymbolPin &pin)
Definition: componentsignalinstance.cpp:175
void removeFromCircuit()
Definition: componentsignalinstance.cpp:151
Circuit & getCircuit() const noexcept
Definition: componentsignalinstance.h:63
void unregisterFootprintPad(BI_FootprintPad &pad)
Definition: componentsignalinstance.cpp:191
void registerFootprintPad(BI_FootprintPad &pad)
Definition: componentsignalinstance.cpp:182
QList< BI_FootprintPad * > mRegisteredFootprintPads
Definition: componentsignalinstance.h:139
bool mIsAddedToCircuit
Definition: componentsignalinstance.h:129
void addToCircuit()
Definition: componentsignalinstance.cpp:141
const QList< SI_SymbolPin * > & getRegisteredSymbolPins() const noexcept
Definition: componentsignalinstance.h:74
ComponentSignalInstance(const ComponentSignalInstance &other)=delete
void updatePadNames() noexcept
Definition: componentsignalinstance.cpp:210
The NetSignal class.
Definition: netsignal.h:50
The SExpression class.
Definition: sexpression.h:69
The SI_SymbolPin class.
Definition: si_symbolpin.h:52
Definition: occmodel.cpp:77