![]() |
KiCad PCB EDA Suite
|
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used more than once and its reference designator is dependent on the sheet path for the same symbol. More...
#include <sch_reference_list.h>
Public Member Functions | |
SCH_REFERENCE_LIST () | |
SCH_REFERENCE & | operator[] (int aIndex) |
void | Clear () |
unsigned | GetCount () const |
SCH_REFERENCE & | GetItem (int aIdx) |
void | AddItem (SCH_REFERENCE &aItem) |
void | RemoveItem (unsigned int aIndex) |
Remove an item from the list of references. More... | |
void | SplitReferences () |
Attempt to split all reference designators into a name (U) and number (1). More... | |
void | UpdateAnnotation () |
Update the symbol references for the schematic project (or the current sheet). More... | |
void | Annotate (bool aUseSheetNum, int aSheetIntervalId, int aStartNumber, SCH_MULTI_UNIT_REFERENCE_MAP aLockedUnitMap) |
Set the reference designators in the list that have not been annotated. More... | |
int | CheckAnnotation (ANNOTATION_ERROR_HANDLER aErrorHandler) |
Check for annotations errors. More... | |
void | SortByXCoordinate () |
Sort the list of references by X position. More... | |
void | SortByYCoordinate () |
Sort the list of references by Y position. More... | |
void | SortByTimeStamp () |
Sort the flat list by Time Stamp (sheet path + timestamp). More... | |
void | SortByRefAndValue () |
Sort the list of references by value. More... | |
void | SortByReferenceOnly () |
Sort the list of references by reference. More... | |
int | FindRef (const wxString &aPath) const |
Search the list for a symbol with a given reference. More... | |
int | FindUnit (size_t aIndex, int aUnit) |
Search the sorted list of symbols for a another symbol with the same reference and a given part unit. More... | |
int | FindRefByPath (const wxString &aPath) const |
Search the list for a symbol with the given KIID path. More... | |
void | GetRefsInUse (int aIndex, std::vector< int > &aIdList, int aMinRefId) |
Add all the reference designator numbers greater than aMinRefId to aIdList skipping the reference at aIndex. More... | |
int | GetLastReference (int aIndex, int aMinValue) |
Return the last used (greatest) reference number in the reference list for the prefix used by the symbol pointed to by aIndex. More... | |
Static Public Member Functions | |
static wxString | Shorthand (std::vector< SCH_REFERENCE > aList) |
Return a shorthand string representing all the references in the list. More... | |
Private Member Functions | |
int | CreateFirstFreeRefId (std::vector< int > &aIdList, int aFirstValue) |
Search for the first free reference number in aListId of reference numbers in use. More... | |
Static Private Member Functions | |
static bool | sortByRefAndValue (const SCH_REFERENCE &item1, const SCH_REFERENCE &item2) |
static bool | sortByXPosition (const SCH_REFERENCE &item1, const SCH_REFERENCE &item2) |
static bool | sortByYPosition (const SCH_REFERENCE &item1, const SCH_REFERENCE &item2) |
static bool | sortByTimeStamp (const SCH_REFERENCE &item1, const SCH_REFERENCE &item2) |
static bool | sortByReferenceOnly (const SCH_REFERENCE &item1, const SCH_REFERENCE &item2) |
Private Attributes | |
std::vector< SCH_REFERENCE > | flatList |
Friends | |
class | BACK_ANNOTATION |
class | BACK_ANNOTATE |
Container to create a flattened list of symbols because in a complex hierarchy, a symbol can be used more than once and its reference designator is dependent on the sheet path for the same symbol.
This flattened list is used for netlist generation, BOM generation, and schematic annotation.
Definition at line 196 of file sch_reference_list.h.
|
inline |
Definition at line 203 of file sch_reference_list.h.
|
inline |
Definition at line 221 of file sch_reference_list.h.
References flatList.
Referenced by SCH_SHEET_LIST::AnnotatePowerSymbols(), and SCH_SHEET_PATH::GetSymbols().
void SCH_REFERENCE_LIST::Annotate | ( | bool | aUseSheetNum, |
int | aSheetIntervalId, | ||
int | aStartNumber, | ||
SCH_MULTI_UNIT_REFERENCE_MAP | aLockedUnitMap | ||
) |
Set the reference designators in the list that have not been annotated.
aUseSheetNum | Set to true to start annotation for each sheet at the sheet number times aSheetIntervalId. Otherwise annotate incrementally. |
aSheetIntervalId | The per sheet reference designator multiplier. |
aStartNumber | The number to start with if NOT numbering based on sheet number. |
aLockedUnitMap | A SCH_MULTI_UNIT_REFERENCE_MAP of reference designator wxStrings to SCH_REFERENCE_LISTs. May be an empty map. If not empty, any multi-unit parts found in this map will be annotated as a group rather than individually. |
If a the sheet number is 2 and aSheetIntervalId is 100, then the first reference designator would be 201 and the last reference designator would be 299 when no overlap occurs with sheet number 3. If there are 150 items in sheet number 2, then items are referenced U201 to U351, and items in sheet 3 start from U352
Definition at line 282 of file component_references_lister.cpp.
References buildFullReference(), SCH_REFERENCE::CompareLibName(), SCH_REFERENCE::CompareValue(), CreateFirstFreeRefId(), FindUnit(), flatList, GetCount(), GetRefsInUse(), SCH_REFERENCE::IsSameInstance(), SCH_REFERENCE::m_unit, and NULL.
Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_SHEET_LIST::AnnotatePowerSymbols(), and UpdateAnnotation().
int SCH_REFERENCE_LIST::CheckAnnotation | ( | ANNOTATION_ERROR_HANDLER | aErrorHandler | ) |
Check for annotations errors.
The following annotation error conditions are tested:
aErrorHandler | A handler for errors. |
Definition at line 498 of file component_references_lister.cpp.
References _, ERCE_DIFFERENT_UNIT_VALUE, ERCE_DUPLICATE_REFERENCE, ERCE_EXTRA_UNITS, ERCE_UNANNOTATED, flatList, next(), SortByRefAndValue(), SplitReferences(), and LIB_PART::SubReference().
Referenced by SCH_EDIT_FRAME::CheckAnnotate().
|
inline |
Definition at line 212 of file sch_reference_list.h.
References flatList.
Referenced by SCH_EDITOR_CONTROL::doCopy().
|
private |
Search for the first free reference number in aListId of reference numbers in use.
This function just searches for a hole in a list of incremented numbers, this list must be sorted by increasing values and each value can be stored only once. The new value is added to the list.
aIdList | The buffer that contains the reference numbers in use. |
aFirstValue | The first expected free value |
Definition at line 232 of file component_references_lister.cpp.
Referenced by Annotate().
int SCH_REFERENCE_LIST::FindRef | ( | const wxString & | aPath | ) | const |
Search the list for a symbol with a given reference.
Definition at line 179 of file component_references_lister.cpp.
References flatList.
Referenced by BACK_ANNOTATE::getChangeList().
int SCH_REFERENCE_LIST::FindRefByPath | ( | const wxString & | aPath | ) | const |
Search the list for a symbol with the given KIID path.
aPath | path to search |
Definition at line 167 of file component_references_lister.cpp.
References flatList.
Referenced by BACK_ANNOTATE::getChangeList(), and SCH_EDITOR_CONTROL::updatePastedInstances().
int SCH_REFERENCE_LIST::FindUnit | ( | size_t | aIndex, |
int | aUnit | ||
) |
Search the sorted list of symbols for a another symbol with the same reference and a given part unit.
Use this method to manage symbols with multiple parts per package.
aIndex | = index in aSymbolsList for of given SCH_REFERENCE item to test. |
aUnit | = the given unit number to search |
Definition at line 145 of file component_references_lister.cpp.
References flatList.
Referenced by Annotate().
|
inline |
Definition at line 217 of file sch_reference_list.h.
References flatList.
Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::AddColumn(), Annotate(), SCH_EDIT_FRAME::AnnotateComponents(), SCH_SHEET_LIST::AnnotatePowerSymbols(), FIELDS_EDITOR_GRID_DATA_MODEL::ApplyData(), SCH_EDITOR_CONTROL::AssignFootprints(), SCH_EDIT_FRAME::CheckAnnotate(), BACK_ANNOTATE::checkForUnusedSymbols(), CollectOtherUnits(), SCHEMATIC::ConvertRefsToKIIDs(), SCH_SEXPR_PLUGIN::Format(), BACK_ANNOTATE::getChangeList(), FIELDS_EDITOR_GRID_DATA_MODEL::GetDataWidth(), DIALOG_EDIT_COMPONENTS_LIBID::initDlg(), DIALOG_FIELDS_EDITOR_GLOBAL::LoadFieldNames(), SCH_EDIT_FRAME::mapExistingAnnotation(), DIALOG_LABEL_EDITOR::onScintillaCharAdded(), DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded(), SCH_EDITOR_CONTROL::processCmpToFootprintLinkFile(), FIELDS_EDITOR_GRID_DATA_MODEL::RebuildRows(), SplitReferences(), ERC_TESTER::TestMultiunitFootprints(), UpdateAnnotation(), and SCH_SHEET_LIST::UpdateSymbolInstances().
|
inline |
Definition at line 219 of file sch_reference_list.h.
References flatList.
Referenced by ERC_TESTER::TestMultiunitFootprints().
int SCH_REFERENCE_LIST::GetLastReference | ( | int | aIndex, |
int | aMinValue | ||
) |
Return the last used (greatest) reference number in the reference list for the prefix used by the symbol pointed to by aIndex.
The symbol list must be sorted.
aIndex | The index of the reference item used for the search pattern. |
aMinValue | The minimum value for the current search. |
Definition at line 213 of file component_references_lister.cpp.
References flatList.
void SCH_REFERENCE_LIST::GetRefsInUse | ( | int | aIndex, |
std::vector< int > & | aIdList, | ||
int | aMinRefId | ||
) |
Add all the reference designator numbers greater than aMinRefId to aIdList skipping the reference at aIndex.
aIndex | = the current symbol's index to use for reference prefix filtering. |
aIdList | = the buffer to fill |
aMinRefId | = the min id value to store. all values < aMinRefId are ignored |
Definition at line 191 of file component_references_lister.cpp.
References flatList.
Referenced by Annotate().
|
inline |
Definition at line 207 of file sch_reference_list.h.
References flatList.
void SCH_REFERENCE_LIST::RemoveItem | ( | unsigned int | aIndex | ) |
Remove an item from the list of references.
aIndex | is the index of the item to be removed. |
Definition at line 44 of file component_references_lister.cpp.
References flatList.
|
static |
Return a shorthand string representing all the references in the list.
For instance, "R1, R2, R4 - R7, U1"
Definition at line 756 of file component_references_lister.cpp.
Referenced by FIELDS_EDITOR_GRID_DATA_MODEL::GetValue().
|
inline |
Sort the list of references by value.
Symbols are sorted in the following order:
Definition at line 363 of file sch_reference_list.h.
References flatList, and sortByRefAndValue().
Referenced by CheckAnnotation().
|
staticprivate |
Definition at line 91 of file component_references_lister.cpp.
References SCH_REFERENCE::CompareRef(), SCH_REFERENCE::CompareValue(), SCH_REFERENCE::m_sheetNum, SCH_REFERENCE::m_symbolPos, SCH_REFERENCE::m_symbolUuid, and SCH_REFERENCE::m_unit.
Referenced by SortByRefAndValue().
|
inline |
Sort the list of references by reference.
Symbols are sorted in the following order:
Definition at line 378 of file sch_reference_list.h.
References flatList, and sortByReferenceOnly().
Referenced by SCH_SEXPR_PLUGIN::Format().
|
staticprivate |
Definition at line 118 of file component_references_lister.cpp.
References SCH_REFERENCE::GetRef(), SCH_REFERENCE::m_symbolUuid, SCH_REFERENCE::m_unit, and UTIL::RefDesStringCompare().
Referenced by SortByReferenceOnly().
|
inline |
Sort the flat list by Time Stamp (sheet path + timestamp).
Useful to detect duplicate Time Stamps
Definition at line 344 of file sch_reference_list.h.
References flatList, and sortByTimeStamp().
Referenced by BACK_ANNOTATE::checkForUnusedSymbols().
|
staticprivate |
Definition at line 133 of file component_references_lister.cpp.
References SCH_SHEET_PATH::Cmp(), SCH_REFERENCE::m_sheetPath, and SCH_REFERENCE::m_symbolUuid.
Referenced by BACK_ANNOTATE::checkForUnusedSymbols(), and SortByTimeStamp().
|
inline |
Sort the list of references by X position.
Symbols are sorted as follows:
Definition at line 316 of file sch_reference_list.h.
References flatList, and sortByXPosition().
Referenced by SCH_EDIT_FRAME::AnnotateComponents().
|
staticprivate |
Definition at line 51 of file component_references_lister.cpp.
References SCH_REFERENCE::CompareRef(), SCH_REFERENCE::m_sheetNum, SCH_REFERENCE::m_symbolPos, and SCH_REFERENCE::m_symbolUuid.
Referenced by SortByXCoordinate().
|
inline |
Sort the list of references by Y position.
Symbols are sorted as follows:
Definition at line 334 of file sch_reference_list.h.
References flatList, and sortByYPosition().
Referenced by SCH_EDIT_FRAME::AnnotateComponents().
|
staticprivate |
Definition at line 71 of file component_references_lister.cpp.
References SCH_REFERENCE::CompareRef(), SCH_REFERENCE::m_sheetNum, SCH_REFERENCE::m_symbolPos, and SCH_REFERENCE::m_symbolUuid.
Referenced by SortByYCoordinate().
|
inline |
Attempt to split all reference designators 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, set m_unit to a max value (0x7FFFFFFF).
Definition at line 246 of file sch_reference_list.h.
References flatList, and GetCount().
Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_SHEET_LIST::AnnotatePowerSymbols(), CheckAnnotation(), and FIELDS_EDITOR_GRID_DATA_MODEL::FIELDS_EDITOR_GRID_DATA_MODEL().
|
inline |
Update the symbol references for the schematic project (or the current sheet).
Definition at line 260 of file sch_reference_list.h.
References Annotate(), flatList, and GetCount().
Referenced by SCH_SHEET_LIST::AnnotatePowerSymbols().
|
friend |
Definition at line 477 of file sch_reference_list.h.
|
friend |
Definition at line 449 of file sch_reference_list.h.
|
private |
Definition at line 200 of file sch_reference_list.h.
Referenced by AddItem(), Annotate(), CheckAnnotation(), Clear(), FindRef(), FindRefByPath(), FindUnit(), GetCount(), GetItem(), GetLastReference(), GetRefsInUse(), operator[](), RemoveItem(), SortByRefAndValue(), SortByReferenceOnly(), SortByTimeStamp(), SortByXCoordinate(), SortByYCoordinate(), SplitReferences(), and UpdateAnnotation().