KiCad PCB EDA Suite
DSN::NET Class Reference

Class NET corresponds to a <net_descriptor> in the DSN spec. More...

#include <specctra.h>

Inheritance diagram for DSN::NET:
DSN::ELEM

Public Member Functions

 NET (ELEM *aParent)
 
 ~NET ()
 
int FindPIN_REF (const std::string &aComponent)
 
void Format (OUTPUTFORMATTER *out, int nestLevel) override
 Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format. More...
 
DSN_T Type () const
 
const char * Name () const
 
virtual UNIT_RESGetUnits () const
 Function GetUnits returns the units for this section. More...
 
virtual void FormatContents (OUTPUTFORMATTER *out, int nestLevel)
 Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format. More...
 
void SetParent (ELEM *aParent)
 

Protected Member Functions

std::string makeHash ()
 Function makeHash returns a string which uniquely represents this ELEM amoung other ELEMs of the same derived class as "this" one. More...
 

Protected Attributes

ELEMparent
 

Static Protected Attributes

static STRING_FORMATTER sf
 

Private Attributes

std::string net_id
 
bool unassigned
 
int net_number
 
DSN_T pins_type
 T_pins | T_order, type of field 'pins' below. More...
 
PIN_REFS pins
 
PIN_REFS expose
 
PIN_REFS noexpose
 
PIN_REFS source
 
PIN_REFS load
 
PIN_REFS terminator
 
DSN_T type
 T_fix | T_normal. More...
 
DSN_T supply
 T_power | T_ground. More...
 
RULErules
 
LAYER_RULES layer_rules
 
FROMTOS fromtos
 
COMP_ORDERcomp_order
 

Friends

class SPECCTRA_DB
 

Detailed Description

Class NET corresponds to a <net_descriptor> in the DSN spec.

Definition at line 2565 of file specctra.h.

Constructor & Destructor Documentation

DSN::NET::NET ( ELEM aParent)
inline

Definition at line 2596 of file specctra.h.

References DSN::T_NONE, and DSN::T_pins.

2596  :
2597  ELEM( T_net, aParent )
2598  {
2599  unassigned = false;
2600  net_number = T_NONE;
2601  pins_type = T_pins;
2602 
2603  type = T_NONE;
2604  supply = T_NONE;
2605 
2606  rules = 0;
2607  comp_order = 0;
2608  }
ELEM(DSN_T aType, ELEM *aParent=0)
Definition: specctra.cpp:3486
RULE * rules
Definition: specctra.h:2586
DSN_T type
T_fix | T_normal.
Definition: specctra.h:2582
COMP_ORDER * comp_order
Definition: specctra.h:2592
bool unassigned
Definition: specctra.h:2570
int net_number
Definition: specctra.h:2571
DSN_T supply
T_power | T_ground.
Definition: specctra.h:2584
DSN_T pins_type
T_pins | T_order, type of field 'pins' below.
Definition: specctra.h:2573
DSN::NET::~NET ( )
inline

Definition at line 2610 of file specctra.h.

References comp_order, and rules.

2611  {
2612  delete rules;
2613  delete comp_order;
2614  }
RULE * rules
Definition: specctra.h:2586
COMP_ORDER * comp_order
Definition: specctra.h:2592

Member Function Documentation

int DSN::NET::FindPIN_REF ( const std::string &  aComponent)
inline

Definition at line 2616 of file specctra.h.

2617  {
2618  for( unsigned i=0; i<pins.size(); ++i )
2619  {
2620  if( 0 == aComponent.compare( pins[i].component_id ) )
2621  return int(i);
2622  }
2623  return -1;
2624  }
PIN_REFS pins
Definition: specctra.h:2574
void DSN::NET::Format ( OUTPUTFORMATTER out,
int  nestLevel 
)
inlineoverridevirtual

Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.

Parameters
outThe formatter to write to.
nestLevelA multiple of the number of spaces to preceed the output with.
Exceptions
IO_ERRORif a system error writing the output, such as a full disk.

Reimplemented from DSN::ELEM.

Definition at line 2626 of file specctra.h.

References DSN::RULE::Format(), DSN::COMP_ORDER::Format(), OUTPUTFORMATTER::GetQuoteChar(), DSN::GetTokenText(), DSN::ELEM::Name(), OUTPUTFORMATTER::Print(), and DSN::T_NONE.

