28#include <boost/algorithm/string/predicate.hpp>
30#include <pegtl/contrib/parse_tree.hpp>
52 if( aItem.
refName !=
"" && boost::starts_with( aItem.
refName, type ) )
55 return fmt::format(
"{}{}", type, aItem.
refName );
69 pin.symbolPinNumber );
73 long symbolPinIndex = std::distance( aItem.
pinNumbers.begin(), it );
74 result.append( fmt::format(
" {}", aItem.
pinNetNames.at( symbolPinIndex ) ) );
78 result.append( fmt::format(
" NC-{}-{}", aItem.
refName, ncCounter++ ) );
86 for(
const std::string& pinNetName : aItem.
pinNetNames )
87 result.append( fmt::format(
" {}", pinNetName ) );
108 if( !
param.info.isSpiceInstanceParam )
111 if(
param.info.name ==
"model" )
125SIM_MODEL_RAW_SPICE::SIM_MODEL_RAW_SPICE(
const std::string& aSpiceSource ) :
127 m_spiceCode( aSpiceSource )
129 static std::vector<PARAM::INFO> paramInfos = makeParamInfos();
132 AddParam( paramInfo );
134 SetParamValue(
"model", aSpiceSource );
139 const wxString& aSymbolPinNumber )
142 int pinIndex = (int) strtol( aModelPinName.c_str(),
nullptr, 10 );
149 m_modelPins[ --pinIndex ].symbolPinNumber = aSymbolPinNumber;
156 std::vector<PARAM::INFO> paramInfos;
158 for( SPICE_PARAM spiceParam : SPICE_PARAM_ITERATOR() )
164 case SPICE_PARAM::TYPE:
165 paramInfo.
name =
"type";
173 paramInfos.push_back( paramInfo );
176 case SPICE_PARAM::MODEL:
177 paramInfo.
name =
"model";
185 paramInfos.push_back( paramInfo );
188 case SPICE_PARAM::LIB:
189 paramInfo.
name =
"lib";
197 paramInfos.push_back( paramInfo );
200 case SPICE_PARAM::_ENUM_END:
void AssignSymbolPinNumberToModelPin(const std::string &aModelPinName, const wxString &aSymbolPinNumber) override
static std::vector< PARAM::INFO > makeParamInfos()
std::vector< SIM_MODEL_PIN > m_modelPins
virtual const PARAM & GetParam(unsigned aParamIndex) const
int GetParamCount() const
static std::string ToSpice(const std::string &aString)
std::string ModelLine(const SPICE_ITEM &aItem) const override
std::string ItemPins(const SPICE_ITEM &aItem) const override
std::string ItemModelName(const SPICE_ITEM &aItem) const override
std::string ItemParams() const override
std::string Preview(const SPICE_ITEM &aItem) const override
std::string ItemName(const SPICE_ITEM &aItem) const override
virtual std::vector< std::reference_wrapper< const SIM_MODEL_PIN > > GetPins() const
const SIM_MODEL & m_model
static bool empty(const wxTextEntryBase *aCtrl)
bool isSpiceInstanceParam
std::vector< std::string > pinNetNames
std::vector< std::string > pinNumbers