LibrePCB Developers Documentation
ComponentInstance Class Reference

The ComponentInstance class. More...

#include <componentinstance.h>

Inherits QObject.

+ Collaboration diagram for ComponentInstance:

Signals

void attributesChanged ()
 
void primaryDeviceChanged (const BI_Device *device)
 

Public Member Functions

 ComponentInstance ()=delete
 
 ComponentInstance (const ComponentInstance &other)=delete
 
 ComponentInstance (Circuit &circuit, const Uuid &uuid, const Component &cmp, const Uuid &symbVar, const CircuitIdentifier &name)
 
 ~ComponentInstance () noexcept
 
const UuidgetUuid () const noexcept
 
const CircuitIdentifiergetName () const noexcept
 
const QString & getValue () const noexcept
 
const QPointer< const BI_Device > & getPrimaryDevice () const noexcept
 
const ComponentgetLibComponent () const noexcept
 
const ComponentSymbolVariantgetSymbolVariant () const noexcept
 
const QMap< Uuid, ComponentSignalInstance * > & getSignals () const noexcept
 
ComponentSignalInstancegetSignalInstance (const Uuid &signalUuid) const noexcept
 
const AttributeListgetAttributes () const noexcept
 
const ComponentAssemblyOptionListgetAssemblyOptions () const noexcept
 
QSet< UuidgetCompatibleDevices () const noexcept
 
QVector< std::shared_ptr< const Part > > getParts (const tl::optional< Uuid > &assemblyVariant) const noexcept
 
bool getLockAssembly () const noexcept
 
CircuitgetCircuit () const noexcept
 
const QHash< Uuid, SI_Symbol * > & getSymbols () const noexcept
 
const QList< BI_Device * > & getDevices () const noexcept
 
QSet< UuidgetUsedDeviceUuids () const noexcept
 
int getRegisteredElementsCount () const noexcept
 
bool isUsed () const noexcept
 
bool isAddedToCircuit () const noexcept
 
void setName (const CircuitIdentifier &name) noexcept
 Set the name of this component instance in the circuit. More...
 
void setValue (const QString &value) noexcept
 Set the value of this component instance in the circuit. More...
 
void setAttributes (const AttributeList &attributes) noexcept
 
void setAssemblyOptions (const ComponentAssemblyOptionList &options) noexcept
 
void setLockAssembly (bool lock) noexcept
 
void addToCircuit ()
 
void removeFromCircuit ()
 
void registerSymbol (SI_Symbol &symbol)
 
void unregisterSymbol (SI_Symbol &symbol)
 
void registerDevice (BI_Device &device)
 
void unregisterDevice (BI_Device &device)
 
void serialize (SExpression &root) const
 Serialize into librepcb::SExpression node. More...
 
ComponentInstanceoperator= (const ComponentInstance &rhs)=delete
 

Private Member Functions

void updatePrimaryDevice () noexcept
 
bool checkAttributesValidity () const noexcept
 
const QStringList & getLocaleOrder () const noexcept
 

Private Attributes

CircuitmCircuit
 
bool mIsAddedToCircuit
 
Uuid mUuid
 The unique UUID of this component instance in the circuit. More...
 
CircuitIdentifier mName
 The unique name of this component instance in the circuit (e.g. "R42") More...
 
QString mValue
 The value of this component instance in the circuit (e.g. the resistance of a resistor) More...
 
const ComponentmLibComponent
 Reference to the component in the project's library. More...
 
const ComponentSymbolVariantmCompSymbVar
 Pointer to the used symbol variant of mLibComponent. More...
 
QScopedPointer< AttributeListmAttributes
 All attributes of this component. More...
 
QMap< Uuid, ComponentSignalInstance * > mSignals
 All signal instances (Key: component signal UUID) More...
 
ComponentAssemblyOptionList mAssemblyOptions
 Assembly options including MPNs. More...
 
bool mLockAssembly
 Whether mAssemblyOptions can be modified from the board editor or not. More...
 
QHash< Uuid, SI_Symbol * > mRegisteredSymbols
 All registered symbols. More...
 
QList< BI_Device * > mRegisteredDevices
 All registered devices (of all boards) More...
 
QPointer< const BI_DevicemPrimaryDevice
 

Detailed Description

The ComponentInstance class.

Constructor & Destructor Documentation

◆ ComponentInstance() [1/3]

ComponentInstance ( )
delete

◆ ComponentInstance() [2/3]

ComponentInstance ( const ComponentInstance other)
delete

◆ ComponentInstance() [3/3]

ComponentInstance ( Circuit circuit,
const Uuid uuid,
const Component cmp,
const Uuid symbVar,
const CircuitIdentifier name 
)
explicit
+ Here is the call graph for this function:

◆ ~ComponentInstance()

~ComponentInstance ( )
noexcept
+ Here is the call graph for this function:

Member Function Documentation

◆ getUuid()

const Uuid & getUuid ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getName()

const CircuitIdentifier & getName ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getValue()

const QString & getValue ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getPrimaryDevice()

const QPointer< const BI_Device > & getPrimaryDevice ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getLibComponent()

const Component & getLibComponent ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSymbolVariant()

const ComponentSymbolVariant & getSymbolVariant ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSignals()

