27#include <boost/algorithm/string/trim.hpp>
33 std::string spiceCode =
ModelLine( aItem );
38 if( spiceCode ==
"" &&
m_model.GetBaseModel() )
43 std::string itemLine =
ItemLine( item );
45 if( spiceCode !=
"" && itemLine !=
"" )
46 spiceCode.append(
"\n\n" );
48 spiceCode.append( itemLine );
49 return boost::trim_copy( spiceCode );
54 const std::string& aSpiceCode,
55 bool aFirstPass,
REPORTER& aReporter )
57 SIM_MODEL::TYPE type = SIM_MODEL::TYPE::NONE;
70 spiceModel->m_spiceModelParser->ReadModel( aLibrary, aSpiceCode );
80 return std::make_unique<SIM_MODEL_SPICE_FALLBACK>( type, aSpiceCode );
92 std::unique_ptr<SPICE_MODEL_PARSER> aSpiceModelParser ) :
100 const std::string& aParamValue,
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
A pure virtual class used to derive REPORTER objects from.
friend class SPICE_MODEL_PARSER
SIM_MODEL_SPICE(TYPE aType, std::unique_ptr< SPICE_GENERATOR > aSpiceGenerator)
virtual void SetParamFromSpiceCode(const std::string &aParamName, const std::string &aParamValue, SIM_VALUE_GRAMMAR::NOTATION aNotation=SIM_VALUE_GRAMMAR::NOTATION::SPICE)
std::unique_ptr< SPICE_MODEL_PARSER > m_spiceModelParser
static std::unique_ptr< SIM_MODEL_SPICE > Create(const SIM_LIBRARY_SPICE &aLibrary, const std::string &aSpiceCode, bool aFirstPass, REPORTER &aReporter)
static std::unique_ptr< SIM_MODEL > Create(TYPE aType, const std::vector< SCH_PIN * > &aPins, REPORTER &aReporter)
void SetParamValue(int aParamIndex, const std::string &aValue, SIM_VALUE::NOTATION aNotation=SIM_VALUE::NOTATION::SI)
std::string Preview(const SPICE_ITEM &aItem) const override
virtual std::string ItemLine(const SPICE_ITEM &aItem) const
virtual std::string ModelLine(const SPICE_ITEM &aItem) const
const SIM_MODEL & m_model
static bool ReadType(const SIM_LIBRARY_SPICE &aLibrary, const std::string &aSpiceCode, SIM_MODEL::TYPE *aType, bool aFirstPass)