KiCad PCB EDA Suite
Loading...
Searching...
No Matches
DSN::LIBRARY Class Reference

A <library_descriptor> in the specctra dsn specification. More...

#include <specctra.h>

Inheritance diagram for DSN::LIBRARY:
DSN::ELEM

Public Member Functions

 LIBRARY (ELEM *aParent, DSN_T aType=T_library)
 
 ~LIBRARY ()
 
void AddPadstack (PADSTACK *aPadstack)
 
int FindIMAGE (IMAGE *aImage)
 Search this LIBRARY for an image which matches the argument.
 
void AppendIMAGE (IMAGE *aImage)
 Add the image to the image list.
 
IMAGELookupIMAGE (IMAGE *aImage)
 Add the image only if one exactly like it does not already exist in the image container.
 
int FindVia (PADSTACK *aVia)
 Search this LIBRARY for a via which matches the argument.
 
void AppendVia (PADSTACK *aVia)
 Add aVia to the internal via container.
 
void AppendPADSTACK (PADSTACK *aPadstack)
 Add the padstack to the padstack container.
 
PADSTACKLookupVia (PADSTACK *aVia)
 Add the via only if one exactly like it does not already exist in the padstack container.
 
PADSTACKFindPADSTACK (const std::string &aPadstackId)
 Search the padstack container by name.
 
void FormatContents (OUTPUTFORMATTER *out, int nestLevel) override
 Write the contents as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
 
UNIT_RESGetUnits () const override
 Return the units for this section.
 
DSN_T Type () const
 
const char * Name () const
 
virtual void Format (OUTPUTFORMATTER *out, int nestLevel)
 Write this object as ASCII out to an OUTPUTFORMATTER according to the SPECCTRA DSN format.
 
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.
 

Protected Attributes

DSN_T type
 
ELEMparent
 

Static Protected Attributes

static STRING_FORMATTER sf
 

Private Attributes

UNIT_RESm_unit
 
IMAGES m_images
 
PADSTACKS m_padstacks
 all except vias, which are in 'vias'
 
PADSTACKS m_vias
 

Friends

class SPECCTRA_DB
 

Detailed Description

A <library_descriptor> in the specctra dsn specification.

Only unit_descriptor, image_descriptors, and padstack_descriptors are included as children at this time.

Definition at line 2250 of file specctra.h.

Constructor & Destructor Documentation

◆ LIBRARY()

DSN::LIBRARY::LIBRARY ( ELEM aParent,
DSN_T  aType = T_library 
)
inline

Definition at line 2253 of file specctra.h.

References m_unit.

◆ ~LIBRARY()

DSN::LIBRARY::~LIBRARY ( )
inline

Definition at line 2260 of file specctra.h.

References m_unit.

Member Function Documentation

◆ AddPadstack()

void DSN::LIBRARY::AddPadstack ( PADSTACK aPadstack)
inline

Definition at line 2265 of file specctra.h.

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

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

◆ AppendIMAGE()

void DSN::LIBRARY::AppendIMAGE ( IMAGE aImage)
inline

Add the image to the image list.

Definition at line 2314 of file specctra.h.

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

Referenced by LookupIMAGE().

◆ AppendPADSTACK()

void DSN::LIBRARY::AppendPADSTACK ( PADSTACK aPadstack)
inline

Add the padstack to the padstack container.

Definition at line 2368 of file specctra.h.

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

◆ AppendVia()

void DSN::LIBRARY::AppendVia ( PADSTACK aVia)
inline

Add aVia to the internal via container.

Definition at line 2358 of file specctra.h.

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

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

◆ FindIMAGE()

int DSN::LIBRARY::FindIMAGE ( IMAGE aImage)
inline

Search this LIBRARY for an image which matches the argument.

Returns
index of image if found, else -1.

Definition at line 2287 of file specctra.h.

References DSN::IMAGE::Compare(), DSN::IMAGE::m_duplicated, DSN::IMAGE::m_image_id, and m_images.

Referenced by LookupIMAGE().

◆ FindPADSTACK()

PADSTACK * DSN::LIBRARY::FindPADSTACK ( const std::string &  aPadstackId)
inline

Search the padstack container by name.

Returns
The PADSTACK with a matching name if it exists, else nullptr.

Definition at line 2398 of file specctra.h.

References DSN::PADSTACK::GetPadstackId(), and m_padstacks.

◆ FindVia()

int DSN::LIBRARY::FindVia ( PADSTACK aVia)
inline

Search this LIBRARY for a via which matches the argument.

Returns
the index found in the padstack list, else -1.

Definition at line 2344 of file specctra.h.

References DSN::PADSTACK::Compare(), and m_vias.

Referenced by LookupVia().

◆ Format()

◆ FormatContents()

void DSN::LIBRARY::FormatContents ( OUTPUTFORMATTER out,
int  nestLevel 
)
inlineoverridevirtual

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

Definition at line 2411 of file specctra.h.

References DSN::UNIT_RES::Format(), m_images, m_padstacks, m_unit, and m_vias.

◆ GetUnits()

UNIT_RES * DSN::LIBRARY::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 2426 of file specctra.h.

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

◆ LookupIMAGE()

IMAGE * DSN::LIBRARY::LookupIMAGE ( IMAGE aImage)
inline

Add the image only if one exactly like it does not already exist in the image container.

Returns
the IMAGE which is registered in the LIBRARY that matches the argument, and it will be either the argument or a previous image which is a duplicate.

Definition at line 2326 of file specctra.h.

References AppendIMAGE(), FindIMAGE(), and m_images.

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

◆ LookupVia()

PADSTACK * DSN::LIBRARY::LookupVia ( PADSTACK aVia)
inline

Add the via only if one exactly like it does not already exist in the padstack container.

Returns
the PADSTACK which is registered in the LIBRARY that matches the argument, and it will be either the argument or a previous padstack which is a duplicate.

Definition at line 2380 of file specctra.h.

References AppendVia(), FindVia(), and m_vias.

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

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

◆ Name()

◆ SetParent()

◆ Type()

Friends And Related Function Documentation

◆ SPECCTRA_DB

friend class SPECCTRA_DB
friend

Definition at line 2435 of file specctra.h.

Member Data Documentation

◆ m_images

IMAGES DSN::LIBRARY::m_images
private

◆ m_padstacks

PADSTACKS DSN::LIBRARY::m_padstacks
private

all except vias, which are in 'vias'

Definition at line 2440 of file specctra.h.

Referenced by AddPadstack(), AppendPADSTACK(), FindPADSTACK(), and FormatContents().

◆ m_unit

UNIT_RES* DSN::LIBRARY::m_unit
private

Definition at line 2437 of file specctra.h.

Referenced by DSN::SPECCTRA_DB::doLIBRARY(), FormatContents(), GetUnits(), LIBRARY(), and ~LIBRARY().

◆ m_vias

PADSTACKS DSN::LIBRARY::m_vias
private

◆ parent

ELEM* DSN::ELEM::parent
protectedinherited

Definition at line 275 of file specctra.h.

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

◆ sf

STRING_FORMATTER DSN::ELEM::sf
staticprotectedinherited

Definition at line 272 of file specctra.h.

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

◆ type

DSN_T DSN::ELEM::type
protectedinherited

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