39 if( item && item->
m_Uuid == aId )
49 if(
m_owner.IsFootprintHolder() )
61 if( !itemInserted && itemIt->second != aItem.
m_Uuid )
66 if( prevIt !=
m_itemsById.end() && prevIt->second == &aItem )
69 itemIt->second = aItem.
m_Uuid;
72 if( !idInserted && idIt->second != &aItem )
78 idIt->second->m_owningIndex =
nullptr;
82 idIt->second = &aItem;
102 cached !=
m_idsByItem.end() && cached->second == aId )
119 if( it !=
m_itemsById.end() && it->second == &aItem )
127 [&aItem](
const auto& entry )
129 return entry.second == &aItem;
137 item->m_owningIndex =
nullptr;
146 if(
m_owner.IsFootprintHolder() )
149 if( aItem.
m_Uuid == aNewId )
155 if(
BOARD_ITEM* existing =
Find( aNewId ); existing && existing != &aItem )
157 wxFAIL_MSG( wxString::Format(
"BOARD_ITEM_INDEX::Rebind() duplicate target UUID: %s", aNewId.
AsString() ) );
std::unordered_map< KIID, BOARD_ITEM * > m_itemsById
Forward map from KIIDs to board items.
BOARD_ITEM * Find(const KIID &aId)
Return a cached item for aId if the entry is still self-consistent.
void UnbindSubtree(const BOARD_ITEM &aItem)
void UnbindItem(const BOARD_ITEM &aItem)
Drop aItem itself.
void Clear()
Drop every entry, clearing each item's link back to the board.
void BindSubtree(BOARD_ITEM &aItem)
void Unbind(const KIID &aId)
Remove an item from the item-by-id cache.
void BindChildren(const BOARD_ITEM &aParent)
void BindItem(BOARD_ITEM &aItem)
Index aItem, replacing any previous entry for its UUID or address.
std::unordered_map< const BOARD_ITEM *, KIID > m_idsByItem
Reverse map from board items to their KIIDs.
void UnbindChildren(const BOARD_ITEM &aParent)
void Rebind(BOARD_ITEM &aItem, const KIID &aNewId)
Move aItem to aNewId, keeping the index in step with the item.
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetUuidDirect(const KIID &aUuid)
Raw UUID assignment.
virtual void RunOnChildren(const std::function< void(BOARD_ITEM *)> &aFunction, RECURSE_MODE aMode) const
Invoke a function on all children.
BOARD_ITEM_INDEX * m_owningIndex
Board index that indexes this item, or nullptr.
wxString AsString() const