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 32 of file datafile_read_write.h.

Constructor & Destructor Documentation

◆ PCB_CALCULATOR_DATAFILE()

PCB_CALCULATOR_DATAFILE::PCB_CALCULATOR_DATAFILE ( REGULATOR_LIST aList)

Definition at line 112 of file datafile_read_write.cpp.

113 {
114  m_list = aList;
115 }

Member Function Documentation

◆ Format()

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

Definition at line 136 of file datafile_read_write.cpp.

138 {
139  // Write regulators list:
140  aFormatter->Print( aNestLevel++, "(%s\n", getTokenName( T_regulators ) );
141  for( unsigned ii = 0; ii < m_list->m_List.size(); ii++ )
142  {
143  REGULATOR_DATA * item = m_list->m_List[ii];
144  aFormatter->Print( aNestLevel, "(%s %s\n", getTokenName( T_regulator ),
145  aFormatter->Quotew(item->m_Name ).c_str() );
146  aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_vref ),
147  item->m_Vref );
148  if( item->m_Iadj != 0 && item->m_Type == 1)
149  {
150  aFormatter->Print( aNestLevel+1, "(%s %g)\n", getTokenName( T_reg_iadj ),
151  item->m_Iadj );
152  }
153  aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_reg_type ),
154  regtype_str[item->m_Type] );
155  aFormatter->Print( aNestLevel, ")\n" );
156  }
157  aFormatter->Print( --aNestLevel, ")\n" );
158 }
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:408
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:476

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 161 of file datafile_read_write.cpp.

162 {
163  aParser->Parse( this );
164 }
void Parse(PCB_CALCULATOR_DATAFILE *aDataList)

References PCB_CALCULATOR_DATAFILE_PARSER::Parse().

◆ WriteHeader()

int PCB_CALCULATOR_DATAFILE::WriteHeader ( OUTPUTFORMATTER aFormatter) const

Definition at line 122 of file datafile_read_write.cpp.

123 {
124  int nestlevel = 0;
125  aFormatter->Print( nestlevel++, "(datafile\n");
126  aFormatter->Print( nestlevel++, "(version 1)\n" );
127  aFormatter->Print( nestlevel++, "(date %s)\n",
128  aFormatter->Quotew( DateAndTime() ).c_str() );
129  aFormatter->Print( nestlevel++, "(tool %s)\n",
130  aFormatter->Quotew( Pgm().App().GetAppName() +
131  wxChar(' ') + GetBuildVersion() ).c_str() );
132 
133  return nestlevel;
134 }
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:408
wxString DateAndTime()
Definition: string.cpp:411
std::string Quotew(const wxString &aWrapee) const
Definition: richio.cpp:476

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 34 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: