KiCad PCB EDA Suite
DSN::WIRE Class Reference

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

#include <specctra.h>

Inheritance diagram for DSN::WIRE:
DSN::ELEM

Public Member Functions

 WIRE (ELEM *aParent)
 
 ~WIRE ()
 
void SetShape (ELEM *aShape)
 
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

ELEMshape
 
std::string net_id
 
int turret
 
DSN_T wire_type
 
DSN_T attr
 
std::string shield
 
WINDOWS windows
 
CONNECTconnect
 
bool supply
 

Friends

class SPECCTRA_DB
 

Detailed Description

A <wire_shape_descriptor> in the specctra dsn spec.

Definition at line 2880 of file specctra.h.

Constructor & Destructor Documentation

◆ WIRE()

DSN::WIRE::WIRE ( ELEM aParent)
inline

Definition at line 2883 of file specctra.h.

2883 :
2884 ELEM( T_wire, aParent )
2885 {
2886 shape = 0;
2887 connect = 0;
2888
2889 turret = -1;
2890 wire_type = T_NONE;
2891 attr = T_NONE;
2892 supply = false;
2893 }
ELEM(DSN_T aType, ELEM *aParent=0)
Definition: specctra.cpp:3749
CONNECT * connect
Definition: specctra.h:2979
ELEM * shape
Definition: specctra.h:2971
DSN_T attr
Definition: specctra.h:2976
int turret
Definition: specctra.h:2974
DSN_T wire_type
Definition: specctra.h:2975
bool supply
Definition: specctra.h:2980

References attr, connect, shape, supply, turret, and wire_type.

◆ ~WIRE()

DSN::WIRE::~WIRE ( )
inline

Definition at line 2895 of file specctra.h.

2896 {
2897 delete shape;
2898 delete connect;
2899 }

References connect, and shape.

Member Function Documentation

◆ Format()

void DSN::WIRE::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 2916 of file specctra.h.

2917 {
2918 out->Print( nestLevel, "(%s ", Name() );
2919
2920 if( shape )
2921 shape->Format( out, 0 );
2922
2923 if( net_id.size() )
2924 {
2925 const char* quote = out->GetQuoteChar( net_id.c_str() );
2926 out->Print( 0, "(net %s%s%s)", quote, net_id.c_str(), quote );
2927 }
2928
2929 if( turret >= 0 )
2930 out->Print( 0, "(turrent %d)", turret );
2931
2932 if( wire_type != T_NONE )
2933 out->Print( 0, "(type %s)", GetTokenText( wire_type ) );
2934
2935 if( attr != T_NONE )
2936 out->Print( 0, "(attr %s)", GetTokenText( attr ) );
2937
2938 if( shield.size() )
2939 {
2940 const char* quote = out->GetQuoteChar( shield.c_str() );
2941 out->Print( 0, "(shield %s%s%s)", quote, shield.c_str(), quote );
2942 }
2943
2944 if( windows.size() )
2945 {
2946 out->Print( 0, "\n" );
2947
2948 for( WINDOWS::iterator i = windows.begin(); i != windows.end(); ++i )
2949 i->Format( out, nestLevel + 1 );
2950 }
2951
2952 if( connect )
2953 connect->Format( out, 0 );
2954
2955 if( supply )
2956 out->Print( 0, "(supply)" );
2957
2958 out->Print( 0, ")\n" );
2959 }
const char * Name() const
Definition: specctra.cpp:3760
virtual void Format(OUTPUTFORMATTER *out, int nestLevel)
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
Definition: specctra.cpp:3774
std::string shield
Definition: specctra.h:2977
WINDOWS windows
Definition: specctra.h:2978
std::string net_id
Definition: specctra.h:2973
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, connect, DSN::ELEM::Format(), OUTPUTFORMATTER::GetQuoteChar(), DSN::GetTokenText(), DSN::ELEM::Name(), net_id, OUTPUTFORMATTER::Print(), shape, shield, supply, turret, windows, and wire_type.

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

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

◆ SetShape()

void DSN::WIRE::SetShape ( ELEM aShape)
inline

Definition at line 2901 of file specctra.h.

2902 {
2903 delete shape;
2904 shape = aShape;
2905
2906 if( aShape )
2907 {
2908 wxASSERT(aShape->Type()==T_rect || aShape->Type()==T_circle
2909 || aShape->Type()==T_qarc || aShape->Type()==T_path
2910 || aShape->Type()==T_polygon);
2911
2912 aShape->SetParent( this );
2913 }
2914 }

References DSN::ELEM::SetParent(), shape, and DSN::ELEM::Type().

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

◆ Type()

Friends And Related Function Documentation

◆ SPECCTRA_DB

friend class SPECCTRA_DB
friend

Definition at line 2962 of file specctra.h.

Member Data Documentation

◆ attr

DSN_T DSN::WIRE::attr
private

Definition at line 2976 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE(), Format(), and WIRE().

◆ connect

CONNECT* DSN::WIRE::connect
private

Definition at line 2979 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE(), Format(), WIRE(), and ~WIRE().

◆ net_id

std::string DSN::WIRE::net_id
private

Definition at line 2973 of file specctra.h.

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

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

◆ shape

ELEM* DSN::WIRE::shape
private

◆ shield

std::string DSN::WIRE::shield
private

Definition at line 2977 of file specctra.h.

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

◆ supply

bool DSN::WIRE::supply
private

Definition at line 2980 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE(), Format(), and WIRE().

◆ turret

int DSN::WIRE::turret
private

Definition at line 2974 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doWIRE(), Format(), and WIRE().

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

◆ windows

WINDOWS DSN::WIRE::windows
private

Definition at line 2978 of file specctra.h.

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

◆ wire_type

DSN_T DSN::WIRE::wire_type
private

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