KiCad PCB EDA Suite
CN_CLUSTER Class Reference

#include <connectivity_items.h>

Public Types

using ITER = decltype(m_items)::iterator
 

Public Member Functions

 CN_CLUSTER ()
 
 ~CN_CLUSTER ()
 
bool HasValidNet () const
 
int OriginNet () const
 
wxString OriginNetName () const
 
bool Contains (const CN_ITEM *aItem)
 
bool Contains (const BOARD_CONNECTED_ITEM *aItem)
 
void Dump ()
 
int Size () const
 
bool HasNet () const
 
bool IsOrphaned () const
 
bool IsConflicting () const
 
void Add (CN_ITEM *item)
 
ITER begin ()
 
ITER end ()
 

Private Attributes

bool m_conflicting = false
 
int m_originNet = 0
 
CN_ITEMm_originPad = nullptr
 
std::vector< CN_ITEM * > m_items
 

Detailed Description

Definition at line 477 of file connectivity_items.h.

Member Typedef Documentation

◆ ITER

using CN_CLUSTER::ITER = decltype(m_items)::iterator

Definition at line 528 of file connectivity_items.h.

Constructor & Destructor Documentation

◆ CN_CLUSTER()

CN_CLUSTER::CN_CLUSTER ( )

Definition at line 377 of file connectivity_items.cpp.

378 {
379  m_items.reserve( 64 );
380  m_originPad = nullptr;
381  m_originNet = -1;
382  m_conflicting = false;
383 }
std::vector< CN_ITEM * > m_items
CN_ITEM * m_originPad

References m_conflicting, m_items, m_originNet, and m_originPad.

◆ ~CN_CLUSTER()

CN_CLUSTER::~CN_CLUSTER ( )

Definition at line 386 of file connectivity_items.cpp.

387 {
388 }

Member Function Documentation

◆ Add()

void CN_CLUSTER::Add ( CN_ITEM item)

Definition at line 426 of file connectivity_items.cpp.

427 {
428  m_items.push_back( item );
429 
430  if( item->Net() <= 0 )
431  return;
432 
433  if( m_originNet <= 0 )
434  {
435  m_originNet = item->Net();
436  }
437 
438  if( item->Parent()->Type() == PCB_PAD_T )
439  {
440  if( !m_originPad )
441  {
442  m_originPad = item;
443  m_originNet = item->Net();
444  }
445 
446  if( m_originPad && item->Net() != m_originNet )
447  {
448  m_conflicting = true;
449  }
450  }
451 }
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
BOARD_CONNECTED_ITEM * Parent() const
int Net() const
std::vector< CN_ITEM * > m_items
CN_ITEM * m_originPad
KICAD_T Type() const
Function Type()
Definition: base_struct.h:210

References m_conflicting, m_items, m_originNet, m_originPad, CN_ITEM::Net(), CN_ITEM::Parent(), PCB_PAD_T, and EDA_ITEM::Type().

◆ begin()

ITER CN_CLUSTER::begin ( )
inline

Definition at line 530 of file connectivity_items.h.

530 { return m_items.begin(); };
std::vector< CN_ITEM * > m_items

References m_items.

◆ Contains() [1/2]

bool CN_CLUSTER::Contains ( const CN_ITEM aItem)

Definition at line 400 of file connectivity_items.cpp.

401 {
402  return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
403 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ Contains() [2/2]

bool CN_CLUSTER::Contains ( const BOARD_CONNECTED_ITEM aItem)

Definition at line 406 of file connectivity_items.cpp.

407 {
408  return std::find_if( m_items.begin(), m_items.end(), [ &aItem ] ( const CN_ITEM* item )
409  { return item->Valid() && item->Parent() == aItem; } ) != m_items.end();
410 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ Dump()

void CN_CLUSTER::Dump ( )

Definition at line 413 of file connectivity_items.cpp.

414 {
415  for( auto item : m_items )
416  {
417  wxLogTrace( "CN", " - item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
418  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
419  printf( "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
420  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
421  item->Dump();
422  }
423 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ end()

ITER CN_CLUSTER::end ( )
inline

Definition at line 531 of file connectivity_items.h.

531 { return m_items.end(); };
std::vector< CN_ITEM * > m_items

References m_items.

◆ HasNet()

bool CN_CLUSTER::HasNet ( ) const
inline

Definition at line 511 of file connectivity_items.h.

512  {
513  return m_originNet > 0;
514  }

References m_originNet.

◆ HasValidNet()

bool CN_CLUSTER::HasValidNet ( ) const
inline

Definition at line 490 of file connectivity_items.h.

491  {
492  return m_originNet > 0;
493  }

References m_originNet.

◆ IsConflicting()

bool CN_CLUSTER::IsConflicting ( ) const
inline

Definition at line 521 of file connectivity_items.h.

522  {
523  return m_conflicting;
524  }

References m_conflicting.

◆ IsOrphaned()

bool CN_CLUSTER::IsOrphaned ( ) const
inline

Definition at line 516 of file connectivity_items.h.

517  {
518  return m_originPad == nullptr;
519  }
CN_ITEM * m_originPad

References m_originPad.

◆ OriginNet()

int CN_CLUSTER::OriginNet ( ) const
inline

Definition at line 495 of file connectivity_items.h.

496  {
497  return m_originNet;
498  }

References m_originNet.

◆ OriginNetName()

wxString CN_CLUSTER::OriginNetName ( ) const

Definition at line 391 of file connectivity_items.cpp.

392 {
393  if( !m_originPad || !m_originPad->Valid() )
394  return "<none>";
395  else
396  return m_originPad->Parent()->GetNetname();
397 }
BOARD_CONNECTED_ITEM * Parent() const
const wxString & GetNetname() const
Function GetNetname.
CN_ITEM * m_originPad
bool Valid() const

References BOARD_CONNECTED_ITEM::GetNetname(), m_originPad, CN_ITEM::Parent(), and CN_ITEM::Valid().

◆ Size()

int CN_CLUSTER::Size ( ) const
inline

Definition at line 506 of file connectivity_items.h.

507  {
508  return m_items.size();
509  }
std::vector< CN_ITEM * > m_items

References m_items.

Member Data Documentation

◆ m_conflicting

bool CN_CLUSTER::m_conflicting = false
private

Definition at line 481 of file connectivity_items.h.

Referenced by Add(), CN_CLUSTER(), and IsConflicting().

◆ m_items

std::vector<CN_ITEM*> CN_CLUSTER::m_items
private

Definition at line 484 of file connectivity_items.h.

Referenced by Add(), begin(), CN_CLUSTER(), Contains(), Dump(), end(), and Size().

◆ m_originNet

int CN_CLUSTER::m_originNet = 0
private

Definition at line 482 of file connectivity_items.h.

Referenced by Add(), CN_CLUSTER(), HasNet(), HasValidNet(), and OriginNet().

◆ m_originPad

CN_ITEM* CN_CLUSTER::m_originPad = nullptr
private

Definition at line 483 of file connectivity_items.h.

Referenced by Add(), CN_CLUSTER(), IsOrphaned(), and OriginNetName().


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