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_BASE

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

Detailed Description

Configuration parameter - Double Precision Class.

Definition at line 206 of file config_params.h.

Constructor & Destructor Documentation

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

References m_Default, m_Max, m_Min, m_Pt_param, max, and min.

304  :
305  PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
306 {
307  m_Pt_param = ptparam;
308  m_Default = default_val;
309  m_Min = min;
310  m_Max = max;
311 }
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.
#define max(a, b)
Definition: auxiliary.h:86
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL)
#define min(a, b)
Definition: auxiliary.h:85
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 314 of file config_params.cpp.

References m_Default, m_Max, m_Min, m_Pt_param, PARAM_CFG_BASE::m_Setup, max, and min.

320  :
321  PARAM_CFG_BASE( ident, PARAM_DOUBLE, group )
322 {
323  m_Pt_param = ptparam;
324  m_Default = default_val;
325  m_Min = min;
326  m_Max = max;
327  m_Setup = Insetup;
328 }
double * m_Pt_param
Pointer to the parameter value.
bool m_Setup
Install or Project based parameter, true == install.
double m_Max
Minimum and maximum values of the param type.
double m_Default
The default value of the parameter.
#define max(a, b)
Definition: auxiliary.h:86
PARAM_CFG_BASE(const wxString &ident, const paramcfg_id type, const wxChar *group=NULL)
#define min(a, b)
Definition: auxiliary.h:85

Member Function Documentation

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

Definition at line 331 of file config_params.cpp.

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

332 {
333  if( !m_Pt_param || !aConfig )
334  return;
335 
336  double dtmp = m_Default;
337  aConfig->Read( m_Ident, &dtmp );
338 
339  if( (dtmp < m_Min) || (dtmp > m_Max) )
340  dtmp = m_Default;
341 
342  *m_Pt_param = dtmp;
343 }
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.
wxString m_Ident
Keyword in config data.
Definition: config_params.h:97
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_BASE.

Definition at line 346 of file config_params.cpp.

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

347 {
348  if( !m_Pt_param || !aConfig )
349  return;
350 
351  // We cannot use aConfig->Write for a double, because
352  // this function uses a format with very few digits in mantissa,
353  // and truncature issues are frequent.
354  // We uses our function.
356 }
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...
wxString m_Ident
Keyword in config data.
Definition: config_params.h:97

Member Data Documentation

double PARAM_CFG_DOUBLE::m_Default

The default value of the parameter.

Definition at line 210 of file config_params.h.

Referenced by PARAM_CFG_DOUBLE(), and ReadParam().

wxString PARAM_CFG_BASE::m_Group
inherited

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

Definition at line 99 of file config_params.h.

Referenced by PARAM_CFG_BASE::PARAM_CFG_BASE().

double PARAM_CFG_DOUBLE::m_Max

Minimum and maximum values of the param type.

Definition at line 211 of file config_params.h.

Referenced by PARAM_CFG_DOUBLE(), and ReadParam().

double PARAM_CFG_DOUBLE::m_Min

Definition at line 211 of file config_params.h.

Referenced by PARAM_CFG_DOUBLE(), and ReadParam().

double* PARAM_CFG_DOUBLE::m_Pt_param

Pointer to the parameter value.

Definition at line 209 of file config_params.h.

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

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

Type of parameter.

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