KiCad PCB EDA Suite
Loading...
Searching...
No Matches
SCH_REFERENCE Class Reference

A helper to define a symbol's reference designator in a schematic. More...

#include <sch_reference_list.h>

Public Member Functions

 SCH_REFERENCE ()
 
 SCH_REFERENCE (SCH_SYMBOL *aSymbol, const SCH_SHEET_PATH &aSheetPath)
 
SCH_SYMBOLGetSymbol () const
 
LIB_SYMBOLGetLibPart () const
 
const SCH_SHEET_PATHGetSheetPath () const
 
SCH_SHEET_PATHGetSheetPath ()
 
int GetUnit () const
 
void SetUnit (int aUnit)
 
bool IsMultiUnit () const
 
const wxString GetValue () const
 
void SetValue (const wxString &aValue)
 
const wxString GetFootprint () const
 
void SetFootprint (const wxString &aFP)
 
void SetSheetNumber (int aSheetNumber)
 
const wxString GetPath () const
 
const wxString GetFullPath () const
 
bool operator< (const SCH_REFERENCE &aRef) const
 
void Annotate ()
 Update the annotation of the symbol according the current object state.
 
bool AlwaysAnnotate () const
 Verify the reference should always be automatically annotated.
 
void Split ()
 Attempt to split the reference designator into a name (U) and number (1).
 
bool IsSplitNeeded ()
 Determine if this reference needs to be split or if it likely already has been.
 
void SetRef (const wxString &aReference)
 
wxString GetRef () const
 
void SetRefStr (const std::string &aReference)
 
const char * GetRefStr () const
 Return reference name with unit altogether.
 
wxString GetFullRef () const
 
wxString GetRefNumber () const
 
int CompareValue (const SCH_REFERENCE &item) const
 
int CompareRef (const SCH_REFERENCE &item) const
 
int CompareLibName (const SCH_REFERENCE &item) const
 
bool IsSameInstance (const SCH_REFERENCE &other) const
 Return whether this reference refers to the same symbol instance (symbol and sheet) as another.
 
bool IsUnitsLocked ()
 

Private Attributes

wxString m_ref
 Symbol reference prefix, without number (for IC1, this is IC) )
 
SCH_SYMBOLm_rootSymbol
 The symbol associated the reference object.
 
VECTOR2I m_symbolPos
 The physical position of the symbol in schematic used to annotate by X or Y position.
 
int m_unit
 The unit number for symbol with multiple parts per package.
 
wxString m_value
 The symbol value.
 
wxString m_footprint
 The footprint assigned.
 
SCH_SHEET_PATH m_sheetPath
 The sheet path for this reference.
 
bool m_isNew
 True if not yet annotated.
 
int m_sheetNum
 The sheet number for the reference.
 
KIID m_symbolUuid
 UUID of the symbol.
 
int m_numRef
 The numeric part of the reference designator.
 
wxString m_numRefStr
 The numeric part in original string form (may have leading zeroes)
 
int m_flag
 

Friends

class SCH_REFERENCE_LIST
 

Detailed Description

A helper to define a symbol's reference designator in a schematic.

This helper is required in a complex hierarchy because a symbol can be used more than once and its reference depends on the sheet path. This class is used to flatten the schematic hierarchy for annotation, net list generation, and bill of material generation.

Definition at line 76 of file sch_reference_list.h.

Constructor & Destructor Documentation

◆ SCH_REFERENCE() [1/2]

SCH_REFERENCE::SCH_REFERENCE ( )
inline

Definition at line 79 of file sch_reference_list.h.

References m_flag, m_isNew, m_numRef, m_rootSymbol, m_sheetNum, and m_unit.

◆ SCH_REFERENCE() [2/2]

Member Function Documentation

◆ AlwaysAnnotate()

bool SCH_REFERENCE::AlwaysAnnotate ( ) const

Verify the reference should always be automatically annotated.

Returns
true if the symbol reference should always be automatically annotated otherwise false.

Definition at line 842 of file sch_reference_list.cpp.

References SCH_SYMBOL::GetLibSymbolRef(), SCH_SYMBOL::GetRef(), m_rootSymbol, and m_sheetPath.

Referenced by SCH_DRAWING_TOOLS::PlaceSymbol().

◆ Annotate()

void SCH_REFERENCE::Annotate ( )

Update the annotation of the symbol according the current object state.

Definition at line 829 of file sch_reference_list.cpp.

References From_UTF8(), GetRef(), GetRefNumber(), m_numRef, m_ref, m_rootSymbol, m_sheetPath, m_unit, SCH_SYMBOL::SetRef(), SCH_ITEM::SetUnit(), SCH_SYMBOL::SetUnitSelection(), and TO_UTF8.

Referenced by SCH_EDIT_FRAME::AnnotateSymbols().

◆ CompareLibName()

int SCH_REFERENCE::CompareLibName ( const SCH_REFERENCE item) const
inline

◆ CompareRef()

int SCH_REFERENCE::CompareRef ( const SCH_REFERENCE item) const
inline

◆ CompareValue()

int SCH_REFERENCE::CompareValue ( const SCH_REFERENCE item) const
inline

◆ GetFootprint()

const wxString SCH_REFERENCE::GetFootprint ( ) const
inline

◆ GetFullPath()

const wxString SCH_REFERENCE::GetFullPath ( ) const
inline
Returns
the full patb of the symbol item

Definition at line 123 of file sch_reference_list.h.

References KIID::AsString(), m_sheetPath, m_symbolUuid, and SCH_SHEET_PATH::PathAsString().

Referenced by operator<().

◆ GetFullRef()

wxString SCH_REFERENCE::GetFullRef ( ) const
inline

◆ GetLibPart()

LIB_SYMBOL * SCH_REFERENCE::GetLibPart ( ) const
inline

◆ GetPath()

const wxString SCH_REFERENCE::GetPath ( ) const
inline
Returns
the sheet path containing the symbol item

Definition at line 115 of file sch_reference_list.h.

References m_sheetPath, and SCH_SHEET_PATH::PathAsString().

◆ GetRef()

◆ GetRefNumber()

◆ GetRefStr()

const char * SCH_REFERENCE::GetRefStr ( ) const
inline

Return reference name with unit altogether.

Definition at line 166 of file sch_reference_list.h.

References m_ref.

Referenced by IsSplitNeeded(), and Split().

◆ GetSheetPath() [1/2]

SCH_SHEET_PATH & SCH_REFERENCE::GetSheetPath ( )
inline

Definition at line 98 of file sch_reference_list.h.

References m_sheetPath.

◆ GetSheetPath() [2/2]

◆ GetSymbol()

◆ GetUnit()

int SCH_REFERENCE::GetUnit ( ) const
inline

◆ GetValue()

const wxString SCH_REFERENCE::GetValue ( ) const
inline

Definition at line 104 of file sch_reference_list.h.

References m_value.

Referenced by BACK_ANNOTATE::applyChangelist().

◆ IsMultiUnit()

bool SCH_REFERENCE::IsMultiUnit ( ) const
inline

◆ IsSameInstance()

bool SCH_REFERENCE::IsSameInstance ( const SCH_REFERENCE other) const
inline

Return whether this reference refers to the same symbol instance (symbol and sheet) as another.

Definition at line 217 of file sch_reference_list.h.

References GetSheetPath(), GetSymbol(), and SCH_SHEET_PATH::Path().

Referenced by SCH_REFERENCE_LIST::Annotate().

◆ IsSplitNeeded()

bool SCH_REFERENCE::IsSplitNeeded ( )

Determine if this reference needs to be split or if it likely already has been.

Returns
true if this reference hasn't been split yet

Definition at line 900 of file sch_reference_list.cpp.

References GetRefStr().

Referenced by findSymbolsAndPins(), SCH_EDITOR_CONTROL::IncrementAnnotations(), and sheetContainsOnlyWantedItems().

◆ IsUnitsLocked()

bool SCH_REFERENCE::IsUnitsLocked ( )
inline

Definition at line 226 of file sch_reference_list.h.

References GetLibPart(), and LIB_SYMBOL::UnitsLocked().

◆ operator<()

bool SCH_REFERENCE::operator< ( const SCH_REFERENCE aRef) const
inline

Definition at line 131 of file sch_reference_list.h.

References GetFullPath().

◆ SetFootprint()

void SCH_REFERENCE::SetFootprint ( const wxString &  aFP)
inline

Definition at line 108 of file sch_reference_list.h.

References m_footprint.

◆ SetRef()

void SCH_REFERENCE::SetRef ( const wxString &  aReference)
inline

Definition at line 162 of file sch_reference_list.h.

References m_ref.

Referenced by SCH_EDITOR_CONTROL::IncrementAnnotations(), and SCH_REFERENCE().

◆ SetRefStr()

void SCH_REFERENCE::SetRefStr ( const std::string &  aReference)
inline

Definition at line 165 of file sch_reference_list.h.

References m_ref.

Referenced by Split().

◆ SetSheetNumber()

void SCH_REFERENCE::SetSheetNumber ( int  aSheetNumber)
inline

