LibrePCB Developers Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Circuit Class Referencefinal

The Circuit class represents all electrical connections in a project (drawed in the schematics) More...

#include <circuit.h>

+ Inheritance diagram for Circuit:
+ Collaboration diagram for Circuit:

Signals

void netClassAdded (NetClass &netclass)
 
void netClassRemoved (NetClass &netclass)
 
void netSignalAdded (NetSignal &netsignal)
 
void netSignalRemoved (NetSignal &netsignal)
 
void componentAdded (ComponentInstance &cmp)
 
void componentRemoved (ComponentInstance &cmp)
 

Public Member Functions

 Circuit ()=delete
 
 Circuit (const Circuit &other)=delete
 
 Circuit (Project &project, bool restore, bool readOnly, bool create)
 
 ~Circuit () noexcept
 
ProjectgetProject () const noexcept
 
const QMap< Uuid, NetClass * > & getNetClasses () const noexcept
 
NetClassgetNetClassByUuid (const Uuid &uuid) const noexcept
 
NetClassgetNetClassByName (const ElementName &name) const noexcept
 
void addNetClass (NetClass &netclass)
 
void removeNetClass (NetClass &netclass)
 
void setNetClassName (NetClass &netclass, const ElementName &newName)
 
QString generateAutoNetSignalName () const noexcept
 
const QMap< Uuid, NetSignal * > & getNetSignals () const noexcept
 
NetSignalgetNetSignalByUuid (const Uuid &uuid) const noexcept
 
NetSignalgetNetSignalByName (const QString &name) const noexcept
 
NetSignalgetNetSignalWithMostElements () const noexcept
 
void addNetSignal (NetSignal &netsignal)
 
void removeNetSignal (NetSignal &netsignal)
 
void setNetSignalName (NetSignal &netsignal, const CircuitIdentifier &newName, bool isAutoName)
 
void setHighlightedNetSignal (NetSignal *signal) noexcept
 
QString generateAutoComponentInstanceName (const library::ComponentPrefix &cmpPrefix) const noexcept
 
const QMap< Uuid,
ComponentInstance * > & 
getComponentInstances () const noexcept
 
ComponentInstancegetComponentInstanceByUuid (const Uuid &uuid) const noexcept
 
ComponentInstancegetComponentInstanceByName (const QString &name) const noexcept
 
void addComponentInstance (ComponentInstance &cmp)
 
void removeComponentInstance (ComponentInstance &cmp)
 
void setComponentInstanceName (ComponentInstance &cmp, const CircuitIdentifier &newName)
 
bool save (bool toOriginal, QStringList &errors) noexcept
 
Circuitoperator= (const Circuit &rhs)=delete
 
bool operator== (const Circuit &rhs) noexcept
 
bool operator!= (const Circuit &rhs) noexcept
 
- Public Member Functions inherited from SerializableObject
 SerializableObject () noexcept
 
virtual ~SerializableObject () noexcept
 
SExpression serializeToDomElement (const QString &name) const
 Serialize the object to a new S-Expression node. More...
 

Private Member Functions

void serialize (SExpression &root) const override
 Serialize the object into an existing S-Expression node. More...
 

Private Attributes

ProjectmProject
 A reference to the Project object (from the ctor) More...
 
FilePath mFilepath
 
SmartSExprFilemFile
 
QMap< Uuid, NetClass * > mNetClasses
 
QMap< Uuid, NetSignal * > mNetSignals
 
QMap< Uuid, ComponentInstance * > mComponentInstances
 

Additional Inherited Members

- Static Public Member Functions inherited from SerializableObject
template<typename T >
static void serializeObjectContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainer (SExpression &root, const T &container, const QString &itemName)
 
template<typename T >
static void serializePointerContainerUuidSorted (SExpression &root, const T &container, const QString &itemName)
 

Detailed Description

The Circuit class represents all electrical connections in a project (drawed in the schematics)

Each #project#Project object contains exactly one Circuit object which contains the whole electrical components and connections. They are created with the schematic editor and used by the board editor. The whole circuit is saved in the file "circuit.lp" in the project's "circuit" directory.

