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

CN_ITEM represents a BOARD_CONNETED_ITEM in the connectivity system (ie: a pad, track/arc/via, or zone). More...

#include <connectivity_items.h>

Inheritance diagram for CN_ITEM:
CN_ZONE_LAYER

Public Member Functions

void Dump ()
 
 CN_ITEM (BOARD_CONNECTED_ITEM *aParent, bool aCanChangeNet, int aAnchorCount=2)
 
virtual ~CN_ITEM ()
 
std::shared_ptr< CN_ANCHORAddAnchor (const VECTOR2I &aPos)
 
std::vector< std::shared_ptr< CN_ANCHOR > > & Anchors ()
 
void SetValid (bool aValid)
 
bool Valid () const
 
void SetDirty (bool aDirty)
 
bool Dirty () const
 
void SetLayers (int aStartLayer, int aEndLayer)
 Set the layers spanned by the item to aStartLayer and aEndLayer.
 
void SetLayer (int aLayer)
 Set the layers spanned by the item to a single layer aLayer.
 
int StartLayer () const
 Return the contiguous set of layers spanned by the item.
 
int EndLayer () const
 
virtual int Layer () const
 Return the item's layer, for single-layered items only.
 
PCB_LAYER_ID GetBoardLayer () const
 
const BOX2IBBox ()
 
BOARD_CONNECTED_ITEMParent () const
 
const std::vector< CN_ITEM * > & ConnectedItems () const
 
void ClearConnections ()
 
bool CanChangeNet () const
 
void Connect (CN_ITEM *b)
 
void RemoveInvalidRefs ()
 
virtual int AnchorCount () const
 
virtual const VECTOR2I GetAnchor (int n) const
 
int Net () const
 
void SetListIndex (int aIndex)
 Position of this item in its owning CN_LIST.
 
int ListIndex () const
 

Static Public Member Functions

static PCB_LAYER_ID BoardLayerFromOrdinal (int aOrdinal)
 

Protected Attributes

std::atomic< bool > m_dirty
 used to identify recently added item not yet scanned into the connectivity search
 
int m_start_layer
 start layer of the item N.B. B_Cu is set to INT_MAX
 
int m_end_layer
 end layer of the item N.B. B_Cu is set to INT_MAX
 
BOX2I m_bbox
 bounding box for the item
 

Private Attributes

BOARD_CONNECTED_ITEMm_parent
 
std::vector< CN_ITEM * > m_connected
 list of physically touching items
 
std::vector< std::shared_ptr< CN_ANCHOR > > m_anchors
 
bool m_canChangeNet
 can the net propagator modify the netcode?
 
bool m_valid
 used to identify garbage items (we use lazy removal)
 
int m_listIndex = -1
 position in the owning CN_LIST, see SetListIndex()
 
std::mutex m_listLock
 mutex protecting this item's connected_items set to
 

Detailed Description

CN_ITEM represents a BOARD_CONNETED_ITEM in the connectivity system (ie: a pad, track/arc/via, or zone).

Definition at line 124 of file connectivity_items.h.

Constructor & Destructor Documentation

◆ CN_ITEM()

CN_ITEM::CN_ITEM ( BOARD_CONNECTED_ITEM * aParent,
bool aCanChangeNet,
int aAnchorCount = 2 )
inline

◆ ~CN_ITEM()

virtual CN_ITEM::~CN_ITEM ( )
inlinevirtual

Definition at line 141 of file connectivity_items.h.

References anchor, and m_anchors.

Member Function Documentation

◆ AddAnchor()

std::shared_ptr< CN_ANCHOR > CN_ITEM::AddAnchor ( const VECTOR2I & aPos)
inline

Definition at line 147 of file connectivity_items.h.

References m_anchors.

Referenced by CN_LIST::Add(), CN_LIST::Add(), CN_LIST::Add(), CN_LIST::Add(), and CN_LIST::Add().

◆ AnchorCount()

int CN_ITEM::AnchorCount ( ) const
virtual

Reimplemented in CN_ZONE_LAYER.

