31#include <boost/algorithm/string/trim.hpp>
37 std::string spiceCode =
ModelLine( aItem );
47 std::string itemLine =
ItemLine( item );
49 if( spiceCode !=
"" && itemLine !=
"" )
50 spiceCode.append(
"\n\n" );
52 spiceCode.append( itemLine );
53 return boost::trim_copy( spiceCode );
58 const std::string& aSpiceCode,
59 bool aFirstPass,
REPORTER& aReporter )
61 SIM_MODEL::TYPE type = SIM_MODEL::TYPE::NONE;
70 std::unique_ptr<SIM_MODEL_SPICE> spiceModel(
static_cast<SIM_MODEL_SPICE*
>( model.release() ) );
74 spiceModel->m_spiceModelParser->ReadModel( aLibrary, aSpiceCode );
84 return std::make_unique<SIM_MODEL_SPICE_FALLBACK>( type, aSpiceCode );
96 std::unique_ptr<SPICE_MODEL_PARSER> aSpiceModelParser ) :
98 m_spiceModelParser(
std::
move( aSpiceModelParser ) )
104 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.
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)
static std::unique_ptr< SIM_MODEL_SPICE > Create(const SIM_LIBRARY_SPICE &aLibrary, const std::string &aSpiceCode, bool aFirstPass, REPORTER &aReporter)
const SIM_MODEL * GetBaseModel() const
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)