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 throw ( IO_ERROR )
 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) throw ( IO_ERROR )
 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 1522 of file specctra.h.

Member Typedef Documentation

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

Definition at line 1547 of file specctra.h.

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

Definition at line 1542 of file specctra.h.

Constructor & Destructor Documentation

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

Definition at line 1552 of file specctra.h.

1552  :
1553  ELEM_HOLDER( T_structure, aParent )
1554  {
1555  unit = 0;
1556  layer_noise_weight = 0;
1557  boundary = 0;
1558  place_boundary = 0;
1559  via = 0;
1560  control = 0;
1561  rules = 0;
1562  place_rules = 0;
1563  }
RULE * rules
Definition: specctra.h:1536
UNIT_RES * unit
Definition: specctra.h:1526
BOUNDARY * place_boundary
Definition: specctra.h:1533
CONTROL * control
Definition: specctra.h:1535
RULE * place_rules
Definition: specctra.h:1545
LAYER_NOISE_WEIGHT * layer_noise_weight
Definition: specctra.h:1530
BOUNDARY * boundary
Definition: specctra.h:1532
ELEM_HOLDER(DSN_T aType, ELEM *aParent=0)
Definition: specctra.h:291
DSN::STRUCTURE::~STRUCTURE ( )
inline

Definition at line 1565 of file specctra.h.

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

1566  {
1567  delete unit;
1568  delete layer_noise_weight;
1569  delete boundary;
1570  delete place_boundary;
1571  delete via;
1572  delete control;
1573  delete rules;
1574  delete place_rules;
1575  }
RULE * rules
Definition: specctra.h:1536
UNIT_RES * unit
Definition: specctra.h:1526
BOUNDARY * place_boundary
Definition: specctra.h:1533
CONTROL * control
Definition: specctra.h:1535
RULE * place_rules
Definition: specctra.h:1545
LAYER_NOISE_WEIGHT * layer_noise_weight
Definition: specctra.h:1530
BOUNDARY * boundary
Definition: specctra.h:1532

Member Function Documentation

void DSN::ELEM_HOLDER::Append ( ELEM aElem)
inlineinherited

Definition at line 321 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::makeIMAGE(), DSN::SPECCTRA_DB::makePADSTACK(), and DSN::SPECCTRA_DB::makeVia().

322  {
323  kids.push_back( aElem );
324  }
ELEM_ARRAY kids
ELEM pointers.
Definition: specctra.h:287
ELEM* DSN::ELEM_HOLDER::At ( int  aIndex) const
inlineinherited

Definition at line 343 of file specctra.h.

Referenced by DSN::CONTROL::Format(), 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:3486
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 3530 of file specctra.cpp.

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

3531 {
3532  int repeats=0;
3533  for( unsigned i=0; i<kids.size(); ++i )
3534  {
3535  if( kids[i].Type() == aType )
3536  {
3537  if( repeats == instanceNum )
3538  return i;
3539  ++repeats;
3540  }
3541  }
3542  return -1;
3543 }
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 
)
throw (IO_ERROR
)
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 3511 of file specctra.cpp.

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

3512 {
3513  out->Print( nestLevel, "(%s\n", Name() );
3514 
3515  FormatContents( out, nestLevel+1 );
3516 
3517  out->Print( nestLevel, ")\n" );
3518 }
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:3497
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Function Print formats and writes text to the output stream.
Definition: richio.cpp:408
void DSN::STRUCTURE::FormatContents ( OUTPUTFORMATTER out,
int  nestLevel 
)
throw (IO_ERROR
)
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 1595 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().

1596  {
1597  if( unit )
1598  unit->Format( out, nestLevel );
1599 
1600  for( LAYERS::iterator i=layers.begin(); i!=layers.end(); ++i )
1601  i->Format( out, nestLevel );
1602 
1603  if( layer_noise_weight )
1604  layer_noise_weight->Format( out, nestLevel );
1605 
1606  if( boundary )
1607  boundary->Format( out, nestLevel );
1608 
1609  if( place_boundary )
1610  place_boundary->Format( out, nestLevel );
1611 
1612  for( COPPER_PLANES::iterator i=planes.begin(); i!=planes.end(); ++i )
1613  i->Format( out, nestLevel );
1614 
1615  for( REGIONS::iterator i=regions.begin(); i!=regions.end(); ++i )
1616  i->Format( out, nestLevel );
1617 
1618  for( KEEPOUTS::iterator i=keepouts.begin(); i!=keepouts.end(); ++i )
1619  i->Format( out, nestLevel );
1620 
1621  if( via )
1622  via->Format( out, nestLevel );
1623 
1624  if( control )
1625  control->Format( out, nestLevel );
1626 
1627  for( int i=0; i<Length(); ++i )
1628  {
1629  At(i)->Format( out, nestLevel );
1630  }
1631 
1632  if( rules )
1633  rules->Format( out, nestLevel );
1634 
1635  if( place_rules )
1636  place_rules->Format( out, nestLevel );
1637 
1638  for( GRIDS::iterator i=grids.begin(); i!=grids.end(); ++i )
1639  i->Format( out, nestLevel );
1640  }
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:1540
RULE * rules
Definition: specctra.h:1536
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:1526
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:1533
CONTROL * control
Definition: specctra.h:1535
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:1545
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:1306
LAYER_NOISE_WEIGHT * layer_noise_weight
Definition: specctra.h:1530
REGIONS regions
Definition: specctra.h:1543
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:3511
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:1027
BOUNDARY * boundary
Definition: specctra.h:1532
LAYERS layers
Definition: specctra.h:1528
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:1150
KEEPOUTS keepouts
Definition: specctra.h:1538
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 1642 of file specctra.h.

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

1643  {
1644  if( unit )
1645  return unit;
1646 
1647  return ELEM::GetUnits();
1648  }
virtual UNIT_RES * GetUnits() const
Function GetUnits returns the units for this section.
Definition: specctra.cpp:3502
UNIT_RES * unit
Definition: specctra.h:1526
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(), and FormatContents().

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: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
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 1577 of file specctra.h.

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

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

Definition at line 1587 of file specctra.h.

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

1588  {
1589  delete place_boundary;
1590  place_boundary = aBoundary;
1591  if( place_boundary )
1592  place_boundary->SetParent( this );
1593  }
BOUNDARY * place_boundary
Definition: specctra.h:1533
void SetParent(ELEM *aParent)
Definition: specctra.h:269

Friends And Related Function Documentation

friend class SPECCTRA_DB
friend

Definition at line 1524 of file specctra.h.

Member Data Documentation

BOUNDARY* DSN::STRUCTURE::boundary
private

Definition at line 1532 of file specctra.h.

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

CONTROL* DSN::STRUCTURE::control
private

Definition at line 1535 of file specctra.h.

Referenced by ~STRUCTURE().

GRIDS DSN::STRUCTURE::grids
private

Definition at line 1548 of file specctra.h.

KEEPOUTS DSN::STRUCTURE::keepouts
private

Definition at line 1538 of file specctra.h.

LAYER_NOISE_WEIGHT* DSN::STRUCTURE::layer_noise_weight
private

Definition at line 1530 of file specctra.h.

Referenced by ~STRUCTURE().

LAYERS DSN::STRUCTURE::layers
private

Definition at line 1528 of file specctra.h.

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

Referenced by SetPlaceBOUNDARY(), and ~STRUCTURE().

RULE* DSN::STRUCTURE::place_rules
private

Definition at line 1545 of file specctra.h.

Referenced by ~STRUCTURE().

COPPER_PLANES DSN::STRUCTURE::planes
private

Definition at line 1540 of file specctra.h.

REGIONS DSN::STRUCTURE::regions
private

Definition at line 1543 of file specctra.h.

RULE* DSN::STRUCTURE::rules
private

Definition at line 1536 of file specctra.h.

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

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::ELEM::Name(), and DSN::ELEM::Type().

UNIT_RES* DSN::STRUCTURE::unit
private

Definition at line 1526 of file specctra.h.

Referenced by GetUnits(), and ~STRUCTURE().

VIA* DSN::STRUCTURE::via
private

Definition at line 1534 of file specctra.h.

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


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