KiCad PCB EDA Suite
PARAM_CFG_NETCLASSES Class Reference
Inheritance diagram for PARAM_CFG_NETCLASSES:
PARAM_CFG

Public Member Functions

 PARAM_CFG_NETCLASSES (const wxChar *ident, NETCLASSES *ptparam, const wxChar *group=nullptr)
 
void ReadParam (wxConfigBase *aConfig) const override
 Function ReadParam reads the value of the parameter stored in aConfig. More...
 
void SaveParam (wxConfigBase *aConfig) const override
 Function SaveParam saves the value of the parameter stored in aConfig. More...
 

Public Attributes

wxString m_Ident
 Keyword in config data. More...
 
paramcfg_id m_Type
 Type of parameter. More...
 
wxString m_Group
 Group name (this is like a path in the config data) More...
 
bool m_Setup
 Install or Project based parameter, true == install. More...
 
wxString m_Ident_legacy
 

Protected Attributes

NETCLASSESm_Pt_param
 Pointer to the parameter value. More...
 

Detailed Description

Definition at line 414 of file board_design_settings.cpp.

Constructor & Destructor Documentation

◆ PARAM_CFG_NETCLASSES()

PARAM_CFG_NETCLASSES::PARAM_CFG_NETCLASSES ( const wxChar *  ident,
NETCLASSES ptparam,
const wxChar *  group = nullptr 
)
inline

Definition at line 420 of file board_design_settings.cpp.

421  :
422  PARAM_CFG( ident, PARAM_NETCLASSES, group )
423  {
424  m_Pt_param = ptparam;
425  }
NETCLASSES * m_Pt_param
Pointer to the parameter value.
PARAM_CFG(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)

References m_Pt_param.

Member Function Documentation

◆ ReadParam()

void PARAM_CFG_NETCLASSES::ReadParam ( wxConfigBase *  aConfig) const
inlineoverridevirtual

Function ReadParam reads the value of the parameter stored in aConfig.

Parameters
aConfig= the wxConfigBase that holds the parameter

Reimplemented from PARAM_CFG.

Definition at line 427 of file board_design_settings.cpp.

428  {
429  if( !m_Pt_param || !aConfig )
430  return;
431 
432  wxString oldPath = aConfig->GetPath();
433 
434  m_Pt_param->Clear();
435 
436  for( int index = 0; ; ++index )
437  {
438  wxString path = "";
439  NETCLASSPTR netclass;
440  wxString netclassName;
441 
442  if( index == 0 )
443  path = "Default";
444  else
445  path << index;
446 
447  aConfig->SetPath( oldPath );
448  aConfig->SetPath( m_Ident );
449  aConfig->SetPath( path );
450 
451  if( !aConfig->Read( NetclassNameKey, &netclassName ) )
452  break;
453 
454  if( index == 0 )
455  netclass = m_Pt_param->GetDefault();
456  else
457  netclass = std::make_shared<NETCLASS>( netclassName );
458 
459 #define READ_MM( aKey, aDefault ) Millimeter2iu( aConfig->ReadDouble( aKey, aDefault ) )
460  netclass->SetClearance( READ_MM( ClearanceKey, netclass->GetClearance() ) );
461  netclass->SetTrackWidth( READ_MM( TrackWidthKey, netclass->GetTrackWidth() ) );
462  netclass->SetViaDiameter( READ_MM( ViaDiameterKey, netclass->GetViaDiameter() ) );
463  netclass->SetViaDrill( READ_MM( ViaDrillKey, netclass->GetViaDrill() ) );
464  netclass->SetuViaDiameter( READ_MM( uViaDiameterKey, netclass->GetuViaDiameter() ) );
465  netclass->SetuViaDrill( READ_MM( uViaDrillKey, netclass->GetuViaDrill() ) );
466  netclass->SetDiffPairWidth( READ_MM( dPairWidthKey, netclass->GetDiffPairWidth() ) );
467  netclass->SetDiffPairGap( READ_MM( dPairGapKey, netclass->GetDiffPairGap() ) );
468  netclass->SetDiffPairViaGap( READ_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() ) );
469 
470  if( index > 0 )
471  m_Pt_param->Add( netclass );
472  }
473 
474  aConfig->SetPath( oldPath );
475  }
#define TrackWidthKey
#define uViaDrillKey
#define NetclassNameKey
wxString m_Ident
Keyword in config data.
#define ViaDiameterKey
NETCLASSES * m_Pt_param
Pointer to the parameter value.
#define READ_MM(aKey, aDefault)
bool Add(const NETCLASSPTR &aNetclass)
Function Add takes aNetclass and puts it into this NETCLASSES container.
Definition: netclass.cpp:99
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
Definition: netclass.h:249
#define dPairGapKey
#define dPairWidthKey
#define uViaDiameterKey
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:275
#define dPairViaGapKey
#define ViaDrillKey
#define ClearanceKey

