KiCad PCB EDA Suite
DSN::STRUCTURE Class Reference

#include <specctra.h>

Inheritance diagram for DSN::STRUCTURE:
DSN::ELEM_HOLDER DSN::ELEM

Public Member Functions

 STRUCTURE (ELEM *aParent)
 
 ~STRUCTURE ()
 
void SetBOUNDARY (BOUNDARY *aBoundary)
 
void SetPlaceBOUNDARY (BOUNDARY *aBoundary)
 
void FormatContents (OUTPUTFORMATTER *out, int nestLevel) override
 Function FormatContents writes the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format. More...
 
UNIT_RESGetUnits () const override
 Function GetUnits returns the units for this section. More...
 
int FindElem (DSN_T aType, int instanceNum=0)
 Function FindElem finds a particular instance number of a given type of ELEM. More...
 
int Length () const
 Function Length returns the number of ELEMs in this ELEM. More...
 
void Append (ELEM *aElem)
 
ELEMReplace (int aIndex, ELEM *aElem)
 
ELEMRemove (int aIndex)
 
void Insert (int aIndex, ELEM *aElem)
 
ELEMAt (int aIndex) const
 
ELEMoperator[] (int aIndex) const
 
void Delete (int aIndex)
 
DSN_T Type () const
 
const char * Name () const
 
virtual void Format (OUTPUTFORMATTER *out, int nestLevel)
 Function Format writes this object 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

DSN_T type
 
ELEMparent
 

Static Protected Attributes

static STRING_FORMATTER sf
 

Private Types

typedef boost::ptr_vector< REGIONREGIONS
 
typedef boost::ptr_vector< GRIDGRIDS
 

Private Attributes

UNIT_RESunit
 
LAYERS layers
 
LAYER_NOISE_WEIGHTlayer_noise_weight
 
BOUNDARYboundary
 
BOUNDARYplace_boundary
 
VIAvia
 
CONTROLcontrol
 
RULErules
 
KEEPOUTS keepouts
 
COPPER_PLANES planes
 
REGIONS regions
 
RULEplace_rules
 
GRIDS grids
 

Friends

class SPECCTRA_DB
 

Detailed Description

Definition at line 1525 of file specctra.h.

Member Typedef Documentation

typedef boost::ptr_vector<GRID> DSN::STRUCTURE::GRIDS
private

Definition at line 1550 of file specctra.h.

typedef boost::ptr_vector<REGION> DSN::STRUCTURE::REGIONS
private

Definition at line 1545 of file specctra.h.

Constructor & Destructor Documentation

DSN::STRUCTURE::STRUCTURE ( ELEM aParent)
inline

Definition at line 1555 of file specctra.h.

1555  :
1556  ELEM_HOLDER( T_structure, aParent )
1557  {
1558  unit = 0;
1559  layer_noise_weight = 0;
1560  boundary = 0;
1561  place_boundary = 0;
1562  via = 0;
1563  control = 0;
1564  rules = 0;
1565  place_rules = 0;
1566  }
RULE * rules
Definition: specctra.h:1539
UNIT_RES * unit
Definition: specctra.h:1529
BOUNDARY * place_boundary
Definition: specctra.h:1536
CONTROL * control
Definition: specctra.h:1538
RULE * place_rules
Definition: specctra.h:1548
LAYER_NOISE_WEIGHT * layer_noise_weight
Definition: specctra.h:1533
BOUNDARY * boundary
Definition: specctra.h:1535
ELEM_HOLDER(DSN_T aType, ELEM *aParent=0)
Definition: specctra.h:291
DSN::STRUCTURE::~STRUCTURE ( )
inline

Definition at line 1568 of file specctra.h.

References boundary, control, layer_noise_weight, place_boundary, place_rules, rules, unit, and via.

1569  {
1570  delete unit;
1571  delete layer_noise_weight;
1572  delete boundary;
1573  delete place_boundary;
1574  delete via;
1575  delete control;
1576  delete rules;
1577  delete place_rules;
1578  }
RULE * rules
Definition: specctra.h:1539
UNIT_RES * unit
Definition: specctra.h:1529
BOUNDARY * place_boundary
Definition: specctra.h:1536
CONTROL * control
Definition: specctra.h:1538
RULE * place_rules
Definition: specctra.h:1548
LAYER_NOISE_WEIGHT * layer_noise_weight
Definition: specctra.h:1533
BOUNDARY * boundary
Definition: specctra.h:1535

