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

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 309 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 315 of file board_design_settings.cpp.

316  :
317  PARAM_CFG_BASE( ident, PARAM_NETCLASSES, group )
318  {
319  m_Pt_param = ptparam;
320  }
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL, const wxString &legacy_ident=wxEmptyString)
NETCLASSES * m_Pt_param
Pointer to the parameter value.

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_BASE.

Definition at line 322 of file board_design_settings.cpp.

323  {
324  if( !m_Pt_param || !aConfig )
325  return;
326 
327  wxString oldPath = aConfig->GetPath();
328 
329  m_Pt_param->Clear();
330 
331  for( int index = 0; ; ++index )
332  {
333  wxString path = "";
334  NETCLASSPTR netclass;
335  wxString netclassName;
336 
337  if( index == 0 )
338  path = "Default";
339  else
340  path << index;
341 
342  aConfig->SetPath( oldPath );
343  aConfig->SetPath( m_Ident );
344  aConfig->SetPath( path );
345 
346  if( !aConfig->Read( NetclassNameKey, &netclassName ) )
347  break;
348 
349  if( index == 0 )
350  netclass = m_Pt_param->GetDefault();
351  else
352  netclass = std::make_shared<NETCLASS>( netclassName );
353 
354 #define READ_MM( aKey, aDefault ) Millimeter2iu( aConfig->ReadDouble( aKey, aDefault ) )
355  netclass->SetClearance( READ_MM( ClearanceKey, netclass->GetClearance() ) );
356  netclass->SetTrackWidth( READ_MM( TrackWidthKey, netclass->GetTrackWidth() ) );
357  netclass->SetViaDiameter( READ_MM( ViaDiameterKey, netclass->GetViaDiameter() ) );
358  netclass->SetViaDrill( READ_MM( ViaDrillKey, netclass->GetViaDrill() ) );
359  netclass->SetuViaDiameter( READ_MM( uViaDiameterKey, netclass->GetuViaDiameter() ) );
360  netclass->SetuViaDrill( READ_MM( uViaDrillKey, netclass->GetuViaDrill() ) );
361  netclass->SetDiffPairWidth( READ_MM( dPairWidthKey, netclass->GetDiffPairWidth() ) );
362  netclass->SetDiffPairGap( READ_MM( dPairGapKey, netclass->GetDiffPairGap() ) );
363  netclass->SetDiffPairViaGap( READ_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() ) );
364 
365  if( index > 0 )
366  m_Pt_param->Add( netclass );
367  }
368 
369  aConfig->SetPath( oldPath );
370  }
#define TrackWidthKey
#define uViaDrillKey
#define NetclassNameKey
#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:242
#define dPairGapKey
#define dPairWidthKey
#define uViaDiameterKey
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:268
#define dPairViaGapKey
#define ViaDrillKey
#define ClearanceKey
wxString m_Ident
Keyword in config data.

References NETCLASSES::Add(), NETCLASSES::Clear(), ClearanceKey, dPairGapKey, dPairViaGapKey, dPairWidthKey, NETCLASSES::GetDefault(), PARAM_CFG_BASE::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_BASE.

Definition at line 372 of file board_design_settings.cpp.

373  {
374  if( !m_Pt_param || !aConfig )
375  return;
376 
377  wxString oldPath = aConfig->GetPath();
379 
380  for( unsigned index = 0; index <= m_Pt_param->GetCount(); ++index )
381  {
382  wxString path = "";
383  NETCLASSPTR netclass;
384 
385  if( index == 0 )
386  path = "Default";
387  else
388  path << index;
389 
390  aConfig->SetPath( oldPath );
391  aConfig->SetPath( m_Ident );
392  aConfig->SetPath( path );
393 
394  if( index == 0 )
395  {
396  netclass = m_Pt_param->GetDefault();
397  }
398  else
399  {
400  netclass = nc->second;
401  ++nc;
402  }
403 
404  aConfig->Write( NetclassNameKey, netclass->GetName() );
405 
406 #define WRITE_MM( aKey, aValue ) aConfig->Write( aKey, Iu2Millimeter( aValue ) )
407  WRITE_MM( ClearanceKey, netclass->GetClearance() );
408  WRITE_MM( TrackWidthKey, netclass->GetTrackWidth() );
409  WRITE_MM( ViaDiameterKey, netclass->GetViaDiameter() );
410  WRITE_MM( ViaDrillKey, netclass->GetViaDrill() );
411  WRITE_MM( uViaDiameterKey, netclass->GetuViaDiameter() );
412  WRITE_MM( uViaDrillKey, netclass->GetuViaDrill() );
413  WRITE_MM( dPairWidthKey, netclass->GetDiffPairWidth() );
414  WRITE_MM( dPairGapKey, netclass->GetDiffPairGap() );
415  WRITE_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() );
416  }
417 
418  aConfig->SetPath( oldPath );
419  }
#define TrackWidthKey
#define uViaDrillKey
#define WRITE_MM(aKey, aValue)
#define NetclassNameKey
NETCLASS_MAP::const_iterator const_iterator
Definition: netclass.h:251
iterator begin()
Definition: netclass.h:248
#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:259
NETCLASSPTR GetDefault() const
Function GetDefault.
Definition: netclass.h:268
#define dPairViaGapKey
#define ViaDrillKey
#define ClearanceKey
wxString m_Ident
Keyword in config data.

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

Member Data Documentation

◆ m_Group

wxString PARAM_CFG_BASE::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_BASE::PARAM_CFG_BASE().

◆ m_Ident

◆ m_Ident_legacy

wxString PARAM_CFG_BASE::m_Ident_legacy
inherited

◆ m_Pt_param

NETCLASSES* PARAM_CFG_NETCLASSES::m_Pt_param
protected

Pointer to the parameter value.

Definition at line 312 of file board_design_settings.cpp.

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

◆ m_Setup

bool PARAM_CFG_BASE::m_Setup
inherited

◆ m_Type

paramcfg_id PARAM_CFG_BASE::m_Type
inherited

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