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

Member Typedef Documentation

◆ ITER

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

Definition at line 552 of file connectivity_items.h.

Constructor & Destructor Documentation

◆ CN_CLUSTER()

CN_CLUSTER::CN_CLUSTER ( )

Definition at line 398 of file connectivity_items.cpp.

399 {
400  m_items.reserve( 64 );
401  m_originPad = nullptr;
402  m_originNet = -1;
403  m_conflicting = false;
404 }
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 407 of file connectivity_items.cpp.

408 {
409 }

Member Function Documentation

◆ Add()

void CN_CLUSTER::Add ( CN_ITEM item)

Definition at line 447 of file connectivity_items.cpp.

448 {
449  m_items.push_back( item );
450 
451  if( item->Net() <= 0 )
452  return;
453 
454  if( m_originNet <= 0 )
455  {
456  m_originNet = item->Net();
457  }
458 
459  if( item->Parent()->Type() == PCB_PAD_T )
460  {
461  if( !m_originPad )
462  {
463  m_originPad = item;
464  m_originNet = item->Net();
465  }
466 
467  if( m_originPad && item->Net() != m_originNet )
468  {
469  m_conflicting = true;
470  }
471  }
472 }
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:197

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

554 { 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 421 of file connectivity_items.cpp.

422 {
423  return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
424 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ Contains() [2/2]

bool CN_CLUSTER::Contains ( const BOARD_CONNECTED_ITEM aItem)

Definition at line 427 of file connectivity_items.cpp.

428 {
429  return std::find_if( m_items.begin(), m_items.end(), [ &aItem ] ( const CN_ITEM* item )
430  { return item->Valid() && item->Parent() == aItem; } ) != m_items.end();
431 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ Dump()

void CN_CLUSTER::Dump ( )

Definition at line 434 of file connectivity_items.cpp.

435 {
436  for( auto item : m_items )
437  {
438  wxLogTrace( "CN", " - item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
439  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
440  printf( "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
441  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
442  item->Dump();
443  }
444 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ end()

ITER CN_CLUSTER::end ( )
inline

Definition at line 555 of file connectivity_items.h.

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

References m_items.

◆ HasNet()

bool CN_CLUSTER::HasNet ( ) const
inline

Definition at line 535 of file connectivity_items.h.

536  {
537  return m_originNet > 0;
538  }

References m_originNet.

◆ HasValidNet()

bool CN_CLUSTER::HasValidNet ( ) const
inline

Definition at line 514 of file connectivity_items.h.

515  {
516  return m_originNet > 0;
517  }

References m_originNet.

◆ IsConflicting()

bool CN_CLUSTER::IsConflicting ( ) const
inline

Definition at line 545 of file connectivity_items.h.

546  {
547  return m_conflicting;
548  }

References m_conflicting.

◆ IsOrphaned()

bool CN_CLUSTER::IsOrphaned ( ) const
inline

Definition at line 540 of file connectivity_items.h.

541  {
542  return m_originPad == nullptr;
543  }
CN_ITEM * m_originPad

References m_originPad.

◆ OriginNet()

int CN_CLUSTER::OriginNet ( ) const
inline

Definition at line 519 of file connectivity_items.h.

520  {
521  return m_originNet;
522  }

References m_originNet.

◆ OriginNetName()

wxString CN_CLUSTER::OriginNetName ( ) const

Definition at line 412 of file connectivity_items.cpp.

413 {
414  if( !m_originPad || !m_originPad->Valid() )
415  return "<none>";
416  else
417  return m_originPad->Parent()->GetNetname();
418 }
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 530 of file connectivity_items.h.

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

References m_items.

Member Data Documentation

◆ m_conflicting

bool CN_CLUSTER::m_conflicting = false
private

Definition at line 505 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 508 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 506 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 507 of file connectivity_items.h.

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


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