Member Function Documentation

ELEM* DSN::ELEM_HOLDER::At ( int  aIndex) const
inlineinherited

Definition at line 343 of file specctra.h.

Referenced by DSN::CONTROL::Format(), DSN::ELEM_HOLDER::FormatContents(), FormatContents(), and DSN::ELEM_HOLDER::operator[]().

344  {
345  // we have varying sized objects and are using polymorphism, so we
346  // must return a pointer not a reference.
347  return (ELEM*) &kids[aIndex];
348  }
ELEM(DSN_T aType, ELEM *aParent=0)
Definition: specctra.cpp:3490
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
void DSN::ELEM_HOLDER::Delete ( int  aIndex)
inlineinherited

Definition at line 355 of file specctra.h.

356  {
357  kids.erase( kids.begin()+aIndex );
358  }
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
int DSN::ELEM_HOLDER::FindElem ( DSN_T  aType,
int  instanceNum = 0 
)
inherited

Function FindElem finds a particular instance number of a given type of ELEM.

Parameters
aTypeThe type of ELEM to find
instanceNumThe instance number of to find: 0 for first, 1 for second, etc.
Returns
int - The index into the kids array or -1 if not found.

Definition at line 3534 of file specctra.cpp.

References DSN::ELEM_HOLDER::kids, and DSN::ELEM::Type().

3535 {
3536  int repeats=0;
3537  for( unsigned i=0; i<kids.size(); ++i )
3538  {
3539  if( kids[i].Type() == aType )
3540  {
3541  if( repeats == instanceNum )
3542  return i;
3543  ++repeats;
3544  }
3545  }
3546  return -1;
3547 }
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
DSN_T Type() const
Definition: specctra.h:231
void DSN::ELEM::Format ( OUTPUTFORMATTER out,
int  nestLevel 
)
virtualinherited

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 in DSN::SESSION, DSN::NET_OUT, DSN::SUPPLY_PIN, DSN::ANCESTOR, DSN::PCB, DSN::WIRE_VIA, DSN::WIRE, DSN::CLASS, DSN::NET, DSN::COMP_ORDER, DSN::FROMTO, DSN::PADSTACK, DSN::IMAGE, DSN::PIN, DSN::SHAPE, DSN::COMPONENT, DSN::PLACE, DSN::GRID, DSN::STRINGPROP, DSN::TOKPROP, DSN::LAYER_NOISE_WEIGHT, DSN::SPECCTRA_LAYER_PAIR, DSN::LAYER, DSN::CONTROL, DSN::VIA, DSN::KEEPOUT, DSN::WINDOW, DSN::QARC, DSN::CIRCLE, DSN::BOUNDARY, DSN::PATH, DSN::LAYER_RULE, DSN::RULE, DSN::RECTANGLE, and DSN::UNIT_RES.

Definition at line 3515 of file specctra.cpp.

References DSN::ELEM::FormatContents(), DSN::ELEM::Name(), and OUTPUTFORMATTER::Print().

Referenced by DSN::WINDOW::Format(), DSN::KEEPOUT::Format(), DSN::CONTROL::Format(), DSN::PLACE::Format(), DSN::SHAPE::Format(), DSN::CLASS::Format(), DSN::WIRE::Format(), DSN::PCB::Format(), DSN::SESSION::Format(), DSN::ELEM_HOLDER::FormatContents(), DSN::CLASS_CLASS::FormatContents(), FormatContents(), and DSN::ROUTE::FormatContents().

3516 {
3517  out->Print( nestLevel, "(%s\n", Name() );
3518 
3519  FormatContents( out, nestLevel+1 );
3520 
3521  out->Print( nestLevel, ")\n" );
3522 }
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 char * Name() const
Definition: specctra.cpp:3501
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:404
void DSN::STRUCTURE::FormatContents ( OUTPUTFORMATTER out,
int  nestLevel 
)
inlineoverridevirtual

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

