20#ifndef LIBREPCB_CORE_COMPONENTINSTANCE_H
21#define LIBREPCB_CORE_COMPONENTINSTANCE_H
26#include "../../attribute/attribute.h"
27#include "../../types/circuitidentifier.h"
28#include "../../types/uuid.h"
43class ComponentSignalInstance;
44class ComponentSymbolVariant;
77 const QMap<Uuid, ComponentSignalInstance*>&
getSignals() const noexcept {
81 const Uuid& signalUuid)
const noexcept {
90 const
tl::optional<
Uuid>& assemblyVariant) const noexcept;
95 const QHash<Uuid, SI_Symbol*>&
getSymbols() const noexcept {
103 bool isUsed() const noexcept;
125 void setValue(
const QString& value)
noexcept;
The BI_Device class.
Definition: bi_device.h:57
The Circuit class represents all electrical connections in a project (drawn in the schematics)
Definition: circuit.h:70
The Component class represents a "generic" device in the library.
Definition: component.h:73
The ComponentInstance class.
Definition: componentinstance.h:54
ComponentInstance & operator=(const ComponentInstance &rhs)=delete
const Component & mLibComponent
Reference to the component in the project's library.
Definition: componentinstance.h:178
QSet< Uuid > getCompatibleDevices() const noexcept
Definition: componentinstance.cpp:93
bool isAddedToCircuit() const noexcept
Definition: componentinstance.h:104
QList< BI_Device * > mRegisteredDevices
All registered devices (of all boards)
Definition: componentinstance.h:214
QScopedPointer< AttributeList > mAttributes
All attributes of this component.
Definition: componentinstance.h:184
const QList< BI_Device * > & getDevices() const noexcept
Definition: componentinstance.h:98
void setAssemblyOptions(const ComponentAssemblyOptionList &options) noexcept
Definition: componentinstance.cpp:172
~ComponentInstance() noexcept
Definition: componentinstance.cpp:81
Circuit & mCircuit
Definition: componentinstance.h:161
void unregisterSymbol(SI_Symbol &symbol)
Definition: componentinstance.cpp:248
QHash< Uuid, SI_Symbol * > mRegisteredSymbols
All registered symbols.
Definition: componentinstance.h:207
void setValue(const QString &value) noexcept
Set the value of this component instance in the circuit.
Definition: componentinstance.cpp:157
int getRegisteredElementsCount() const noexcept
Definition: componentinstance.cpp:127
Uuid mUuid
The unique UUID of this component instance in the circuit.
Definition: componentinstance.h:167
bool isUsed() const noexcept
Definition: componentinstance.cpp:134
bool mLockAssembly
Whether mAssemblyOptions can be modified from the board editor or not.
Definition: componentinstance.h:194
bool getLockAssembly() const noexcept
Definition: componentinstance.h:91
QVector< std::shared_ptr< const Part > > getParts(const tl::optional< Uuid > &assemblyVariant) const noexcept
Definition: componentinstance.cpp:101
ComponentSignalInstance * getSignalInstance(const Uuid &signalUuid) const noexcept
Definition: componentinstance.h:80
bool checkAttributesValidity() const noexcept
Definition: componentinstance.cpp:321
void updatePrimaryDevice() noexcept
Definition: componentinstance.cpp:306
const AttributeList & getAttributes() const noexcept
Definition: componentinstance.h:84
const CircuitIdentifier & getName() const noexcept
Definition: componentinstance.h:68
const Component & getLibComponent() const noexcept
Definition: componentinstance.h:73
QPointer< const BI_Device > mPrimaryDevice
Definition: componentinstance.h:217
ComponentInstance()=delete
void setName(const CircuitIdentifier &name) noexcept
Set the name of this component instance in the circuit.
Definition: componentinstance.cpp:150
QString mValue
The value of this component instance in the circuit (e.g. the resistance of a resistor)
Definition: componentinstance.h:175
const ComponentSymbolVariant & getSymbolVariant() const noexcept
Definition: componentinstance.h:74
const QString & getValue() const noexcept
Definition: componentinstance.h:69
ComponentAssemblyOptionList mAssemblyOptions
Assembly options including MPNs.
Definition: componentinstance.h:190
void serialize(SExpression &root) const
Serialize into librepcb::SExpression node.
Definition: componentinstance.cpp:277
const Uuid & getUuid() const noexcept
Definition: componentinstance.h:67
void registerDevice(BI_Device &device)
Definition: componentinstance.cpp:257
void removeFromCircuit()
Definition: componentinstance.cpp:197
Circuit & getCircuit() const noexcept
Definition: componentinstance.h:94
ComponentInstance(const ComponentInstance &other)=delete
void setAttributes(const AttributeList &attributes) noexcept
Definition: componentinstance.cpp:164
void registerSymbol(SI_Symbol &symbol)
Definition: componentinstance.cpp:216
const QHash< Uuid, SI_Symbol * > & getSymbols() const noexcept
Definition: componentinstance.h:95
const QPointer< const BI_Device > & getPrimaryDevice() const noexcept
Definition: componentinstance.h:70
void primaryDeviceChanged(const BI_Device *device)
const QMap< Uuid, ComponentSignalInstance * > & getSignals() const noexcept
Definition: componentinstance.h:77
CircuitIdentifier mName
The unique name of this component instance in the circuit (e.g. "R42")
Definition: componentinstance.h:171
const QStringList & getLocaleOrder() const noexcept
Definition: componentinstance.cpp:326
QMap< Uuid, ComponentSignalInstance * > mSignals
All signal instances (Key: component signal UUID)
Definition: componentinstance.h:187
bool mIsAddedToCircuit
Definition: componentinstance.h:162
void addToCircuit()
Definition: componentinstance.cpp:184
void setLockAssembly(bool lock) noexcept
Definition: componentinstance.h:131
QSet< Uuid > getUsedDeviceUuids() const noexcept
Definition: componentinstance.cpp:119
const ComponentSymbolVariant * mCompSymbVar
Pointer to the used symbol variant of mLibComponent.
Definition: componentinstance.h:181
const ComponentAssemblyOptionList & getAssemblyOptions() const noexcept
Definition: componentinstance.h:85
void unregisterDevice(BI_Device &device)
Definition: componentinstance.cpp:268
The ComponentSignalInstance class.
Definition: componentsignalinstance.h:49
The ComponentSymbolVariant class represents a symbol variant of a component.
Definition: componentsymbolvariant.h:53
The Part class.
Definition: part.h:46
The SExpression class.
Definition: sexpression.h:69
The SI_Symbol class.
Definition: si_symbol.h:54
The Uuid class is a replacement for QUuid to get UUID strings without {} braces.
Definition: uuid.h:58
Definition: occmodel.cpp:77
type_safe::constrained_type< QString, CircuitIdentifierConstraint, CircuitIdentifierVerifier > CircuitIdentifier
Definition: circuitidentifier.h:96