KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
COMPONENT_CLASS Class Reference

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_CLASSGetConstituentClass (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.
 

Detailed Description

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.

Member Enumeration Documentation

◆ USAGE

enum class COMPONENT_CLASS::USAGE
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.

Constructor & Destructor Documentation

◆ COMPONENT_CLASS()

COMPONENT_CLASS::COMPONENT_CLASS ( const wxString &  name,
const USAGE  aUsageContext 
)
inlineexplicit

Construct a new component class.

Definition at line 52 of file component_class.h.

Member Function Documentation

◆ AddConstituentClass()

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.

◆ ContainsClassName()

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().

◆ GetConstituentClass()

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().

◆ GetConstituentClasses()

const std::vector< COMPONENT_CLASS * > & COMPONENT_CLASS::GetConstituentClasses ( ) const
inline

◆ GetHumanReadableName()

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.

◆ GetName()

const wxString & COMPONENT_CLASS::GetName ( ) const
inline

◆ GetUsageContext()

USAGE COMPONENT_CLASS::GetUsageContext ( ) const
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().

◆ IsEmpty()

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.

◆ operator!=()

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.

◆ operator==()

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().

◆ SetUsageContext()

void COMPONENT_CLASS::SetUsageContext ( const USAGE  aUsageContext)
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().

Member Data Documentation

◆ m_constituentClasses

std::vector<COMPONENT_CLASS*> COMPONENT_CLASS::m_constituentClasses
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().

◆ m_name

wxString COMPONENT_CLASS::m_name
private

The full name of the component class.

Definition at line 97 of file component_class.h.

Referenced by GetHumanReadableName(), and GetName().

◆ m_usageContext

USAGE COMPONENT_CLASS::m_usageContext
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().


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