KiCad PCB EDA Suite
Loading...
Searching...
No Matches
IbisParser Class Reference

#include <ibis_parser.h>

Inheritance diagram for IbisParser:
IBIS_INPUT IBIS_ANY

Public Member Functions

 IbisParser (REPORTER *aReporter)
 
bool ParseFile (std::string &aFileName)
 Parse a file.
 
virtual bool Check ()
 Check if the data held by the object is valid.
 
void Report (std::string aMsg, SEVERITY aSeverity=RPT_SEVERITY_INFO)
 Print a message.
 

Public Attributes

bool m_parrot = true
 
long m_lineCounter = 0
 
char m_commentChar = '|'
 
std::vector< char > m_buffer
 
int m_bufferIndex = 0
 
int m_lineOffset = 0
 
int m_lineIndex = 0
 
int m_lineLength = 0
 
IbisFile m_ibisFile
 
IbisComponentm_currentComponent = nullptr
 
IbisModelSelectorm_currentModelSelector = nullptr
 
IbisModelm_currentModel = nullptr
 
IbisPackageModelm_currentPackageModel = nullptr
 
std::shared_ptr< IBIS_MATRIXm_currentMatrix = nullptr
 
int m_currentMatrixRow = 0
 
int m_currentMatrixRowIndex = 0
 
IVtablem_currentIVtable = nullptr
 
VTtablem_currentVTtable = nullptr
 
IbisWaveformm_currentWaveform = nullptr
 
REPORTERm_reporter
 

Protected Member Functions

std::string doubleToString (double aNumber)
 Convert a double to string using scientific notation.
 

Private Member Functions

bool compareIbisWord (const std::string &a, const std::string &b)
 compare two strings without being case sensitive
 
bool parseHeader (std::string &aKeyword)
 Parse a single keyword in the header context.
 
bool parseComponent (std::string &aKeyword)
 Parse a single keyword in the component context.
 
bool parseModelSelector (std::string &aKeyword)
 Parse a single keyword in the component context.
 
bool parseModel (std::string &aKeyword)
 Parse a single keyword in the model selector context.
 
bool parsePackageModel (std::string &aKeyword)
 Parse a single keyword in the model context.
 
bool parsePackageModelModelData (std::string &)
 Parse a single keyword in the package model context.
 
bool parseDouble (double &aDest, std::string &aStr, bool aAllowModifiers=false)
 Parse a double according to the ibis standard.
 
bool onNewLine ()
 Parse the current line.
 
bool getNextLine ()
 Load the next line.
 
void printLine ()
 Print the current line.
 
void skipWhitespaces ()
 
bool checkEndofLine ()
 
bool isLineEmptyFromCursor ()
 
std::string getKeyword ()
 
bool readInt (int &aDest)
 
bool readDouble (double &aDest)
 
bool readWord (std::string &aDest)
 
bool readDvdt (std::string &aString, dvdt &aDest)
 
bool readMatrix (std::shared_ptr< IBIS_MATRIX > aDest)
 
bool readMatrixBanded (std::string, IBIS_MATRIX_BANDED &aDest)
 
bool readMatrixFull (std::string, IBIS_MATRIX_FULL &aDest)
 
bool readMatrixSparse (std::string, IBIS_MATRIX_SPARSE &aDest)
 
bool readRampdvdt (dvdtTypMinMax &aDest)
 
bool readRamp ()
 
bool readModelSpec ()
 
bool readWaveform (IbisWaveform *aDest, IBIS_WAVEFORM_TYPE aType)
 
bool readString (std::string &aDest)
 
bool storeString (std::string &aDest, bool aMultiline)
 
bool readTableLine (std::vector< std::string > &aDest)
 
bool readNumericSubparam (std::string aSubparam, double &aDest)
 
bool readIVtableEntry (IVtable &aTable)
 
bool readVTtableEntry (VTtable &aTable)
 
bool readTypMinMaxValue (TypMinMaxValue &aDest)
 
bool readTypMinMaxValueSubparam (std::string aSubparam, TypMinMaxValue &aDest)
 
bool readPackage ()
 
bool readPin ()
 
bool readPinMapping ()
 
bool readDiffPin ()
 
bool readModelSelector ()
 
bool readModel ()
 
bool readPackageModelPins ()
 
bool changeCommentChar ()
 Ibis can change the character used for comments.
 
bool changeContext (std::string &aKeyword)
 

Private Attributes

std::string * m_continuingString = nullptr
 
IBIS_PARSER_CONTINUE m_continue = IBIS_PARSER_CONTINUE::NONE
 
