KiCad PCB EDA Suite
DSN::PCB Class Reference

#include <specctra.h>

Inheritance diagram for DSN::PCB:
DSN::ELEM

Public Member Functions

 PCB (ELEM *aParent=0)
 
 ~PCB ()
 
void Format (OUTPUTFORMATTER *out, int nestLevel) override
 Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format. More...
 
UNIT_RESGetUnits () const override
 Return the units for this section. More...
 
DSN_T Type () const
 
const char * Name () const
 
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 pcbname
 
PARSERparser
 
UNIT_RESresolution
 
UNIT_RESunit
 
STRUCTUREstructure
 
PLACEMENTplacement
 
LIBRARYlibrary
 
NETWORKnetwork
 
WIRINGwiring
 

Friends

class SPECCTRA_DB
 

Detailed Description

Definition at line 3179 of file specctra.h.

Constructor & Destructor Documentation

◆ PCB()

DSN::PCB::PCB ( ELEM aParent = 0)
inline

Definition at line 3182 of file specctra.h.

3182 :
3183 ELEM( T_pcb, aParent )
3184 {
3185 parser = 0;
3186 resolution = 0;
3187 unit = 0;
3188 structure = 0;
3189 placement = 0;
3190 library = 0;
3191 network = 0;
3192 wiring = 0;
3193 }
ELEM(DSN_T aType, ELEM *aParent=0)
Definition: specctra.cpp:3749
STRUCTURE * structure
Definition: specctra.h:3258
UNIT_RES * unit
Definition: specctra.h:3257
WIRING * wiring
Definition: specctra.h:3262
PLACEMENT * placement
Definition: specctra.h:3259
NETWORK * network
Definition: specctra.h:3261
PARSER * parser
Definition: specctra.h:3255
UNIT_RES * resolution
Definition: specctra.h:3256
LIBRARY * library
Definition: specctra.h:3260

References library, network, parser, placement, resolution, structure, unit, and wiring.

◆ ~PCB()

DSN::PCB::~PCB ( )
inline

Definition at line 3195 of file specctra.h.

3196 {
3197 delete parser;
3198 delete resolution;
3199 delete unit;
3200 delete structure;
3201 delete placement;
3202 delete library;
3203 delete network;
3204 delete wiring;
3205 }

References library, network, parser, placement, resolution, structure, unit, and wiring.

Member Function Documentation

◆ Format()

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

3208 {
3209 const char* quote = out->GetQuoteChar( pcbname.c_str() );
3210
3211 out->Print( nestLevel, "(%s %s%s%s\n", Name(), quote, pcbname.c_str(), quote );
3212
3213 if( parser )
3214 parser->Format( out, nestLevel+1 );
3215
3216 if( resolution )
3217 resolution->Format( out, nestLevel+1 );
3218
3219 if( unit )
3220 unit->Format( out, nestLevel+1 );
3221
3222 if( structure )
3223 structure->Format( out, nestLevel+1 );
3224
3225 if( placement )
3226 placement->Format( out, nestLevel+1 );
3227
3228 if( library )
3229 library->Format( out, nestLevel+1 );
3230
3231 if( network )
3232 network->Format( out, nestLevel+1 );
3233
3234 if( wiring )
3235 wiring->Format( out, nestLevel+1 );
3236
3237 out->Print( nestLevel, ")\n" );
3238 }
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 pcbname
Definition: specctra.h:3254
void Format(OUTPUTFORMATTER *out, int nestLevel) override
Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
Definition: specctra.h:422
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

References DSN::ELEM::Format(), DSN::UNIT_RES::Format(), OUTPUTFORMATTER::GetQuoteChar(), library, DSN::ELEM::Name(), network, parser, pcbname, placement, OUTPUTFORMATTER::Print(), resolution, structure, unit, and wiring.

Referenced by DSN::SPECCTRA_DB::ExportPCB(), and main().

◆ 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::PCB::GetUnits ( ) const
inlineoverridevirtual

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 from DSN::ELEM.

Definition at line 3240 of file specctra.h.

3241 {
3242 if( unit )
3243 return unit;
3244
3245 if( resolution )
3246 return resolution->GetUnits();
3247
3248 return ELEM::GetUnits();
3249 }
virtual UNIT_RES * GetUnits() const
Return the units for this section.
Definition: specctra.cpp:3765

References DSN::ELEM::GetUnits(), resolution, and unit.

◆ 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 3252 of file specctra.h.

Member Data Documentation

◆ library

LIBRARY* DSN::PCB::library
private

◆ network

◆ parent

ELEM* DSN::ELEM::parent
protectedinherited

Definition at line 276 of file specctra.h.

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

◆ parser

PARSER* DSN::PCB::parser
private

◆ pcbname

std::string DSN::PCB::pcbname
private

Definition at line 3254 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doPCB(), DSN::SPECCTRA_DB::ExportPCB(), and Format().

◆ placement

PLACEMENT* DSN::PCB::placement
private

◆ resolution

UNIT_RES* DSN::PCB::resolution
private

◆ sf

STRING_FORMATTER DSN::ELEM::sf
staticprotectedinherited

Definition at line 273 of file specctra.h.

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

◆ structure

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

◆ unit

UNIT_RES* DSN::PCB::unit
private

◆ wiring

WIRING* DSN::PCB::wiring
private

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