KiCad PCB EDA Suite
PARAM_CFG_DOUBLE Class Reference

Configuration parameter - Double Precision Class. More...

#include <config_params.h>

Inheritance diagram for PARAM_CFG_DOUBLE:
PARAM_CFG

Public Member Functions

 PARAM_CFG_DOUBLE (const wxString &ident, double *ptparam, double default_val=0.0, double min=0.0, double max=10000.0, const wxChar *group=NULL)
 
 PARAM_CFG_DOUBLE (bool Insetup, const wxString &ident, double *ptparam, double default_val=0.0, double min=0.0, double max=10000.0, const wxChar *group=NULL)
 
virtual void ReadParam (wxConfigBase *aConfig) const override
 Function ReadParam reads the value of the parameter stored in aConfig. More...
 
virtual void SaveParam (wxConfigBase *aConfig) const override
 Function SaveParam saves the value of the parameter stored in aConfig. More...
 

Public Attributes

double * m_Pt_param
 Pointer to the parameter value. More...
 
double m_Default
 The default value of the parameter. More...
 
double m_Min
 
double m_Max
 Minimum and maximum values of the param type. More...
 
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
 

Detailed Description

Configuration parameter - Double Precision Class.

Definition at line 179 of file config_params.h.

Constructor & Destructor Documentation

◆ PARAM_CFG_DOUBLE() [1/2]

PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE ( const wxString &  ident,
double *  ptparam,
double  default_val = 0.0,
double  min = 0.0,
double  max = 10000.0,
const wxChar *  group = NULL 
)

Definition at line 245 of file config_params.cpp.

247  :
248  PARAM_CFG( ident, PARAM_DOUBLE, group )
249 {
250  m_Pt_param = ptparam;
251  m_Default = default_val;
252  m_Min = min;
253  m_Max = max;
254 }
double * 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)
double m_Max
Minimum and maximum values of the param type.
double m_Default
The default value of the parameter.

References m_Default, m_Max, m_Min, and m_Pt_param.

◆ PARAM_CFG_DOUBLE() [2/2]

PARAM_CFG_DOUBLE::PARAM_CFG_DOUBLE ( bool  Insetup,
const wxString &  ident,
double *  ptparam,
double  default_val = 0.0,
double  min = 0.0,
double  max = 10000.0,
const wxChar *  group = NULL 
)

Definition at line 257 of file config_params.cpp.

263  :
264  PARAM_CFG( ident, PARAM_DOUBLE, group )
265 {
266  m_Pt_param = ptparam;
267  m_Default = default_val;
268  m_Min = min;
269  m_Max = max;
270  m_Setup = Insetup;
271 }
bool m_Setup
Install or Project based parameter, true == install.
Definition: config_params.h:91
double * 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)
double m_Max
Minimum and maximum values of the param type.
double m_Default
The default value of the parameter.

References m_Default, m_Max, m_Min, m_Pt_param, and PARAM_CFG::m_Setup.

Member Function Documentation

◆ ReadParam()

void PARAM_CFG_DOUBLE::ReadParam ( wxConfigBase *  aConfig) const
overridevirtual

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 274 of file config_params.cpp.

275 {
276  if( !m_Pt_param || !aConfig )
277  return;
278 
279  double dtmp = m_Default;
280  aConfig->Read( m_Ident, &dtmp );
281 
282  if( (dtmp < m_Min) || (dtmp > m_Max) )
283  dtmp = m_Default;
284 
285  *m_Pt_param = dtmp;
286 }
wxString m_Ident
Keyword in config data.
Definition: config_params.h:88
double * m_Pt_param
Pointer to the parameter value.
double m_Max
Minimum and maximum values of the param type.
double m_Default
The default value of the parameter.

References m_Default, PARAM_CFG::m_Ident, m_Max, m_Min, and m_Pt_param.

◆ SaveParam()

void PARAM_CFG_DOUBLE::SaveParam ( wxConfigBase *  aConfig) const
overridevirtual

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 289 of file config_params.cpp.

290 {
291  if( !m_Pt_param || !aConfig )
292  return;
293 
294  // We cannot use aConfig->Write for a double, because
295  // this function uses a format with very few digits in mantissa,
296  // and truncature issues are frequent.
297  // We uses our function.
299 }
wxString m_Ident
Keyword in config data.
Definition: config_params.h:88
double * m_Pt_param
Pointer to the parameter value.
void ConfigBaseWriteDouble(wxConfigBase *aConfig, const wxString &aKey, double aValue)
Function ConfigBaseWriteDouble This is a helper function to write doubles in config We cannot use wxC...

References ConfigBaseWriteDouble(), PARAM_CFG::m_Ident, and m_Pt_param.

Member Data Documentation

◆ m_Default

double PARAM_CFG_DOUBLE::m_Default

The default value of the parameter.

Definition at line 183 of file config_params.h.

Referenced by PARAM_CFG_DOUBLE(), and ReadParam().

◆ m_Group

wxString PARAM_CFG::m_Group
inherited

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

Definition at line 90 of file config_params.h.

Referenced by PARAM_CFG::PARAM_CFG().

◆ m_Ident

◆ m_Ident_legacy

wxString PARAM_CFG::m_Ident_legacy
inherited

◆ m_Max

double PARAM_CFG_DOUBLE::m_Max

Minimum and maximum values of the param type.

Definition at line 184 of file config_params.h.

Referenced by PARAM_CFG_DOUBLE(), and ReadParam().

◆ m_Min

double PARAM_CFG_DOUBLE::m_Min

Definition at line 184 of file config_params.h.

Referenced by PARAM_CFG_DOUBLE(), and ReadParam().

◆ m_Pt_param

double* PARAM_CFG_DOUBLE::m_Pt_param

Pointer to the parameter value.

Definition at line 182 of file config_params.h.

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

◆ m_Setup

bool PARAM_CFG::m_Setup
inherited

◆ m_Type

paramcfg_id PARAM_CFG::m_Type
inherited

Type of parameter.

Definition at line 89 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 files: