KiCad PCB EDA Suite
|
A lightweight representation of a component class. More...
#include <component_class.h>
Public Types | |
enum class | USAGE { STATIC , DYNAMIC , STATIC_AND_DYNAMIC , EFFECTIVE } |
The assignment context in which this component class is used. More... | |
Public Member Functions | |
COMPONENT_CLASS (const wxString &name, const USAGE aUsageContext) | |
Construct a new component class. | |
wxString | GetHumanReadableName () const |
Gets the consolidated name of this component class (which may be an aggregate). | |
const wxString & | GetName () const |
Fetches the full name of this component class. | |
void | AddConstituentClass (COMPONENT_CLASS *componentClass) |
Adds a constituent component class to an effective component class. | |
const COMPONENT_CLASS * | GetConstituentClass (const wxString &className) const |
Returns a named constituent class of this component class, or nullptr if not found. | |
bool | ContainsClassName (const wxString &className) const |
Determines if this (effective) component class contains a specific constituent class. | |
bool | IsEmpty () const |
Determines if this (effective) component class is empty (i.e. no classes defined) | |
const std::vector< COMPONENT_CLASS * > & | GetConstituentClasses () const |
Fetches a vector of the constituent classes for this (effective) class. | |
USAGE | GetUsageContext () const |
Gets the assignment context in which this component class is being used. | |
void | SetUsageContext (const USAGE aUsageContext) |
Sets the assignment context in which this component class is being used. | |
bool | operator== (const COMPONENT_CLASS &aComponent) const |
Tests two component classes for equality based on full class name. | |
bool | operator!= (const COMPONENT_CLASS &aComponent) const |
Tests two component classes for inequality based on full class name. | |
Private Attributes | |
wxString | m_name |
The full name of the component class. | |
std::vector< COMPONENT_CLASS * > | m_constituentClasses |
The COMPONENT_CLASS objects contributing to this complete component class. | |
USAGE | m_usageContext |
The assignment context in which this component class is being used. | |
A lightweight representation of a component class.
The membership within m_consituentClasses allows determination of the type of class this is:
m_constituentClasses.size() == 0: This is a null class (no assigment). m_name is empty. m_constituentClasses.size() == 1: This is an atomic class. The constituent class pointer refers to itself. m_name contains the name of the atomic class m_constituentClasses.size() > 1: This is a composite class. The constituent class pointers refer to all atomic members. m_name contains a comma-delimited list of all atomic member class names.
Definition at line 39 of file component_class.h.
|
strong |
The assignment context in which this component class is used.
Enumerator | |
---|---|
STATIC | |
DYNAMIC | |
STATIC_AND_DYNAMIC | |
EFFECTIVE |
Definition at line 43 of file component_class.h.
|
inlineexplicit |
Construct a new component class.
Definition at line 52 of file component_class.h.
void COMPONENT_CLASS::AddConstituentClass | ( | COMPONENT_CLASS * | componentClass | ) |
Adds a constituent component class to an effective component class.
Definition at line 25 of file component_class.cpp.
References m_constituentClasses.
bool COMPONENT_CLASS::ContainsClassName | ( | const wxString & | className | ) | const |
Determines if this (effective) component class contains a specific constituent class.
Definition at line 46 of file component_class.cpp.
References GetConstituentClass().
Referenced by PCBEXPR_COMPONENT_CLASS_VALUE::EqualTo(), hasComponentClassFunc(), PCBEXPR_COMPONENT_CLASS_VALUE::NotEqualTo(), and testFootprintSelector().
const COMPONENT_CLASS * COMPONENT_CLASS::GetConstituentClass | ( | const wxString & | className | ) | const |
Returns a named constituent class of this component class, or nullptr if not found.
Definition at line 31 of file component_class.cpp.
References GetName(), and m_constituentClasses.
Referenced by ContainsClassName().
|
inline |
Fetches a vector of the constituent classes for this (effective) class.
Definition at line 78 of file component_class.h.
References m_constituentClasses.
Referenced by PCB_IO_KICAD_SEXPR::format(), COMPONENT_CLASS_MANAGER::GetCombinedComponentClass(), COMPONENT_CLASS_MANAGER::GetEffectiveStaticComponentClass(), COMPONENT_CLASS_MANAGER::getOrCreateEffectiveClass(), and MULTICHANNEL_TOOL::QuerySheetsAndComponentClasses().
wxString COMPONENT_CLASS::GetHumanReadableName | ( | ) | const |
Gets the consolidated name of this component class (which may be an aggregate).
This is intended for display to users (e.g. in infobars or messages). WARNING: Do not use this to compare equivalence, or to export to other tools)
Definition at line 52 of file component_class.cpp.
References _, GetName(), m_constituentClasses, m_name, and name.
|
inline |
Fetches the full name of this component class.
Definition at line 63 of file component_class.h.
References m_name.
Referenced by PCBEXPR_COMPONENT_CLASS_VALUE::EqualTo(), GetConstituentClass(), GetHumanReadableName(), PCBEXPR_COMPONENT_CLASS_VALUE::NotEqualTo(), operator==(), and BOARD_NETLIST_UPDATER::updateComponentClass().
|
inline |
Gets the assignment context in which this component class is being used.
Definition at line 84 of file component_class.h.
References m_usageContext.
Referenced by COMPONENT_CLASS_MANAGER::FinishNetlistUpdate(), COMPONENT_CLASS_MANAGER::getOrCreateConstituentClass(), and COMPONENT_CLASS_MANAGER::SyncDynamicComponentClassAssignments().
bool COMPONENT_CLASS::IsEmpty | ( | ) | const |
Determines if this (effective) component class is empty (i.e. no classes defined)
Definition at line 85 of file component_class.cpp.
References m_constituentClasses.
bool COMPONENT_CLASS::operator!= | ( | const COMPONENT_CLASS & | aComponent | ) | const |
Tests two component classes for inequality based on full class name.
Definition at line 97 of file component_class.cpp.
bool COMPONENT_CLASS::operator== | ( | const COMPONENT_CLASS & | aComponent | ) | const |
Tests two component classes for equality based on full class name.
Definition at line 91 of file component_class.cpp.
References GetName().
|
inline |
Sets the assignment context in which this component class is being used.
Definition at line 87 of file component_class.h.
References m_usageContext.
Referenced by COMPONENT_CLASS_MANAGER::FinishNetlistUpdate(), COMPONENT_CLASS_MANAGER::getOrCreateConstituentClass(), and COMPONENT_CLASS_MANAGER::SyncDynamicComponentClassAssignments().
|
private |
The COMPONENT_CLASS objects contributing to this complete component class.
Definition at line 100 of file component_class.h.
Referenced by AddConstituentClass(), GetConstituentClass(), GetConstituentClasses(), GetHumanReadableName(), and IsEmpty().
|
private |
The full name of the component class.
Definition at line 97 of file component_class.h.
Referenced by GetHumanReadableName(), and GetName().
|
private |
The assignment context in which this component class is being used.
Definition at line 103 of file component_class.h.
Referenced by GetUsageContext(), and SetUsageContext().