◆ SetUnit()

void SCH_REFERENCE::SetUnit ( int  aUnit)
inline

Definition at line 101 of file sch_reference_list.h.

References m_unit.

◆ SetValue()

void SCH_REFERENCE::SetValue ( const wxString &  aValue)
inline

Definition at line 105 of file sch_reference_list.h.

References m_value.

◆ Split()

void SCH_REFERENCE::Split ( )

Attempt to split the reference designator into a name (U) and number (1).

If the last character is '?' or not a digit, the reference is tagged as not annotated. For symbols with multiple parts per package that are not already annotated, keeps the unit number the same. E.g. U?A or U?B

Definition at line 852 of file sch_reference_list.cpp.

References GetRefStr(), m_isNew, m_numRef, m_numRefStr, and SetRefStr().

Referenced by SCH_REFERENCE_LIST::Annotate(), findSymbolsAndPins(), DIALOG_SYMBOL_FIELDS_TABLE::getSymbolReferences(), SCH_EDITOR_CONTROL::IncrementAnnotations(), and sheetContainsOnlyWantedItems().

Friends And Related Function Documentation

◆ SCH_REFERENCE_LIST

friend class SCH_REFERENCE_LIST
friend

Definition at line 235 of file sch_reference_list.h.

Member Data Documentation

◆ m_flag

int SCH_REFERENCE::m_flag
private

Definition at line 252 of file sch_reference_list.h.

Referenced by SCH_REFERENCE().

◆ m_footprint

wxString SCH_REFERENCE::m_footprint
private

The footprint assigned.

Definition at line 245 of file sch_reference_list.h.

Referenced by GetFootprint(), SCH_REFERENCE(), and SetFootprint().

◆ m_isNew

bool SCH_REFERENCE::m_isNew
private

True if not yet annotated.

Definition at line 247 of file sch_reference_list.h.

Referenced by SCH_REFERENCE_LIST::Annotate(), SCH_REFERENCE_LIST::ReannotateByOptions(), SCH_REFERENCE(), and Split().

◆ m_numRef

int SCH_REFERENCE::m_numRef
private

The numeric part of the reference designator.

Definition at line 250 of file sch_reference_list.h.

Referenced by Annotate(), SCH_REFERENCE_LIST::CheckAnnotation(), GetFullRef(), GetRefNumber(), SCH_REFERENCE_LIST::GetUnitsMatchingRef(), SCH_REFERENCE(), and Split().

◆ m_numRefStr

wxString SCH_REFERENCE::m_numRefStr
private

The numeric part in original string form (may have leading zeroes)

Definition at line 251 of file sch_reference_list.h.

Referenced by GetFullRef(), and Split().

◆ m_ref

wxString SCH_REFERENCE::m_ref
private

Symbol reference prefix, without number (for IC1, this is IC) )

Definition at line 238 of file sch_reference_list.h.

Referenced by Annotate(), CompareRef(), GetRef(), GetRefStr(), SetRef(), and SetRefStr().

◆ m_rootSymbol

SCH_SYMBOL* SCH_REFERENCE::m_rootSymbol
private

The symbol associated the reference object.

Definition at line 239 of file sch_reference_list.h.

Referenced by AlwaysAnnotate(), Annotate(), CompareLibName(), GetLibPart(), GetSymbol(), and SCH_REFERENCE().

◆ m_sheetNum

int SCH_REFERENCE::m_sheetNum
private

◆ m_sheetPath

SCH_SHEET_PATH SCH_REFERENCE::m_sheetPath
private

The sheet path for this reference.

Definition at line 246 of file sch_reference_list.h.

Referenced by AlwaysAnnotate(), Annotate(), GetFullPath(), GetPath(), GetSheetPath(), SCH_REFERENCE(), and SCH_REFERENCE_LIST::sortByTimeStamp().

◆ m_symbolPos

VECTOR2I SCH_REFERENCE::m_symbolPos
private

The physical position of the symbol in schematic used to annotate by X or Y position.

Definition at line 240 of file sch_reference_list.h.

Referenced by SCH_REFERENCE(), SCH_REFERENCE_LIST::sortByRefAndValue(), SCH_REFERENCE_LIST::sortByXPosition(), and SCH_REFERENCE_LIST::sortByYPosition().

◆ m_symbolUuid

◆ m_unit

◆ m_value

wxString SCH_REFERENCE::m_value
private

The symbol value.

Definition at line 244 of file sch_reference_list.h.

Referenced by SCH_REFERENCE_LIST::CheckAnnotation(), CompareValue(), GetValue(), SCH_REFERENCE(), and SetValue().


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