2627  {
2628  const char* quote = out->GetQuoteChar( net_id.c_str() );
2629  const char* space = " ";
2630 
2631  out->Print( nestLevel, "(%s %s%s%s", Name(),
2632  quote, net_id.c_str(), quote );
2633 
2634  if( unassigned )
2635  {
2636  out->Print( 0, "%s(unassigned)", space );
2637  space = ""; // only needed one space
2638  }
2639 
2640  if( net_number != T_NONE )
2641  {
2642  out->Print( 0, "%s(net_number %d)", space, net_number );
2643  // space = "";
2644  }
2645 
2646  out->Print( 0, "\n" );
2647 
2648  if( pins.size() )
2649  {
2650  const int RIGHTMARGIN = 80;
2651  int perLine = out->Print( nestLevel+1, "(%s", GetTokenText( pins_type ) );
2652 
2653  for( PIN_REFS::iterator i=pins.begin(); i!=pins.end(); ++i )
2654  {
2655  if( perLine > RIGHTMARGIN )
2656  {
2657  out->Print( 0, "\n");
2658  perLine = out->Print( nestLevel+2, "%s", "" );
2659  }
2660  else
2661  perLine += out->Print( 0, " " );
2662 
2663  perLine += i->FormatIt( out, 0 );
2664  }
2665  out->Print( 0, ")\n" );
2666  }
2667 
2668  if( comp_order )
2669  comp_order->Format( out, nestLevel+1 );
2670 
2671  if( type != T_NONE )
2672  out->Print( nestLevel+1, "(type %s)\n", GetTokenText( type ) );
2673 
2674  if( rules )
2675  rules->Format( out, nestLevel+1 );
2676 
2677  for( LAYER_RULES::iterator i=layer_rules.begin(); i!=layer_rules.end(); ++i )
2678  i->Format( out, nestLevel+1 );
2679 
2680  for( FROMTOS::iterator i=fromtos.begin(); i!=fromtos.end(); ++i )
2681  i->Format( out, nestLevel+1 );
2682 
2683  out->Print( nestLevel, ")\n" );
2684  }
std::string net_id
Definition: specctra.h:2569
FROMTOS fromtos
Definition: specctra.h:2590
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:505
RULE * rules
Definition: specctra.h:2586
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.h:2543
DSN_T type
T_fix | T_normal.
Definition: specctra.h:2582
COMP_ORDER * comp_order
Definition: specctra.h:2592
bool unassigned
Definition: specctra.h:2570
const char * Name() const
Definition: specctra.cpp:3497
int net_number
Definition: specctra.h:2571
static const char * GetQuoteChar(const char *wrapee, const char *quote_char)
Function GetQuoteChar performs quote character need determination according to the Specctra DSN speci...
Definition: richio.cpp:331
LAYER_RULES layer_rules
Definition: specctra.h:2588
const char * GetTokenText(T aTok)
Function GetTokenText is in the DSN namespace and returns the C string representing a SPECCTRA_DB::ke...
Definition: specctra.cpp:69
PIN_REFS pins
Definition: specctra.h:2574
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408
DSN_T pins_type
T_pins | T_order, type of field 'pins' below.
Definition: specctra.h:2573
virtual void DSN::ELEM::FormatContents ( OUTPUTFORMATTER out,
int  nestLevel 
)
inlinevirtualinherited

Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.

This is the same as Format() except that the outer wrapper is not included.

Parameters
outThe formatter to write to.
nestLevelA multiple of the number of spaces to preceed the output with.
Exceptions
IO_ERRORif a system error writing the output, such as a full disk.

Reimplemented in DSN::WAS_IS, DSN::ROUTE, DSN::HISTORY, DSN::WIRING, DSN::NETWORK, DSN::TOPOLOGY, DSN::LIBRARY, DSN::PADSTACK, DSN::IMAGE, DSN::PLACEMENT, DSN::COMPONENT, DSN::STRUCTURE, DSN::STRUCTURE_OUT, DSN::REGION, DSN::CLASS_CLASS, DSN::CLASSES, DSN::PARSER, and DSN::ELEM_HOLDER.

Definition at line 264 of file specctra.h.

Referenced by DSN::ELEM::Format(), and DSN::ELEM::makeHash().

265  {
266  // overridden in ELEM_HOLDER
267  }
UNIT_RES * DSN::ELEM::GetUnits ( ) const
virtualinherited

Function GetUnits returns the units for this section.

Derived classes may override this to check for section specific overrides.

Returns
UNIT_RES* - from a local or parent scope