const QMap< Uuid, ComponentSignalInstance * > & getSignals ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSignalInstance()

ComponentSignalInstance * getSignalInstance ( const Uuid signalUuid) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getAttributes()

const AttributeList & getAttributes ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getAssemblyOptions()

const ComponentAssemblyOptionList & getAssemblyOptions ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getCompatibleDevices()

QSet< Uuid > getCompatibleDevices ( ) const
noexcept
+ Here is the caller graph for this function:

◆ getParts()

QVector< std::shared_ptr< const Part > > getParts ( const tl::optional< Uuid > &  assemblyVariant) const
noexcept
+ Here is the caller graph for this function:

◆ getLockAssembly()

bool getLockAssembly ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getCircuit()

Circuit & getCircuit ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getSymbols()

const QHash< Uuid, SI_Symbol * > & getSymbols ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getDevices()

const QList< BI_Device * > & getDevices ( ) const
inlinenoexcept
+ Here is the caller graph for this function:

◆ getUsedDeviceUuids()

QSet< Uuid > getUsedDeviceUuids ( ) const
noexcept
+ Here is the call graph for this function:

◆ getRegisteredElementsCount()

int getRegisteredElementsCount ( ) const
noexcept
+ Here is the caller graph for this function:

◆ isUsed()

bool isUsed ( ) const
noexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isAddedToCircuit()

bool isAddedToCircuit ( ) const
inlinenoexcept

◆ setName()

void setName ( const CircuitIdentifier name)
noexcept

Set the name of this component instance in the circuit.

Warning
You have to check if there is no other component with the same name in the whole circuit! This method will not check if the name is unique. The best way to do this is to call librepcb::Circuit::setComponentInstanceName().
Parameters
nameThe new name of this component in the circuit
+ Here is the caller graph for this function:

◆ setValue()

void setValue ( const QString &  value)
noexcept

Set the value of this component instance in the circuit.

Parameters
valueThe new value
+ Here is the caller graph for this function:

◆ setAttributes()

void setAttributes ( const AttributeList attributes)
noexcept
+ Here is the caller graph for this function:

◆ setAssemblyOptions()

void setAssemblyOptions ( const ComponentAssemblyOptionList options)
noexcept
+ Here is the caller graph for this function:

◆ setLockAssembly()

void setLockAssembly ( bool  lock)
inlinenoexcept
+ Here is the caller graph for this function:

◆ addToCircuit()

void addToCircuit ( )
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeFromCircuit()

void removeFromCircuit ( )
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerSymbol()

void registerSymbol ( SI_Symbol symbol)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unregisterSymbol()

void unregisterSymbol ( SI_Symbol symbol)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ registerDevice()

void registerDevice ( BI_Device device)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ unregisterDevice()

void unregisterDevice ( BI_Device device)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ serialize()

void serialize ( SExpression root) const

Serialize into librepcb::SExpression node.

Parameters
rootRoot node to serialize into.
+ Here is the call graph for this function:

◆ operator=()

ComponentInstance & operator= ( const ComponentInstance rhs)
delete

◆ attributesChanged

void attributesChanged ( )
signal
+ Here is the caller graph for this function:

◆ primaryDeviceChanged

void primaryDeviceChanged ( const BI_Device device)
signal
+ Here is the caller graph for this function:

◆ updatePrimaryDevice()

void updatePrimaryDevice ( )
privatenoexcept
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkAttributesValidity()

bool checkAttributesValidity ( ) const
privatenoexcept
+ Here is the caller graph for this function:

◆ getLocaleOrder()

const QStringList & getLocaleOrder ( ) const
privatenoexcept
+ Here is the call graph for this function:

Member Data Documentation

◆ mCircuit

Circuit& mCircuit
private

◆ mIsAddedToCircuit

bool mIsAddedToCircuit
private

◆ mUuid

Uuid mUuid
private

The unique UUID of this component instance in the circuit.

◆ mName

CircuitIdentifier mName
private

The unique name of this component instance in the circuit (e.g. "R42")

◆ mValue

QString mValue
private

The value of this component instance in the circuit (e.g. the resistance of a resistor)

◆ mLibComponent

const Component& mLibComponent
private

Reference to the component in the project's library.

◆ mCompSymbVar

const ComponentSymbolVariant* mCompSymbVar
private

Pointer to the used symbol variant of mLibComponent.

◆ mAttributes

QScopedPointer<AttributeList> mAttributes
private

All attributes of this component.

◆ mSignals

QMap<Uuid, ComponentSignalInstance*> mSignals
private

All signal instances (Key: component signal UUID)

◆ mAssemblyOptions

ComponentAssemblyOptionList mAssemblyOptions
private

Assembly options including MPNs.

◆ mLockAssembly

bool mLockAssembly
private

Whether mAssemblyOptions can be modified from the board editor or not.

◆ mRegisteredSymbols

QHash<Uuid, SI_Symbol*> mRegisteredSymbols
private

All registered symbols.

See also
registerSymbol(), unregisterSymbol()

◆ mRegisteredDevices

QList<BI_Device*> mRegisteredDevices
private

All registered devices (of all boards)

See also
registerDevice(), unregisterDevice()

◆ mPrimaryDevice

QPointer<const BI_Device> mPrimaryDevice
private

The documentation for this class was generated from the following files: