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

Constructor & Destructor Documentation

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

Definition at line 307 of file board_design_settings.cpp.

308  :
309  PARAM_CFG_BASE( ident, PARAM_NETCLASSES, group )
310  {
311  m_Pt_param = ptparam;
312  }
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.

Member Function Documentation

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

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

315  {
316  if( !m_Pt_param || !aConfig )
317  return;
318 
319  wxString oldPath = aConfig->GetPath();
320 
321  m_Pt_param->Clear();
322 
323  for( int index = 1; ; ++index )
324  {
325  wxString pathIndex = wxString() << index;
326  wxString netclassName;
327 
328  aConfig->SetPath( oldPath );
329  aConfig->SetPath( m_Ident );
330  aConfig->SetPath( pathIndex );
331 
332  if( !aConfig->Read( NetclassNameKey, &netclassName ) )
333  break;
334 
335  NETCLASSPTR netclass = std::make_shared<NETCLASS>( netclassName );
336 
337 #define READ_MM( aKey, aDefault ) Millimeter2iu( aConfig->ReadDouble( aKey, aDefault ) )
338  netclass->SetClearance( READ_MM( ClearanceKey, netclass->GetClearance() ) );
339  netclass->SetTrackWidth( READ_MM( TrackWidthKey, netclass->GetTrackWidth() ) );
340  netclass->SetViaDiameter( READ_MM( ViaDiameterKey, netclass->GetViaDiameter() ) );
341  netclass->SetViaDrill( READ_MM( ViaDrillKey, netclass->GetViaDrill() ) );
342  netclass->SetuViaDiameter( READ_MM( uViaDiameterKey, netclass->GetuViaDiameter() ) );
343  netclass->SetuViaDrill( READ_MM( uViaDrillKey, netclass->GetuViaDrill() ) );
344  netclass->SetDiffPairWidth( READ_MM( dPairWidthKey, netclass->GetDiffPairWidth() ) );
345  netclass->SetDiffPairGap( READ_MM( dPairGapKey, netclass->GetDiffPairGap() ) );
346  netclass->SetDiffPairViaGap( READ_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() ) );
347 
348  m_Pt_param->Add( netclass );
349  }
350 
351  aConfig->SetPath( oldPath );
352  }
#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:104
void Clear()
Function Clear destroys any contained NETCLASS instances except the Default one.
Definition: netclass.h:242
#define dPairGapKey
#define dPairWidthKey
#define uViaDiameterKey
#define dPairViaGapKey
#define ViaDrillKey
#define ClearanceKey
wxString m_Ident
Keyword in config data.
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 354 of file board_design_settings.cpp.

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

355  {
356  if( !m_Pt_param || !aConfig )
357  return;
358 
359  wxString oldPath = aConfig->GetPath();
360  int index = 1;
361 
362  for( NETCLASSES::const_iterator nc = m_Pt_param->begin(); nc != m_Pt_param->end(); ++nc )
363  {
364  wxString pathIndex = wxString() << index++;
365  NETCLASSPTR netclass = nc->second;
366 
367  aConfig->SetPath( oldPath );
368  aConfig->SetPath( m_Ident );
369  aConfig->SetPath( pathIndex );
370 
371  aConfig->Write( NetclassNameKey, netclass->GetName() );
372 
373 #define WRITE_MM( aKey, aValue ) aConfig->Write( aKey, Iu2Millimeter( aValue ) )
374  WRITE_MM( ClearanceKey, netclass->GetClearance() );
375  WRITE_MM( TrackWidthKey, netclass->GetTrackWidth() );
376  WRITE_MM( ViaDiameterKey, netclass->GetViaDiameter() );
377  WRITE_MM( ViaDrillKey, netclass->GetViaDrill() );
378  WRITE_MM( uViaDiameterKey, netclass->GetuViaDiameter() );
379  WRITE_MM( uViaDrillKey, netclass->GetuViaDrill() );
380  WRITE_MM( dPairWidthKey, netclass->GetDiffPairWidth() );
381  WRITE_MM( dPairGapKey, netclass->GetDiffPairGap() );
382  WRITE_MM( dPairViaGapKey, netclass->GetDiffPairViaGap() );
383  }
384 
385  aConfig->SetPath( oldPath );
386  }
#define TrackWidthKey
#define uViaDrillKey
#define WRITE_MM(aKey, aValue)
#define NetclassNameKey
iterator end()
Definition: netclass.h:249
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
#define dPairViaGapKey
#define ViaDrillKey
#define ClearanceKey
wxString m_Ident
Keyword in config data.

Member Data Documentation

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

wxString PARAM_CFG_BASE::m_Ident_legacy
inherited
NETCLASSES* PARAM_CFG_NETCLASSES::m_Pt_param
protected

Pointer to the parameter value.

Definition at line 304 of file board_design_settings.cpp.

bool PARAM_CFG_BASE::m_Setup
inherited
paramcfg_id PARAM_CFG_BASE::m_Type
inherited

Type of parameter.

Definition at line 103 of file config_params.h.

Referenced by PARAM_CFG_BASE::PARAM_CFG_BASE(), and PARAM_CFG_INT_WITH_SCALE::PARAM_CFG_INT_WITH_SCALE().


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