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

Member Typedef Documentation

◆ ITER

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

Definition at line 563 of file connectivity_items.h.

Constructor & Destructor Documentation

◆ CN_CLUSTER()

CN_CLUSTER::CN_CLUSTER ( )

Definition at line 409 of file connectivity_items.cpp.

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

419 {
420 }

Member Function Documentation

◆ Add()

void CN_CLUSTER::Add ( CN_ITEM item)

Definition at line 458 of file connectivity_items.cpp.

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

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

565 { 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 432 of file connectivity_items.cpp.

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

References m_items.

◆ Contains() [2/2]

bool CN_CLUSTER::Contains ( const BOARD_CONNECTED_ITEM aItem)

Definition at line 438 of file connectivity_items.cpp.

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

References m_items.

◆ Dump()

void CN_CLUSTER::Dump ( )

Definition at line 445 of file connectivity_items.cpp.

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

References m_items.

◆ end()

ITER CN_CLUSTER::end ( )
inline

Definition at line 566 of file connectivity_items.h.

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

References m_items.

◆ HasNet()

bool CN_CLUSTER::HasNet ( ) const
inline

Definition at line 546 of file connectivity_items.h.

547  {
548  return m_originNet > 0;
549  }

References m_originNet.

◆ HasValidNet()

bool CN_CLUSTER::HasValidNet ( ) const
inline

Definition at line 525 of file connectivity_items.h.

526  {
527  return m_originNet > 0;
528  }

References m_originNet.

◆ IsConflicting()

bool CN_CLUSTER::IsConflicting ( ) const
inline

Definition at line 556 of file connectivity_items.h.

557  {
558  return m_conflicting;
559  }

References m_conflicting.

◆ IsOrphaned()

bool CN_CLUSTER::IsOrphaned ( ) const
inline

Definition at line 551 of file connectivity_items.h.

552  {
553  return m_originPad == nullptr;
554  }
CN_ITEM * m_originPad

References m_originPad.

◆ OriginNet()

int CN_CLUSTER::OriginNet ( ) const
inline

Definition at line 530 of file connectivity_items.h.

531  {
532  return m_originNet;
533  }

References m_originNet.

◆ OriginNetName()

wxString CN_CLUSTER::OriginNetName ( ) const

Definition at line 423 of file connectivity_items.cpp.

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

542  {
543  return m_items.size();
544  }
std::vector< CN_ITEM * > m_items

References m_items.

Member Data Documentation

◆ m_conflicting

bool CN_CLUSTER::m_conflicting = false
private

Definition at line 516 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 519 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 517 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 518 of file connectivity_items.h.

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


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