Reimplemented in DSN::ROUTE, DSN::PCB, DSN::WIRING, DSN::LIBRARY, DSN::PADSTACK, DSN::IMAGE, DSN::PLACEMENT, and DSN::STRUCTURE.

Definition at line 3502 of file specctra.cpp.

References DSN::UNIT_RES::Default, DSN::ELEM::GetUnits(), and DSN::ELEM::parent.

Referenced by DSN::SPECCTRA_DB::FromSESSION(), DSN::ELEM::GetUnits(), DSN::STRUCTURE::GetUnits(), DSN::PLACEMENT::GetUnits(), DSN::IMAGE::GetUnits(), DSN::PADSTACK::GetUnits(), DSN::LIBRARY::GetUnits(), DSN::WIRING::GetUnits(), DSN::PCB::GetUnits(), and DSN::ROUTE::GetUnits().

3503 {
3504  if( parent )
3505  return parent->GetUnits();
3506 
3507  return &UNIT_RES::Default;
3508 }
virtual UNIT_RES * GetUnits() const
Function GetUnits returns the units for this section.
Definition: specctra.cpp:3502
ELEM * parent
Definition: specctra.h:200
static UNIT_RES Default
A static instance which holds the default units of T_inch and 2540000.
Definition: specctra.h:414
std::string DSN::ELEM::makeHash ( )
inlineprotectedinherited

Function makeHash returns a string which uniquely represents this ELEM amoung other ELEMs of the same derived class as "this" one.

It is not useable for all derived classes, only those which plan for it by implementing a FormatContents() function that captures all info which will be used in the subsequent string compare. THIS SHOULD NORMALLY EXCLUDE THE TYPENAME, AND INSTANCE NAME OR ID AS WELL.

Definition at line 212 of file specctra.h.

References STRING_FORMATTER::Clear(), DSN::ELEM::FormatContents(), STRING_FORMATTER::GetString(), DSN::ELEM::sf, and STRING_FORMATTER::StripUseless().

Referenced by DSN::IMAGE::Compare(), and DSN::PADSTACK::Compare().

213  {
214  sf.Clear();
215  FormatContents( &sf, 0 );
216  sf.StripUseless();
217 
218  return sf.GetString();
219  }
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel)
Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECC...
Definition: specctra.h:264
const std::string & GetString()
Definition: richio.h:475
void StripUseless()
Function StripUseless removes whitespace, '(', and ')' from the mystring.
Definition: richio.cpp:504
static STRING_FORMATTER sf
Definition: specctra.h:222
void Clear()
Function Clear clears the buffer and empties the internal string.
Definition: richio.h:464

Friends And Related Function Documentation

friend class SPECCTRA_DB
friend

Definition at line 2567 of file specctra.h.

Member Data Documentation

COMP_ORDER* DSN::NET::comp_order
private

Definition at line 2592 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET(), and ~NET().

PIN_REFS DSN::NET::expose
private

Definition at line 2576 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

FROMTOS DSN::NET::fromtos
private

Definition at line 2590 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

LAYER_RULES DSN::NET::layer_rules
private

Definition at line 2588 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

PIN_REFS DSN::NET::load
private

Definition at line 2579 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

std::string DSN::NET::net_id
private

Definition at line 2569 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET(), and DSN::SPECCTRA_DB::FromBOARD().

int DSN::NET::net_number
private

Definition at line 2571 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

PIN_REFS DSN::NET::noexpose
private

Definition at line 2577 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

ELEM* DSN::ELEM::parent
protectedinherited

Definition at line 200 of file specctra.h.

Referenced by DSN::ELEM::GetUnits().

PIN_REFS DSN::NET::pins
private

Definition at line 2574 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET(), and DSN::SPECCTRA_DB::FromBOARD().

DSN_T DSN::NET::pins_type
private

T_pins | T_order, type of field 'pins' below.

Definition at line 2573 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

RULE* DSN::NET::rules
private

Definition at line 2586 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET(), and ~NET().

STRING_FORMATTER DSN::ELEM::sf
staticprotectedinherited

Definition at line 222 of file specctra.h.

Referenced by DSN::ELEM::makeHash().

PIN_REFS DSN::NET::source
private

Definition at line 2578 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

DSN_T DSN::NET::supply
private

T_power | T_ground.

Definition at line 2584 of file specctra.h.

PIN_REFS DSN::NET::terminator
private

Definition at line 2580 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

DSN_T DSN::NET::type
private

T_fix | T_normal.

Definition at line 2582 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().

bool DSN::NET::unassigned
private

Definition at line 2570 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doNET().


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