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 487 of file connectivity_items.h.

Member Typedef Documentation

◆ ITER

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

Definition at line 538 of file connectivity_items.h.

Constructor & Destructor Documentation

◆ CN_CLUSTER()

CN_CLUSTER::CN_CLUSTER ( )

Definition at line 407 of file connectivity_items.cpp.

408 {
409  m_items.reserve( 64 );
410  m_originPad = nullptr;
411  m_originNet = -1;
412  m_conflicting = false;
413 }
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 416 of file connectivity_items.cpp.

417 {
418 }

Member Function Documentation

◆ Add()

void CN_CLUSTER::Add ( CN_ITEM item)

Definition at line 456 of file connectivity_items.cpp.

457 {
458  m_items.push_back( item );
459 
460  if( item->Net() <= 0 )
461  return;
462 
463  if( m_originNet <= 0 )
464  {
465  m_originNet = item->Net();
466  }
467 
468  if( item->Parent()->Type() == PCB_PAD_T )
469  {
470  if( !m_originPad )
471  {
472  m_originPad = item;
473  m_originNet = item->Net();
474  }
475 
476  if( m_originPad && item->Net() != m_originNet )
477  {
478  m_conflicting = true;
479  }
480  }
481 }
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:212

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 540 of file connectivity_items.h.

540 { 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 430 of file connectivity_items.cpp.

431 {
432  return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
433 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ Contains() [2/2]

bool CN_CLUSTER::Contains ( const BOARD_CONNECTED_ITEM aItem)

Definition at line 436 of file connectivity_items.cpp.

437 {
438  return std::find_if( m_items.begin(), m_items.end(), [ &aItem ] ( const CN_ITEM* item )
439  { return item->Valid() && item->Parent() == aItem; } ) != m_items.end();
440 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ Dump()

void CN_CLUSTER::Dump ( )

Definition at line 443 of file connectivity_items.cpp.

444 {
445  for( auto item : m_items )
446  {
447  wxLogTrace( "CN", " - item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
448  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
449  printf( "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
450  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
451  item->Dump();
452  }
453 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ end()

ITER CN_CLUSTER::end ( )
inline

Definition at line 541 of file connectivity_items.h.

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

References m_items.

◆ HasNet()

bool CN_CLUSTER::HasNet ( ) const
inline

Definition at line 521 of file connectivity_items.h.

522  {
523  return m_originNet > 0;
524  }

References m_originNet.

◆ HasValidNet()

bool CN_CLUSTER::HasValidNet ( ) const
inline

Definition at line 500 of file connectivity_items.h.

501  {
502  return m_originNet > 0;
503  }

References m_originNet.

◆ IsConflicting()

bool CN_CLUSTER::IsConflicting ( ) const
inline

Definition at line 531 of file connectivity_items.h.

532  {
533  return m_conflicting;
534  }

References m_conflicting.

◆ IsOrphaned()

bool CN_CLUSTER::IsOrphaned ( ) const
inline

Definition at line 526 of file connectivity_items.h.

527  {
528  return m_originPad == nullptr;
529  }
CN_ITEM * m_originPad

References m_originPad.

◆ OriginNet()

int CN_CLUSTER::OriginNet ( ) const
inline

Definition at line 505 of file connectivity_items.h.

506  {
507  return m_originNet;
508  }

References m_originNet.

◆ OriginNetName()

wxString CN_CLUSTER::OriginNetName ( ) const

Definition at line 421 of file connectivity_items.cpp.

422 {
423  if( !m_originPad || !m_originPad->Valid() )
424  return "<none>";
425  else
426  return m_originPad->Parent()->GetNetname();
427 }
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 516 of file connectivity_items.h.

517  {
518  return m_items.size();
519  }
std::vector< CN_ITEM * > m_items

References m_items.

Member Data Documentation

◆ m_conflicting

bool CN_CLUSTER::m_conflicting = false
private

Definition at line 491 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 494 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 492 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 493 of file connectivity_items.h.

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


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