KiCad PCB EDA Suite
PCB_CALCULATOR_DATAFILE Class Reference

PCB_CALCULATOR_DATAFILE handles data to calculate regulators parameters. More...

#include <datafile_read_write.h>

Public Member Functions

 PCB_CALCULATOR_DATAFILE (REGULATOR_LIST *aList)
 
int WriteHeader (OUTPUTFORMATTER *aFormatter) const
 
void Format (OUTPUTFORMATTER *aFormatter, int aNestLevel) const
 
void Parse (PCB_CALCULATOR_DATAFILE_PARSER *aParser)
 

Protected Attributes

REGULATOR_LISTm_list
 

Friends

class PCB_CALCULATOR_DATAFILE_PARSER
 

Detailed Description

PCB_CALCULATOR_DATAFILE handles data to calculate regulators parameters.

Definition at line 30 of file datafile_read_write.h.

Constructor & Destructor Documentation

◆ PCB_CALCULATOR_DATAFILE()

PCB_CALCULATOR_DATAFILE::PCB_CALCULATOR_DATAFILE ( REGULATOR_LIST aList)

Definition at line 120 of file datafile_read_write.cpp.

121 {
122  m_list = aList;
123 }

Member Function Documentation

◆ Format()

void PCB_CALCULATOR_DATAFILE::Format ( OUTPUTFORMATTER aFormatter,
int  aNestLevel 
) const

Definition at line 146 of file datafile_read_write.cpp.

148 {
149  // Write regulators list:
150  aFormatter->Print( aNestLevel++, "(%s\n", getTokenName( T_regulators ) );
151 
152  for( REGULATOR_DATA* item : m_list->m_List )
153  {
154  aFormatter->Print( aNestLevel, "(%s %s\n", getTokenName( T_regulator ),
155  aFormatter->Quotew(item->m_Name ).c_str() );
156  aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_vref ),
157  item->m_Vref );
158 
159  if( item->m_Iadj != 0 && item->m_Type == 1)
160  {
161  aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_iadj ),
162  item->m_Iadj );
163  }
164 
165  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_reg_type ),
166  regtype_str[item->m_Type] );
167  aFormatter->Print( aNestLevel, ")\n" );
168  }
169 
170  aFormatter->Print( --aNestLevel, ")\n" );
171 }
std::vector< REGULATOR_DATA * > m_List
static const char * getTokenName(T aTok)
static const char * regtype_str[]
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:426
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:494

References getTokenName(), REGULATOR_DATA::m_Iadj, REGULATOR_DATA::m_Name, REGULATOR_DATA::m_Type, REGULATOR_DATA::m_Vref, OUTPUTFORMATTER::Print(), OUTPUTFORMATTER::Quotew(), and regtype_str.

◆ Parse()

void PCB_CALCULATOR_DATAFILE::Parse ( PCB_CALCULATOR_DATAFILE_PARSER aParser)

Definition at line 174 of file datafile_read_write.cpp.

175 {
176  aParser->Parse( this );
177 }
void Parse(PCB_CALCULATOR_DATAFILE *aDataList)

References PCB_CALCULATOR_DATAFILE_PARSER::Parse().

◆ WriteHeader()

int PCB_CALCULATOR_DATAFILE::WriteHeader ( OUTPUTFORMATTER aFormatter) const

Definition at line 132 of file datafile_read_write.cpp.

133 {
134  int nestlevel = 0;
135  aFormatter->Print( nestlevel++, "(datafile\n");
136  aFormatter->Print( nestlevel++, "(version 1)\n" );
137  aFormatter->Print( nestlevel++, "(date %s)\n",
138  aFormatter->Quotew( DateAndTime() ).c_str() );
139  aFormatter->Print( nestlevel++, "(tool %s)\n",
140  aFormatter->Quotew( Pgm().App().GetAppName() +
141  wxChar(' ') + GetBuildVersion() ).c_str() );
142 
143  return nestlevel;
144 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
wxString GetBuildVersion()
Get the full KiCad version string.
int PRINTF_FUNC Print(int nestLevel, const char *fmt,...)
Format and write text to the output stream.
Definition: richio.cpp:426
wxString DateAndTime()
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:494

References DateAndTime(), GetBuildVersion(), Pgm(), OUTPUTFORMATTER::Print(), and OUTPUTFORMATTER::Quotew().

Friends And Related Function Documentation

◆ PCB_CALCULATOR_DATAFILE_PARSER

friend class PCB_CALCULATOR_DATAFILE_PARSER
friend

Definition at line 40 of file datafile_read_write.h.

Member Data Documentation

◆ m_list

REGULATOR_LIST* PCB_CALCULATOR_DATAFILE::m_list
protected

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