References NETCLASSES::Add(), NETCLASSES::Clear(), ClearanceKey, dPairGapKey, dPairViaGapKey, dPairWidthKey, NETCLASSES::GetDefault(), PARAM_CFG::m_Ident, m_Pt_param, NetclassNameKey, READ_MM, TrackWidthKey, uViaDiameterKey, uViaDrillKey, ViaDiameterKey, and ViaDrillKey.

◆ SaveParam()

void PARAM_CFG_NETCLASSES::SaveParam ( wxConfigBase *  aConfig) const
inlineoverridevirtual

Function SaveParam saves the value of the parameter stored in aConfig.

Parameters
aConfig= the wxConfigBase that can store the parameter

Reimplemented from PARAM_CFG.

Definition at line 477 of file board_design_settings.cpp.

478  {
479  if( !m_Pt_param || !aConfig )
480  return;
481 
482  wxString oldPath = aConfig->GetPath();
484 
485  for( unsigned index = 0; index <= m_Pt_param->GetCount(); ++index )
486  {
487  wxString path = "";
488  NETCLASSPTR netclass;
489 
490  if( index == 0 )
491  path = "Default";
492  else
493  path << index;
494 
495  aConfig->SetPath( oldPath );
496  aConfig->SetPath( m_Ident );
497  aConfig->SetPath( path );
498 
499  if( index == 0 )
500  {
501  netclass = m_Pt_param->GetDefault();
502  }
503  else
504  {
505  netclass = nc->second;
506  ++nc;
507  }
508 
509  aConfig->Write( NetclassNameKey, netclass->GetName() );
510 
511 #define WRITE_MM( aKey, aValue ) aConfig->Write( aKey, Iu2Millimeter( aValue ) )
512  WRITE_MM( ClearanceKey, netclass->GetClearance() );
513  WRITE_MM( TrackWidthKey, netclass->GetTrackWidth() );
514  WRITE_MM( ViaDiameterKey, netclass->GetViaDiameter() );
515  WRITE_MM( ViaDrillKey, netclass->GetViaDrill() );
516  WRITE_MM( uViaDiameterKey, netclass->GetuViaDiameter() );
517  WRITE_MM( uViaDrillKey, netclass->GetuViaDrill() );
518  WRITE_MM( dPairWidthKey, netclass->GetDiffPairWidth() );
519  WRITE_MM( dPairGapKey, netclass->GetDiffPairGap() );
520  WRITE_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() );
521  }
522 
523  aConfig->SetPath( oldPath );
524  }
#define TrackWidthKey
#define uViaDrillKey
#define WRITE_MM(aKey, aValue)
#define NetclassNameKey
wxString m_Ident
Keyword in config data.
NETCLASS_MAP::const_iterator const_iterator
Definition: netclass.h:258
iterator begin()
Definition: netclass.h:255
#define ViaDiameterKey
NETCLASSES * m_Pt_param
Pointer to the parameter value.
#define dPairGapKey
#define dPairWidthKey
#define uViaDiameterKey
unsigned GetCount() const
Function GetCount.
Definition: netclass.h:266
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:275
#define dPairViaGapKey
#define ViaDrillKey
#define ClearanceKey

References NETCLASSES::begin(), ClearanceKey, dPairGapKey, dPairViaGapKey, dPairWidthKey, NETCLASSES::GetCount(), NETCLASSES::GetDefault(), PARAM_CFG::m_Ident, m_Pt_param, NetclassNameKey, TrackWidthKey, uViaDiameterKey, uViaDrillKey, ViaDiameterKey, ViaDrillKey, and WRITE_MM.

Member Data Documentation

◆ m_Group

wxString PARAM_CFG::m_Group
inherited

Group name (this is like a path in the config data)

Definition at line 104 of file config_params.h.

Referenced by PARAM_CFG::PARAM_CFG().

◆ m_Ident

◆ m_Ident_legacy

wxString PARAM_CFG::m_Ident_legacy
inherited

◆ m_Pt_param

NETCLASSES* PARAM_CFG_NETCLASSES::m_Pt_param
protected

Pointer to the parameter value.

Definition at line 417 of file board_design_settings.cpp.

Referenced by PARAM_CFG_NETCLASSES(), ReadParam(), and SaveParam().

◆ m_Setup

◆ m_Type

paramcfg_id PARAM_CFG::m_Type
inherited

Type of parameter.

Definition at line 103 of file config_params.h.

Referenced by dumpParamCfg(), PARAM_CFG::PARAM_CFG(), and PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE().


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