KiCad PCB EDA Suite
DSN::WIRE_VIA Class Reference

A <wire_via_descriptor> in the specctra dsn spec. More...

#include <specctra.h>

Inheritance diagram for DSN::WIRE_VIA:
DSN::ELEM

Public Member Functions

 WIRE_VIA (ELEM *aParent)
 
const std::string & GetPadstackId ()
 
void Format (OUTPUTFORMATTER *out, int nestLevel) override
 Write 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
 Return the units for this section. More...
 
virtual void FormatContents (OUTPUTFORMATTER *out, int nestLevel)
 Write 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 ()
 Return a string which uniquely represents this ELEM among other ELEMs of the same derived class as "this" one. More...
 

Protected Attributes

DSN_T type
 
ELEMparent
 

Static Protected Attributes

static STRING_FORMATTER sf
 

Private Attributes

std::string padstack_id
 
POINTS vertexes
 
std::string net_id
 
int via_number
 
DSN_T via_type
 
DSN_T attr
 
std::string virtual_pin_name
 
STRINGS contact_layers
 
bool supply
 

Friends

class SPECCTRA_DB
 

Detailed Description

A <wire_via_descriptor> in the specctra dsn spec.

Definition at line 2989 of file specctra.h.

Constructor & Destructor Documentation

◆ WIRE_VIA()

DSN::WIRE_VIA::WIRE_VIA ( ELEM aParent)
inline

Definition at line 2992 of file specctra.h.

2992 :
2993 ELEM( T_via, aParent )
2994 {
2995 via_number = -1;
2996 via_type = T_NONE;
2997 attr = T_NONE;
2998 supply = false;
2999 }
ELEM(DSN_T aType, ELEM *aParent=0)
Definition: specctra.cpp:3749
DSN_T via_type
Definition: specctra.h:3123

References attr, supply, via_number, and via_type.

Member Function Documentation

◆ Format()

void DSN::WIRE_VIA::Format ( OUTPUTFORMATTER out,
int  nestLevel 
)
inlineoverridevirtual

Write 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 precede the output with.
Exceptions
IO_ERRORif a system error writing the output, such as a full disk.

Reimplemented from DSN::ELEM.

Definition at line 3006 of file specctra.h.

3007 {
3008 const char* quote = out->GetQuoteChar( padstack_id.c_str() );
3009
3010 const int RIGHTMARGIN = 80;
3011 int perLine = out->Print( nestLevel, "(%s %s%s%s", Name(), quote, padstack_id.c_str(),
3012 quote );
3013
3014 for( POINTS::iterator i = vertexes.begin(); i != vertexes.end(); ++i )
3015 {
3016 if( perLine > RIGHTMARGIN )
3017 {
3018 out->Print( 0, "\n" );
3019 perLine = out->Print( nestLevel+1, "%s", "" );
3020 }
3021 else
3022 {
3023 perLine += out->Print( 0, " " );
3024 }
3025
3026 perLine += out->Print( 0, "%.6g %.6g", i->x, i->y );
3027 }
3028
3029 if( net_id.size() || via_number!=-1 || via_type!=T_NONE || attr!=T_NONE || supply)
3030 out->Print( 0, " " );
3031
3032 if( net_id.size() )
3033 {
3034 if( perLine > RIGHTMARGIN )
3035 {
3036 out->Print( 0, "\n" );
3037 perLine = out->Print( nestLevel+1, "%s", "" );
3038 }
3039
3040 quote = out->GetQuoteChar( net_id.c_str() );
3041 perLine += out->Print( 0, "(net %s%s%s)", quote, net_id.c_str(), quote );
3042 }
3043
3044 if( via_number != -1 )
3045 {
3046 if( perLine > RIGHTMARGIN )
3047 {
3048 out->Print( 0, "\n" );
3049 perLine = out->Print( nestLevel+1, "%s", "" );
3050 }
3051
3052 perLine += out->Print( 0, "(via_number %d)", via_number );
3053 }
3054
3055 if( via_type != T_NONE )
3056 {
3057 if( perLine > RIGHTMARGIN )
3058 {
3059 out->Print( 0, "\n" );
3060 perLine = out->Print( nestLevel+1, "%s", "" );
3061 }
3062
3063 perLine += out->Print( 0, "(type %s)", GetTokenText( via_type ) );
3064 }
3065
3066 if( attr != T_NONE )
3067 {
3068 if( perLine > RIGHTMARGIN )
3069 {
3070 out->Print( 0, "\n" );
3071 perLine = out->Print( nestLevel+1, "%s", "" );
3072 }
3073
3074 if( attr == T_virtual_pin )
3075 {
3076 quote = out->GetQuoteChar( virtual_pin_name.c_str() );
3077 perLine += out->Print( 0, "(attr virtual_pin %s%s%s)", quote,
3078 virtual_pin_name.c_str(), quote );
3079 }
3080 else
3081 {
3082 perLine += out->Print( 0, "(attr %s)", GetTokenText( attr ) );
3083 }
3084 }
3085
3086 if( supply )
3087 {
3088 if( perLine > RIGHTMARGIN )
3089 {
3090 out->Print( 0, "\n" );
3091 perLine = out->Print( nestLevel+1, "%s", "" );
3092 }
3093
3094 perLine += out->Print( 0, "(supply)" );
3095 }
3096
3097 if( contact_layers.size() )
3098 {
3099 out->Print( 0, "\n" );
3100 out->Print( nestLevel+1, "(contact\n" );
3101
3102 for( STRINGS::iterator i = contact_layers.begin(); i != contact_layers.end(); ++i )
3103 {
3104 quote = out->GetQuoteChar( i->c_str() );
3105 out->Print( nestLevel+2, "%s%s%s\n", quote, i->c_str(), quote );
3106 }
3107
3108 out->Print( nestLevel+1, "))\n" );
3109 }
3110 else
3111 {
3112 out->Print( 0, ")\n" );
3113 }
3114 }
const char * Name() const
Definition: specctra.cpp:3760
std::string virtual_pin_name
Definition: specctra.h:3125
POINTS vertexes
Definition: specctra.h:3120
std::string net_id
Definition: specctra.h:3121
STRINGS contact_layers
Definition: specctra.h:3126
std::string padstack_id
Definition: specctra.h:3119
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:433
static const char * GetQuoteChar(const char *wrapee, const char *quote_char)
Perform quote character need determination according to the Specctra DSN specification.
Definition: richio.cpp:355
const char * GetTokenText(T aTok)
The DSN namespace and returns the C string representing a SPECCTRA_DB::keyword.
Definition: specctra.cpp:70