IBIS_PARSER_CONTEXT m_context = IBIS_PARSER_CONTEXT::HEADER
 

Detailed Description

Definition at line 653 of file ibis_parser.h.

Constructor & Destructor Documentation

◆ IbisParser()

IbisParser::IbisParser ( REPORTER aReporter)
inline

Definition at line 656 of file ibis_parser.h.

Member Function Documentation

◆ changeCommentChar()

bool IbisParser::changeCommentChar ( )
private

Ibis can change the character used for comments.

Definition at line 1171 of file ibis_parser.cpp.

References _, m_buffer, m_commentChar, m_continue, m_lineIndex, m_lineOffset, IBIS_ANY::Report(), RPT_SEVERITY_ERROR, and skipWhitespaces().

Referenced by parseHeader().

◆ changeContext()

◆ Check()

virtual bool IBIS_INPUT::Check ( )
inlinevirtualinherited

Check if the data held by the object is valid.

Returns
true in case of success

Reimplemented in IBIS_MATRIX_BANDED, IBIS_MATRIX_SPARSE, IBIS_MATRIX_FULL, IbisHeader, TypMinMaxValue, IbisComponentPackage, IbisComponentPin, IbisComponent, IbisModelSelector, IVtable, dvdtTypMinMax, IbisRamp, IbisModel, and IbisPackageModel.

Definition at line 89 of file ibis_parser.h.

◆ checkEndofLine()

bool IbisParser::checkEndofLine ( )
private

Definition at line 866 of file ibis_parser.cpp.

References _, m_lineIndex, m_lineLength, IBIS_ANY::Report(), RPT_SEVERITY_ERROR, and skipWhitespaces().

Referenced by storeString().

◆ compareIbisWord()

bool IbisParser::compareIbisWord ( const std::string &  a,
const std::string &  b 
)
private

compare two strings without being case sensitive

Ibis: "The content of the files is case sensitive, except for reserved words and keywords."

Parameters
astring to compare
bstring to compare
Returns
true if the string are equal

Definition at line 51 of file ibis_parser.cpp.

Referenced by changeContext(), parseComponent(), parseHeader(), parseModel(), parsePackageModel(), parsePackageModelModelData(), readMatrix(), readMatrixBanded(), readMatrixFull(), readMatrixSparse(), and readModel().

◆ doubleToString()

std::string IBIS_ANY::doubleToString ( double  aNumber)
protectedinherited

Convert a double to string using scientific notation.

Parameters
aNumberNumber
Returns
Output string

Definition at line 300 of file ibis_parser.cpp.

Referenced by KIBIS_MODEL::generateSquareWave(), KIBIS_PIN::getKuKdOneWaveform(), KIBIS_PIN::getKuKdTwoWaveforms(), KIBIS_PIN::KuKdDriver(), IVtable::Spice(), KIBIS_MODEL::SpiceDie(), KIBIS_PIN::writeSpiceDevice(), and KIBIS_PIN::writeSpiceDriver().

◆ getKeyword()

std::string IbisParser::getKeyword ( )
private

Definition at line 1224 of file ibis_parser.cpp.

References m_buffer, m_lineIndex, m_lineLength, and m_lineOffset.

Referenced by onNewLine().

◆ getNextLine()

bool IbisParser::getNextLine ( )
private

Load the next line.

Returns
True in case of success

Definition at line 986 of file ibis_parser.cpp.

References _, IBIS_MAX_LINE_LENGTH, m_buffer, m_bufferIndex, m_commentChar, m_lineCounter, m_lineIndex, m_lineLength, m_lineOffset, IBIS_ANY::Report(), and RPT_SEVERITY_ERROR.

Referenced by ParseFile().

◆ isLineEmptyFromCursor()

bool IbisParser::isLineEmptyFromCursor ( )
private

Definition at line 879 of file ibis_parser.cpp.

References cursor, m_buffer, m_lineIndex, m_lineLength, and m_lineOffset.

Referenced by readWaveform().

◆ onNewLine()

◆ parseComponent()

bool IbisParser::parseComponent ( std::string &  aKeyword)
private

Parse a single keyword in the component context.

Parameters
aKeywordKeyword
Returns
True in case of success

Definition at line 2127 of file ibis_parser.cpp.

References changeContext(), compareIbisWord(), m_currentComponent, IbisComponent::m_manufacturer, IbisComponent::m_packageModel, readDiffPin(), readPackage(), readPin(), readPinMapping(), and storeString().

Referenced by onNewLine().

◆ parseDouble()