Each Circuit object contains:

Author
ubruhin
Date
2014-07-03

Constructor & Destructor Documentation

Circuit ( )
delete
Circuit ( const Circuit other)
delete
Circuit ( Project project,
bool  restore,
bool  readOnly,
bool  create 
)

+ Here is the call graph for this function:

~Circuit ( )
noexcept

+ Here is the call graph for this function:

Member Function Documentation

Project& getProject ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

const QMap<Uuid, NetClass*>& getNetClasses ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

NetClass * getNetClassByUuid ( const Uuid uuid) const
noexcept

+ Here is the caller graph for this function:

NetClass * getNetClassByName ( const ElementName name) const
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void addNetClass ( NetClass netclass)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeNetClass ( NetClass netclass)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setNetClassName ( NetClass netclass,
const ElementName newName 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

QString generateAutoNetSignalName ( ) const
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const QMap<Uuid, NetSignal*>& getNetSignals ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

NetSignal * getNetSignalByUuid ( const Uuid uuid) const
noexcept

+ Here is the caller graph for this function:

NetSignal * getNetSignalByName ( const QString &  name) const
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

NetSignal * getNetSignalWithMostElements ( ) const
noexcept

+ Here is the call graph for this function:

void addNetSignal ( NetSignal netsignal)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeNetSignal ( NetSignal netsignal)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setNetSignalName ( NetSignal netsignal,
const CircuitIdentifier newName,
bool  isAutoName 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setHighlightedNetSignal ( NetSignal signal)
noexcept

+ Here is the call graph for this function:

QString generateAutoComponentInstanceName ( const library::ComponentPrefix cmpPrefix) const
noexcept

+ Here is the caller graph for this function:

const QMap<Uuid, ComponentInstance*>& getComponentInstances ( ) const
inlinenoexcept

+ Here is the caller graph for this function:

ComponentInstance * getComponentInstanceByUuid ( const Uuid uuid) const
noexcept

+ Here is the caller graph for this function:

ComponentInstance * getComponentInstanceByName ( const QString &  name) const
noexcept

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void addComponentInstance ( ComponentInstance cmp)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void removeComponentInstance ( ComponentInstance cmp)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void setComponentInstanceName ( ComponentInstance cmp,
const CircuitIdentifier newName 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool save ( bool  toOriginal,
QStringList &  errors 
)
noexcept

+ Here is the call graph for this function:

Circuit& operator= ( const Circuit rhs)
delete
bool operator== ( const Circuit rhs)
inlinenoexcept
bool operator!= ( const Circuit rhs)
inlinenoexcept
void netClassAdded ( NetClass netclass)
signal

+ Here is the caller graph for this function:

void netClassRemoved ( NetClass netclass)
signal

+ Here is the caller graph for this function:

void netSignalAdded ( NetSignal netsignal)
signal

+ Here is the caller graph for this function:

void netSignalRemoved ( NetSignal netsignal)
signal

+ Here is the caller graph for this function:

void componentAdded ( ComponentInstance cmp)
signal

+ Here is the caller graph for this function:

void componentRemoved ( ComponentInstance cmp)
signal

+ Here is the caller graph for this function:

void serialize ( SExpression root) const
overrideprivatevirtual

Serialize the object into an existing S-Expression node.

This method inserts/appends all attributes and childs of the object to an existing S-Expression node. The content which already exists in the given S-Expression node will not be removed.

Note
The generated S-Expression node has always the format of the application's major version (it's not possible to generate DOMs of older versions).
Parameters
rootThe target DOM root node
Exceptions
ExceptionThis method throws an exception if an error occurs.

Implements SerializableObject.

+ Here is the call graph for this function:

Member Data Documentation

Project& mProject
private

A reference to the Project object (from the ctor)

FilePath mFilepath
private
SmartSExprFile* mFile
private
QMap<Uuid, NetClass*> mNetClasses
private
QMap<Uuid, NetSignal*> mNetSignals
private
QMap<Uuid, ComponentInstance*> mComponentInstances
private

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