Definition at line 1598 of file specctra.h.

References DSN::ELEM_HOLDER::At(), DSN::ELEM::Format(), DSN::UNIT_RES::Format(), DSN::RULE::Format(), DSN::BOUNDARY::Format(), DSN::VIA::Format(), DSN::CONTROL::Format(), DSN::LAYER_NOISE_WEIGHT::Format(), and DSN::ELEM_HOLDER::Length().

1599  {
1600  if( unit )
1601  unit->Format( out, nestLevel );
1602 
1603  for( LAYERS::iterator i=layers.begin(); i!=layers.end(); ++i )
1604  i->Format( out, nestLevel );
1605 
1606  if( layer_noise_weight )
1607  layer_noise_weight->Format( out, nestLevel );
1608 
1609  if( boundary )
1610  boundary->Format( out, nestLevel );
1611 
1612  if( place_boundary )
1613  place_boundary->Format( out, nestLevel );
1614 
1615  for( COPPER_PLANES::iterator i=planes.begin(); i!=planes.end(); ++i )
1616  i->Format( out, nestLevel );
1617 
1618  for( REGIONS::iterator i=regions.begin(); i!=regions.end(); ++i )
1619  i->Format( out, nestLevel );
1620 
1621  for( KEEPOUTS::iterator i=keepouts.begin(); i!=keepouts.end(); ++i )
1622  i->Format( out, nestLevel );
1623 
1624  if( via )
1625  via->Format( out, nestLevel );
1626 
1627  if( control )
1628  control->Format( out, nestLevel );
1629 
1630  for( int i=0; i<Length(); ++i )
1631  {
1632  At(i)->Format( out, nestLevel );
1633  }
1634 
1635  if( rules )
1636  rules->Format( out, nestLevel );
1637 
1638  if( place_rules )
1639  place_rules->Format( out, nestLevel );
1640 
1641  for( GRIDS::iterator i=grids.begin(); i!=grids.end(); ++i )
1642  i->Format( out, nestLevel );
1643  }
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:705
COPPER_PLANES planes
Definition: specctra.h:1543
RULE * rules
Definition: specctra.h:1539
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
UNIT_RES * unit
Definition: specctra.h:1529
int Length() const
Function Length returns the number of ELEMs in this ELEM.
Definition: specctra.h:316
ELEM * At(int aIndex) const
Definition: specctra.h:343
BOUNDARY * place_boundary
Definition: specctra.h:1536
CONTROL * control
Definition: specctra.h:1538
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:426
RULE * place_rules
Definition: specctra.h:1548
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:1309
LAYER_NOISE_WEIGHT * layer_noise_weight
Definition: specctra.h:1533
REGIONS regions
Definition: specctra.h:1546
virtual void Format(OUTPUTFORMATTER *out, int nestLevel)
Function Format writes this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN f...
Definition: specctra.cpp:3515
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:1030
BOUNDARY * boundary
Definition: specctra.h:1535
LAYERS layers
Definition: specctra.h:1531
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:1153
KEEPOUTS keepouts
Definition: specctra.h:1541
UNIT_RES* DSN::STRUCTURE::GetUnits ( ) const
inlineoverridevirtual

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

Definition at line 1645 of file specctra.h.

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

1646  {
1647  if( unit )
1648  return unit;
1649 
1650  return ELEM::GetUnits();
1651  }
virtual UNIT_RES * GetUnits() const
Function GetUnits returns the units for this section.
Definition: specctra.cpp:3506
UNIT_RES * unit
Definition: specctra.h:1529
void DSN::ELEM_HOLDER::Insert ( int  aIndex,
ELEM aElem 
)
inlineinherited

Definition at line 338 of file specctra.h.

339  {
340  kids.insert( kids.begin()+aIndex, aElem );
341  }
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
int DSN::ELEM_HOLDER::Length ( ) const
inlineinherited

Function Length returns the number of ELEMs in this ELEM.

Returns
int - the count of children

Definition at line 316 of file specctra.h.

Referenced by DSN::CONTROL::Format(), DSN::ELEM_HOLDER::FormatContents(), FormatContents(), and DSN::SPECCTRA_DB::makeVIA().

317  {
318  return kids.size();
319  }
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
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:500
static STRING_FORMATTER sf
Definition: specctra.h:222
void Clear()
Function Clear clears the buffer and empties the internal string.
Definition: richio.h:464
ELEM* DSN::ELEM_HOLDER::operator[] ( int  aIndex) const
inlineinherited

Definition at line 350 of file specctra.h.

References DSN::ELEM_HOLDER::At().

351  {
352  return At( aIndex );
353  }
ELEM * At(int aIndex) const
Definition: specctra.h:343
ELEM* DSN::ELEM_HOLDER::Remove ( int  aIndex)
inlineinherited

Definition at line 332 of file specctra.h.

333  {
334  ELEM_ARRAY::auto_type ret = kids.release( kids.begin()+aIndex );
335  return ret.release();
336  }
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
ELEM* DSN::ELEM_HOLDER::Replace ( int  aIndex,
ELEM aElem 
)
inlineinherited

Definition at line 326 of file specctra.h.

327  {
328  ELEM_ARRAY::auto_type ret = kids.replace( aIndex, aElem );
329  return ret.release();
330  }
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
void DSN::STRUCTURE::SetBOUNDARY ( BOUNDARY aBoundary)
inline

Definition at line 1580 of file specctra.h.

References boundary, and DSN::ELEM::SetParent().

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

1581  {
1582  delete boundary;
1583  boundary = aBoundary;
1584  if( boundary )
1585  {
1586  boundary->SetParent( this );
1587  }
1588  }
BOUNDARY * boundary
Definition: specctra.h:1535
void SetParent(ELEM *aParent)
Definition: specctra.h:269
void DSN::STRUCTURE::SetPlaceBOUNDARY ( BOUNDARY aBoundary)
inline

Definition at line 1590 of file specctra.h.

References place_boundary, and DSN::ELEM::SetParent().

1591  {
1592  delete place_boundary;
1593  place_boundary = aBoundary;
1594  if( place_boundary )
1595  place_boundary->SetParent( this );
1596  }
BOUNDARY * place_boundary
Definition: specctra.h:1536
void SetParent(ELEM *aParent)
Definition: specctra.h:269

Friends And Related Function Documentation

friend class SPECCTRA_DB
friend

Definition at line 1527 of file specctra.h.

Member Data Documentation

BOUNDARY* DSN::STRUCTURE::boundary
private
CONTROL* DSN::STRUCTURE::control
private

Definition at line 1538 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doSTRUCTURE(), and ~STRUCTURE().

GRIDS DSN::STRUCTURE::grids
private

Definition at line 1551 of file specctra.h.

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

KEEPOUTS DSN::STRUCTURE::keepouts
private
LAYER_NOISE_WEIGHT* DSN::STRUCTURE::layer_noise_weight
private

Definition at line 1533 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doSTRUCTURE(), and ~STRUCTURE().

LAYERS DSN::STRUCTURE::layers
private

Definition at line 1531 of file specctra.h.

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

ELEM* DSN::ELEM::parent
protectedinherited

Definition at line 200 of file specctra.h.

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

BOUNDARY* DSN::STRUCTURE::place_boundary
private

Definition at line 1536 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doSTRUCTURE(), SetPlaceBOUNDARY(), and ~STRUCTURE().

RULE* DSN::STRUCTURE::place_rules
private

Definition at line 1548 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doSTRUCTURE(), and ~STRUCTURE().

COPPER_PLANES DSN::STRUCTURE::planes
private

Definition at line 1543 of file specctra.h.

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

REGIONS DSN::STRUCTURE::regions
private

Definition at line 1546 of file specctra.h.

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

RULE* DSN::STRUCTURE::rules
private
STRING_FORMATTER DSN::ELEM::sf
staticprotectedinherited

Definition at line 222 of file specctra.h.

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

DSN_T DSN::ELEM::type
protectedinherited

Definition at line 199 of file specctra.h.

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

UNIT_RES* DSN::STRUCTURE::unit
private

Definition at line 1529 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doSTRUCTURE(), GetUnits(), and ~STRUCTURE().

VIA* DSN::STRUCTURE::via
private

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