References attr, contact_layers, OUTPUTFORMATTER::GetQuoteChar(), DSN::GetTokenText(), DSN::ELEM::Name(), net_id, padstack_id, OUTPUTFORMATTER::Print(), supply, vertexes, via_number, via_type, and virtual_pin_name.

◆ FormatContents()

virtual void DSN::ELEM::FormatContents ( OUTPUTFORMATTER out,
int  nestLevel 
)
inlinevirtualinherited

Write 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 precede the output with.
Exceptions
IO_ERRORif a system error writing the output, such as a full disk.

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

Definition at line 242 of file specctra.h.

243 {
244 // overridden in ELEM_HOLDER
245 }

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

◆ GetPadstackId()

const std::string & DSN::WIRE_VIA::GetPadstackId ( )
inline

Definition at line 3001 of file specctra.h.

3002 {
3003 return padstack_id;
3004 }

References padstack_id.

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

◆ GetUnits()

UNIT_RES * DSN::ELEM::GetUnits ( ) const
virtualinherited

Return the units for this section.

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

Returns
an element from a local or parent scope.

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

Definition at line 3765 of file specctra.cpp.

3766{
3767 if( parent )
3768 return parent->GetUnits();
3769
3770 return &UNIT_RES::Default;
3771}
ELEM * parent
Definition: specctra.h:276
virtual UNIT_RES * GetUnits() const
Return the units for this section.
Definition: specctra.cpp:3765
static UNIT_RES Default
A static instance which holds the default units of T_inch and 2540000.
Definition: specctra.h:410

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().

◆ makeHash()

std::string DSN::ELEM::makeHash ( )
inlineprotectedinherited

Return a string which uniquely represents this ELEM among other ELEMs of the same derived class as "this" one.

It is not usable 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 263 of file specctra.h.

264 {
265 sf.Clear();
266 FormatContents( &sf, 0 );
268
269 return sf.GetString();
270 }
virtual void FormatContents(OUTPUTFORMATTER *out, int nestLevel)
Write the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
Definition: specctra.h:242
static STRING_FORMATTER sf
Definition: specctra.h:273
void StripUseless()
Removes whitespace, '(', and ')' from the string.
Definition: richio.cpp:519
const std::string & GetString()
Definition: richio.h:438
void Clear()
Clear the buffer and empties the internal string.
Definition: richio.h:428

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().

◆ Name()

◆ SetParent()

◆ Type()

Friends And Related Function Documentation

◆ SPECCTRA_DB

friend class SPECCTRA_DB
friend

Definition at line 3117 of file specctra.h.

Member Data Documentation

◆ attr

DSN_T DSN::WIRE_VIA::attr
private

Definition at line 3124 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE_VIA(), Format(), and WIRE_VIA().

◆ contact_layers

STRINGS DSN::WIRE_VIA::contact_layers
private

Definition at line 3126 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE_VIA(), and Format().

◆ net_id

std::string DSN::WIRE_VIA::net_id
private

Definition at line 3121 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE_VIA(), Format(), and DSN::SPECCTRA_DB::FromBOARD().

◆ padstack_id

std::string DSN::WIRE_VIA::padstack_id
private

◆ parent

ELEM* DSN::ELEM::parent
protectedinherited

Definition at line 276 of file specctra.h.

Referenced by DSN::ELEM::GetUnits(), and DSN::ELEM::SetParent().

◆ sf

STRING_FORMATTER DSN::ELEM::sf
staticprotectedinherited

Definition at line 273 of file specctra.h.

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

◆ supply

bool DSN::WIRE_VIA::supply
private

Definition at line 3127 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE_VIA(), Format(), and WIRE_VIA().

◆ type

DSN_T DSN::ELEM::type
protectedinherited

Definition at line 275 of file specctra.h.

Referenced by DSN::UNIT_RES::Format(), DSN::ELEM::Name(), and DSN::ELEM::Type().

◆ vertexes

POINTS DSN::WIRE_VIA::vertexes
private

◆ via_number

int DSN::WIRE_VIA::via_number
private

Definition at line 3122 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE_VIA(), Format(), and WIRE_VIA().

◆ via_type

DSN_T DSN::WIRE_VIA::via_type
private

◆ virtual_pin_name

std::string DSN::WIRE_VIA::virtual_pin_name
private

Definition at line 3125 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE_VIA(), and Format().


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