Definition at line 36 of file connectivity_items.cpp.

References m_anchors, m_parent, m_valid, PCB_ARC_T, PCB_SHAPE_T, and PCB_TRACE_T.

Referenced by CN_VISITOR::checkZoneItemConnection().

◆ Anchors()

std::vector< std::shared_ptr< CN_ANCHOR > > & CN_ITEM::Anchors ( )
inline

Definition at line 153 of file connectivity_items.h.

References m_anchors.

◆ BBox()

const BOX2I & CN_ITEM::BBox ( )
inline

◆ BoardLayerFromOrdinal()

static PCB_LAYER_ID CN_ITEM::BoardLayerFromOrdinal ( int aOrdinal)
inlinestatic
Returns
the board layer of a single-layered item.

Definition at line 195 of file connectivity_items.h.

References B_Cu, F_Cu, MAX_CU_LAYERS, and ToLAYER_ID().

Referenced by GetBoardLayer().

◆ CanChangeNet()

bool CN_ITEM::CanChangeNet ( ) const
inline

Definition at line 230 of file connectivity_items.h.

References m_canChangeNet.

Referenced by CN_VISITOR::checkZoneItemConnection(), and CN_VISITOR::operator()().

◆ ClearConnections()

void CN_ITEM::ClearConnections ( )
inline

Definition at line 228 of file connectivity_items.h.

References m_connected.

◆ Connect()

void CN_ITEM::Connect ( CN_ITEM * b)
inline

◆ ConnectedItems()

◆ Dirty()

bool CN_ITEM::Dirty ( ) const
inline

Definition at line 159 of file connectivity_items.h.

References m_dirty.

Referenced by CN_VISITOR::operator()().

◆ Dump()

void CN_ITEM::Dump ( )

Definition at line 86 of file connectivity_items.cpp.

References CN_ITEM(), m_connected, EDA_ITEM::Type(), and Valid().

◆ EndLayer()

int CN_ITEM::EndLayer ( ) const
inline

Definition at line 183 of file connectivity_items.h.

References m_end_layer.

Referenced by CN_LIST::FindNearby().

◆ GetAnchor()

const VECTOR2I CN_ITEM::GetAnchor ( int n) const
virtual

◆ GetBoardLayer()

PCB_LAYER_ID CN_ITEM::GetBoardLayer ( ) const
inline

Definition at line 207 of file connectivity_items.h.

References BoardLayerFromOrdinal(), and Layer().

Referenced by RN_NET::OptimizeRNEdges().

◆ Layer()

virtual int CN_ITEM::Layer ( ) const
inlinevirtual

Return the item's layer, for single-layered items only.

N.B. This is a copper layer ordinal and not a PCB_LAYER_ID. Convert a copper layer ordinal back to the board layer it stands for.

Definition at line 189 of file connectivity_items.h.

References StartLayer().

Referenced by GetBoardLayer().

◆ ListIndex()

int CN_ITEM::ListIndex ( ) const
inline

Definition at line 260 of file connectivity_items.h.

References m_listIndex.

◆ Net()

◆ Parent()

◆ RemoveInvalidRefs()

void CN_ITEM::RemoveInvalidRefs ( )

Definition at line 133 of file connectivity_items.cpp.

References m_connected.

◆ SetDirty()

void CN_ITEM::SetDirty ( bool aDirty)
inline

Definition at line 158 of file connectivity_items.h.

References m_dirty.

Referenced by CN_LIST::Add(), CN_LIST::Add(), CN_LIST::Add(), CN_LIST::Add(), and CN_LIST::Add().

◆ SetLayer()

void CN_ITEM::SetLayer ( int aLayer)
inline

Set the layers spanned by the item to a single layer aLayer.

Definition at line 177 of file connectivity_items.h.

References SetLayers().

Referenced by CN_LIST::Add(), CN_LIST::Add(), and CN_LIST::Add().

◆ SetLayers()

void CN_ITEM::SetLayers ( int aStartLayer,
int aEndLayer )
inline