bool IbisParser::parseDouble ( double &  aDest,
std::string &  aStr,
bool  aAllowModifiers = false 
)
private

Parse a double according to the ibis standard.

Parameters
aDestWhere the double should be stored
aStrThe string to parse
aAllowModifiersAllows modifiers ( p for pico, f for femto, k for kilo, ... )
Returns
True in case of success

Definition at line 928 of file ibis_parser.cpp.

References NAN_INVALID, NAN_NA, and skipWhitespaces().

Referenced by readDouble(), readDvdt(), readMatrixFull(), readPackage(), and readPin().

◆ ParseFile()

bool IbisParser::ParseFile ( std::string &  aFileName)

Parse a file.

This is the entry point to parse a file

Parameters
aFileNameinput file name
Returns
True in case of success

Definition at line 799 of file ibis_parser.cpp.

References _, getNextLine(), m_buffer, m_bufferIndex, m_context, m_lineCounter, m_parrot, onNewLine(), printLine(), IBIS_ANY::Report(), and RPT_SEVERITY_ERROR.

Referenced by KIBIS::KIBIS().

◆ parseHeader()

bool IbisParser::parseHeader ( std::string &  aKeyword)
private

◆ parseModel()

◆ parseModelSelector()

bool IbisParser::parseModelSelector ( std::string &  aKeyword)
private

Parse a single keyword in the component context.

Parameters
aKeywordKeyword
Returns
True in case of success

Definition at line 1377 of file ibis_parser.cpp.

References changeContext().

Referenced by onNewLine().

◆ parsePackageModel()

bool IbisParser::parsePackageModel ( std::string &  aKeyword)
private

Parse a single keyword in the model context.

Parameters
aKeywordKeyword
Returns
True in case of success

Definition at line 1794 of file ibis_parser.cpp.

References changeContext(), compareIbisWord(), m_context, m_continue, m_currentPackageModel, IbisPackageModel::m_description, IbisPackageModel::m_manufacturer, IbisPackageModel::m_numberOfPins, IbisPackageModel::m_OEM, readInt(), readPackageModelPins(), and storeString().

Referenced by onNewLine().

◆ parsePackageModelModelData()

bool IbisParser::parsePackageModelModelData ( std::string &  aKeyword)
private

◆ printLine()

void IbisParser::printLine ( )
private

Print the current line.

Definition at line 1033 of file ibis_parser.cpp.

References m_buffer, m_lineLength, and m_lineOffset.

Referenced by ParseFile().

◆ readDiffPin()

◆ readDouble()

bool IbisParser::readDouble ( double &  aDest)
private

◆ readDvdt()

bool IbisParser::readDvdt ( std::string &  aString,
dvdt aDest 
)
private

Definition at line 891 of file ibis_parser.cpp.

References dvdt::m_dt, dvdt::m_dv, NAN_NA, and parseDouble().

Referenced by readRampdvdt().

◆ readInt()

bool IbisParser::readInt ( int &  aDest)
private

◆ readIVtableEntry()

bool IbisParser::readIVtableEntry ( IVtable aTable)
private

◆ readMatrix()

◆ readMatrixBanded()

◆ readMatrixFull()

bool IbisParser::readMatrixFull ( std::string  aKeyword,
IBIS_MATRIX_FULL aDest 
)
private

◆ readMatrixSparse()

bool IbisParser::readMatrixSparse ( std::string  aKeyword,
IBIS_MATRIX_SPARSE aDest 
)
private

◆ readModel()

◆ readModelSelector()

bool IbisParser::readModelSelector ( )
private

◆ readModelSpec()

bool IbisParser::readModelSpec ( )
private

Definition at line 1439 of file ibis_parser.cpp.

References m_continue.

Referenced by onNewLine(), and parseModel().

◆ readNumericSubparam()

bool IbisParser::readNumericSubparam ( std::string  aSubparam,
double &  aDest 
)
private

◆ readPackage()

◆ readPackageModelPins()

bool IbisParser::readPackageModelPins ( )
private

Definition at line 1500 of file ibis_parser.cpp.

References m_continue, m_currentPackageModel, IbisPackageModel::m_pins, and readWord().

Referenced by onNewLine(), and parsePackageModel().

◆ readPin()

◆ readPinMapping()

◆ readRamp()

◆ readRampdvdt()

bool IbisParser::readRampdvdt ( dvdtTypMinMax aDest)
private

Definition at line 1389 of file ibis_parser.cpp.

References readDvdt(), readWord(), and dvdtTypMinMax::value.

Referenced by readRamp().

◆ readString()

