KiCad PCB EDA Suite
dialog_spice_model.cpp File Reference
#include "wildcards_and_files_ext.h"
#include "dialog_spice_model.h"
#include <sim/spice_value.h>
#include <confirm.h>
#include <project.h>
#include <wx/tokenzr.h>
#include <wx/wupdlock.h>
#include <cctype>

Go to the source code of this file.

Classes

struct  SPICE_MODEL_INFO
 

Functions

static bool empty (const wxTextCtrl *aCtrl)
 
static int wxCALLBACK comparePwlValues (wxIntPtr aItem1, wxIntPtr aItem2, wxIntPtr WXUNUSED(aSortData))
 
static int getModelTypeIdx (char aPrimitive)
 

Variables

static const std::vector< SPICE_MODEL_INFOmodelTypes
 

Function Documentation

◆ comparePwlValues()

static int wxCALLBACK comparePwlValues ( wxIntPtr  aItem1,
wxIntPtr  aItem2,
wxIntPtr   WXUNUSEDaSortData 
)
static

Definition at line 46 of file dialog_spice_model.cpp.

47 {
48  float* t1 = reinterpret_cast<float*>( &aItem1 );
49  float* t2 = reinterpret_cast<float*>( &aItem2 );
50 
51  if( *t1 > *t2 )
52  return 1;
53 
54  if( *t1 < *t2 )
55  return -1;
56 
57  return 0;
58 }

Referenced by DIALOG_SPICE_MODEL::addPwlValue().

◆ empty()

static bool empty ( const wxTextCtrl *  aCtrl)
static

Definition at line 39 of file dialog_spice_model.cpp.

40 {
41  return aCtrl->GetValue().IsEmpty();
42 }

Referenced by DIALOG_SPICE_MODEL::generatePowerSource(), DIALOG_SPICE_MODEL::TransferDataFromWindow(), and DIALOG_SPICE_MODEL::TransferDataToWindow().

◆ getModelTypeIdx()

static int getModelTypeIdx ( char  aPrimitive)
static

Definition at line 82 of file dialog_spice_model.cpp.

83 {
84  const char prim = std::toupper( aPrimitive );
85 
86  for( size_t i = 0; i < modelTypes.size(); ++i )
87  {
88  if( modelTypes[i].type == prim )
89  return i;
90  }
91 
92  return -1;
93 }
size_t i
Definition: json11.cpp:597
static const std::vector< SPICE_MODEL_INFO > modelTypes

References i, and modelTypes.

Referenced by DIALOG_SPICE_MODEL::onModelSelected(), and DIALOG_SPICE_MODEL::TransferDataToWindow().

Variable Documentation

◆ modelTypes

const std::vector<SPICE_MODEL_INFO> modelTypes
static
Initial value:
=
{
{ SP_DIODE, _( "Diode" ), { "d" } },
{ SP_BJT, _( "BJT" ), { "npn", "pnp" } },
{ SP_MOSFET, _( "MOSFET" ), { "nmos", "pmos", "vdmos" } },
{ SP_JFET, _( "JFET" ), { "njf", "pjf" } },
{ SP_SUBCKT, _( "Subcircuit" ), {} },
}
#define _(s)

Definition at line 71 of file dialog_spice_model.cpp.

Referenced by getModelTypeIdx(), DIALOG_SPICE_MODEL::Init(), DIALOG_SPICE_MODEL::MODEL::parseModelType(), and DIALOG_SPICE_MODEL::TransferDataFromWindow().