Set the layers spanned by the item to aStartLayer and aEndLayer.

Definition at line 164 of file connectivity_items.h.

References CopperLayerToOrdinal(), m_end_layer, m_start_layer, and ToLAYER_ID().

Referenced by CN_LIST::Add(), CN_ZONE_LAYER::CN_ZONE_LAYER(), and SetLayer().

◆ SetListIndex()

void CN_ITEM::SetListIndex ( int aIndex)
inline

Position of this item in its owning CN_LIST.

Maintained by the list, which is the only thing allowed to set it, so that readers – notably SearchClusters(), which several DRC threads may be inside at once – can map an item to an array slot without a lookup.

Definition at line 259 of file connectivity_items.h.

References m_listIndex.

Referenced by CN_LIST::appendItem().

◆ SetValid()

void CN_ITEM::SetValid ( bool aValid)
inline

Definition at line 155 of file connectivity_items.h.

References m_valid.

◆ StartLayer()

int CN_ITEM::StartLayer ( ) const
inline

Return the contiguous set of layers spanned by the item.

Definition at line 182 of file connectivity_items.h.

References m_start_layer.

Referenced by CN_LIST::FindNearby(), and Layer().

◆ Valid()

Member Data Documentation

◆ m_anchors

std::vector<std::shared_ptr<CN_ANCHOR> > CN_ITEM::m_anchors
private

Definition at line 273 of file connectivity_items.h.

Referenced by AddAnchor(), AnchorCount(), Anchors(), CN_ITEM(), GetAnchor(), and ~CN_ITEM().

◆ m_bbox

BOX2I CN_ITEM::m_bbox
protected

bounding box for the item

Definition at line 267 of file connectivity_items.h.

Referenced by BBox().

◆ m_canChangeNet

bool CN_ITEM::m_canChangeNet
private

can the net propagator modify the netcode?

Definition at line 275 of file connectivity_items.h.

Referenced by CanChangeNet(), and CN_ITEM().

◆ m_connected

std::vector<CN_ITEM*> CN_ITEM::m_connected
private

list of physically touching items

Definition at line 272 of file connectivity_items.h.

Referenced by ClearConnections(), CN_ITEM(), Connect(), ConnectedItems(), Dump(), and RemoveInvalidRefs().

◆ m_dirty

std::atomic<bool> CN_ITEM::m_dirty
protected

used to identify recently added item not yet scanned into the connectivity search

Definition at line 263 of file connectivity_items.h.

Referenced by BBox(), CN_ITEM(), Dirty(), and SetDirty().

◆ m_end_layer

int CN_ITEM::m_end_layer
protected

end layer of the item N.B. B_Cu is set to INT_MAX

Definition at line 266 of file connectivity_items.h.

Referenced by CN_ITEM(), EndLayer(), and SetLayers().

◆ m_listIndex

int CN_ITEM::m_listIndex = -1
private

position in the owning CN_LIST, see SetListIndex()

Definition at line 279 of file connectivity_items.h.

Referenced by ListIndex(), and SetListIndex().

◆ m_listLock

std::mutex CN_ITEM::m_listLock
private

mutex protecting this item's connected_items set to

Definition at line 281 of file connectivity_items.h.

Referenced by BBox(), and Connect().

◆ m_parent

BOARD_CONNECTED_ITEM* CN_ITEM::m_parent
private

Definition at line 270 of file connectivity_items.h.

Referenced by AnchorCount(), BBox(), CN_ITEM(), GetAnchor(), Net(), and Parent().

◆ m_start_layer

int CN_ITEM::m_start_layer
protected

start layer of the item N.B. B_Cu is set to INT_MAX

Definition at line 265 of file connectivity_items.h.

Referenced by CN_ITEM(), SetLayers(), and StartLayer().

◆ m_valid

bool CN_ITEM::m_valid
private

used to identify garbage items (we use lazy removal)

Definition at line 277 of file connectivity_items.h.

Referenced by AnchorCount(), BBox(), CN_ITEM(), GetAnchor(), Net(), SetValid(), and Valid().


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