bool IbisParser::readString ( std::string &  aDest)
private

Definition at line 1126 of file ibis_parser.cpp.

References m_buffer, m_lineIndex, m_lineLength, and m_lineOffset.

Referenced by onNewLine(), readModelSelector(), and storeString().

◆ readTableLine()

bool IbisParser::readTableLine ( std::vector< std::string > &  aDest)
private

Definition at line 2170 of file ibis_parser.cpp.

References m_buffer, m_lineIndex, m_lineLength, and m_lineOffset.

Referenced by readMatrixFull(), readPackage(), readPin(), and readPinMapping().

◆ readTypMinMaxValue()

bool IbisParser::readTypMinMaxValue ( TypMinMaxValue aDest)
private

◆ readTypMinMaxValueSubparam()

bool IbisParser::readTypMinMaxValueSubparam ( std::string  aSubparam,
TypMinMaxValue aDest 
)
private

Definition at line 1903 of file ibis_parser.cpp.

References m_buffer, m_lineIndex, m_lineLength, m_lineOffset, and readTypMinMaxValue().

Referenced by readModel().

◆ readVTtableEntry()

bool IbisParser::readVTtableEntry ( VTtable aTable)
private

◆ readWaveform()

◆ readWord()

bool IbisParser::readWord ( std::string &  aDest)
private

◆ Report()

◆ skipWhitespaces()

◆ storeString()

bool IbisParser::storeString ( std::string &  aDest,
bool  aMultiline 
)
private

Member Data Documentation

◆ m_buffer

◆ m_bufferIndex

int IbisParser::m_bufferIndex = 0

Definition at line 663 of file ibis_parser.h.

Referenced by getNextLine(), and ParseFile().

◆ m_commentChar

char IbisParser::m_commentChar = '|'

Definition at line 661 of file ibis_parser.h.

Referenced by changeCommentChar(), and getNextLine().

◆ m_context

IBIS_PARSER_CONTEXT IbisParser::m_context = IBIS_PARSER_CONTEXT::HEADER
private

◆ m_continue

◆ m_continuingString

std::string* IbisParser::m_continuingString = nullptr
private

Definition at line 690 of file ibis_parser.h.

Referenced by onNewLine(), and storeString().

◆ m_currentComponent

IbisComponent* IbisParser::m_currentComponent = nullptr

◆ m_currentIVtable

IVtable* IbisParser::m_currentIVtable = nullptr

Definition at line 676 of file ibis_parser.h.

Referenced by onNewLine(), and readIVtableEntry().

◆ m_currentMatrix

std::shared_ptr<IBIS_MATRIX> IbisParser::m_currentMatrix = nullptr

Definition at line 673 of file ibis_parser.h.

Referenced by onNewLine(), parsePackageModelModelData(), readMatrix(), and readMatrixBanded().

◆ m_currentMatrixRow

int IbisParser::m_currentMatrixRow = 0

◆ m_currentMatrixRowIndex

int IbisParser::m_currentMatrixRowIndex = 0

Definition at line 675 of file ibis_parser.h.

Referenced by parsePackageModelModelData(), readMatrixBanded(), and readMatrixFull().

◆ m_currentModel

IbisModel* IbisParser::m_currentModel = nullptr

Definition at line 671 of file ibis_parser.h.

Referenced by changeContext(), parseModel(), readModel(), readRamp(), and readWaveform().

◆ m_currentModelSelector

IbisModelSelector* IbisParser::m_currentModelSelector = nullptr

Definition at line 670 of file ibis_parser.h.

Referenced by changeContext(), and readModelSelector().

◆ m_currentPackageModel

IbisPackageModel* IbisParser::m_currentPackageModel = nullptr

◆ m_currentVTtable

VTtable* IbisParser::m_currentVTtable = nullptr

Definition at line 677 of file ibis_parser.h.

Referenced by onNewLine(), and readVTtableEntry().

◆ m_currentWaveform

IbisWaveform* IbisParser::m_currentWaveform = nullptr

Definition at line 678 of file ibis_parser.h.

Referenced by onNewLine(), and readWaveform().

◆ m_ibisFile

◆ m_lineCounter

long IbisParser::m_lineCounter = 0

Definition at line 660 of file ibis_parser.h.

Referenced by getNextLine(), and ParseFile().

◆ m_lineIndex

◆ m_lineLength

◆ m_lineOffset

◆ m_parrot

bool IbisParser::m_parrot = true

Definition at line 658 of file ibis_parser.h.

Referenced by KIBIS::KIBIS(), and ParseFile().

◆ m_reporter


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