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

Member Typedef Documentation

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

Definition at line 520 of file connectivity_items.h.

Constructor & Destructor Documentation

CN_CLUSTER::CN_CLUSTER ( )

Definition at line 303 of file connectivity_items.cpp.

304 {
305  m_items.reserve( 64 );
306  m_originPad = nullptr;
307  m_originNet = -1;
308  m_conflicting = false;
309 }
std::vector< CN_ITEM * > m_items
CN_ITEM * m_originPad
CN_CLUSTER::~CN_CLUSTER ( )

Definition at line 312 of file connectivity_items.cpp.

313 {
314 }

Member Function Documentation

void CN_CLUSTER::Add ( CN_ITEM item)

Definition at line 352 of file connectivity_items.cpp.

References CN_ITEM::Net(), CN_ITEM::Parent(), PCB_PAD_T, and EDA_ITEM::Type().

353 {
354  m_items.push_back( item );
355 
356  if( m_originNet < 0 )
357  {
358  m_originNet = item->Net();
359  }
360 
361  if( item->Parent()->Type() == PCB_PAD_T )
362  {
363  if( !m_originPad )
364  {
365  m_originPad = item;
366  m_originNet = item->Net();
367  }
368 
369  if( m_originPad && item->Net() != m_originNet )
370  {
371  m_conflicting = true;
372  }
373  }
374 }
KICAD_T Type() const
Function Type()
Definition: base_struct.h:201
class D_PAD, a pad in a footprint
Definition: typeinfo.h:90
std::vector< CN_ITEM * > m_items
int Net() const
BOARD_CONNECTED_ITEM * Parent() const
CN_ITEM * m_originPad
ITER CN_CLUSTER::begin ( )
inline

Definition at line 522 of file connectivity_items.h.

522 { return m_items.begin(); };
std::vector< CN_ITEM * > m_items
bool CN_CLUSTER::Contains ( const CN_ITEM aItem)

Definition at line 326 of file connectivity_items.cpp.

327 {
328  return std::find( m_items.begin(), m_items.end(), aItem ) != m_items.end();
329 }
std::vector< CN_ITEM * > m_items
bool CN_CLUSTER::Contains ( const BOARD_CONNECTED_ITEM aItem)

Definition at line 332 of file connectivity_items.cpp.

333 {
334  return std::find_if( m_items.begin(), m_items.end(), [ &aItem ] ( const CN_ITEM* item )
335  { return item->Valid() && item->Parent() == aItem; } ) != m_items.end();
336 }
std::vector< CN_ITEM * > m_items
void CN_CLUSTER::Dump ( )

Definition at line 339 of file connectivity_items.cpp.

340 {
341  for( auto item : m_items )
342  {
343  wxLogTrace( "CN", " - item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
344  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
345  printf( "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
346  item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
347  item->Dump();
348  }
349 }
std::vector< CN_ITEM * > m_items
ITER CN_CLUSTER::end ( )
inline

Definition at line 523 of file connectivity_items.h.

523 { return m_items.end(); };
std::vector< CN_ITEM * > m_items
bool CN_CLUSTER::HasNet ( ) const
inline

Definition at line 503 of file connectivity_items.h.

504  {
505  return m_originNet >= 0;
506  }
bool CN_CLUSTER::HasValidNet ( ) const
inline

Definition at line 482 of file connectivity_items.h.

483  {
484  return m_originNet >= 0;
485  }
bool CN_CLUSTER::IsConflicting ( ) const
inline

Definition at line 513 of file connectivity_items.h.

514  {
515  return m_conflicting;
516  }
bool CN_CLUSTER::IsOrphaned ( ) const
inline

Definition at line 508 of file connectivity_items.h.

509  {
510  return m_originPad == nullptr;
511  }
CN_ITEM * m_originPad
int CN_CLUSTER::OriginNet ( ) const
inline

Definition at line 487 of file connectivity_items.h.

488  {
489  return m_originNet;
490  }
wxString CN_CLUSTER::OriginNetName ( ) const

Definition at line 317 of file connectivity_items.cpp.

318 {
319  if( !m_originPad || !m_originPad->Valid() )
320  return "<none>";
321  else
322  return m_originPad->Parent()->GetNetname();
323 }
bool Valid() const
BOARD_CONNECTED_ITEM * Parent() const
const wxString & GetNetname() const
Function GetNetname.
CN_ITEM * m_originPad
int CN_CLUSTER::Size ( ) const
inline

Definition at line 498 of file connectivity_items.h.

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

Member Data Documentation

bool CN_CLUSTER::m_conflicting = false
private

Definition at line 473 of file connectivity_items.h.

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

Definition at line 476 of file connectivity_items.h.

int CN_CLUSTER::m_originNet = 0
private

Definition at line 474 of file connectivity_items.h.

CN_ITEM* CN_CLUSTER::m_originPad = nullptr
private

Definition at line 475 of file connectivity_items.h.


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