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

Member Typedef Documentation

◆ ITER

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

Definition at line 521 of file connectivity_items.h.

Constructor & Destructor Documentation

◆ CN_CLUSTER()

CN_CLUSTER::CN_CLUSTER ( )

Definition at line 280 of file connectivity_items.cpp.

281 {
282  m_items.reserve( 64 );
283  m_originPad = nullptr;
284  m_originNet = -1;
285  m_conflicting = false;
286 }
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 289 of file connectivity_items.cpp.

290 {
291 }

Member Function Documentation

◆ Add()

void CN_CLUSTER::Add ( CN_ITEM item)

Definition at line 329 of file connectivity_items.cpp.

330 {
331  m_items.push_back( item );
332 
333  if( m_originNet < 0 )
334  {
335  m_originNet = item->Net();
336  }
337 
338  if( item->Parent()->Type() == PCB_PAD_T )
339  {
340  if( !m_originPad )
341  {
342  m_originPad = item;
343  m_originNet = item->Net();
344  }
345 
346  if( m_originPad && item->Net() != m_originNet )
347  {
348  m_conflicting = true;
349  }
350  }
351 }
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:201

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

523 { 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 303 of file connectivity_items.cpp.

304 {
305  return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
306 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ Contains() [2/2]

bool CN_CLUSTER::Contains ( const BOARD_CONNECTED_ITEM aItem)

Definition at line 309 of file connectivity_items.cpp.

310 {
311  return std::find_if( m_items.begin(), m_items.end(), [ &aItem ] ( const CN_ITEM* item )
312  { return item->Valid() && item->Parent() == aItem; } ) != m_items.end();
313 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ Dump()

void CN_CLUSTER::Dump ( )

Definition at line 316 of file connectivity_items.cpp.

317 {
318  for( auto item : m_items )
319  {
320  wxLogTrace( "CN", " - item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
321  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
322  printf( "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
323  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
324  item->Dump();
325  }
326 }
std::vector< CN_ITEM * > m_items

References m_items.

◆ end()

ITER CN_CLUSTER::end ( )
inline

Definition at line 524 of file connectivity_items.h.

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

References m_items.

◆ HasNet()

bool CN_CLUSTER::HasNet ( ) const
inline

Definition at line 504 of file connectivity_items.h.

505  {
506  return m_originNet >= 0;
507  }

References m_originNet.

◆ HasValidNet()

bool CN_CLUSTER::HasValidNet ( ) const
inline

Definition at line 483 of file connectivity_items.h.

484  {
485  return m_originNet >= 0;
486  }

References m_originNet.

◆ IsConflicting()

bool CN_CLUSTER::IsConflicting ( ) const
inline

Definition at line 514 of file connectivity_items.h.

515  {
516  return m_conflicting;
517  }

References m_conflicting.

◆ IsOrphaned()

bool CN_CLUSTER::IsOrphaned ( ) const
inline

Definition at line 509 of file connectivity_items.h.

510  {
511  return m_originPad == nullptr;
512  }
CN_ITEM * m_originPad

References m_originPad.

◆ OriginNet()

int CN_CLUSTER::OriginNet ( ) const
inline

Definition at line 488 of file connectivity_items.h.

489  {
490  return m_originNet;
491  }

References m_originNet.

◆ OriginNetName()

wxString CN_CLUSTER::OriginNetName ( ) const

Definition at line 294 of file connectivity_items.cpp.

295 {
296  if( !m_originPad || !m_originPad->Valid() )
297  return "<none>";
298  else
299  return m_originPad->Parent()->GetNetname();
300 }
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 499 of file connectivity_items.h.

500  {
501  return m_items.size();
502  }
std::vector< CN_ITEM * > m_items

References m_items.

Member Data Documentation

◆ m_conflicting

bool CN_CLUSTER::m_conflicting = false
private

Definition at line 474 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 477 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 475 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 476 of file connectivity_items.h.

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


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