More dead code removal and a bit of formatting and const& for strings.

This commit is contained in:
Jeff Young 2023-02-22 09:48:32 +00:00
parent 68fe146861
commit a126d961d8
8 changed files with 7976 additions and 8023 deletions

View File

@ -279,8 +279,8 @@ public:
std::string modelType = ""; std::string modelType = "";
std::string inlineTypeString = ""; std::string inlineTypeString = "";
std::string level = ""; std::string level = "";
bool isDefaultLevel = false; bool isDefaultLevel = false;
bool hasExpression = false; bool hasExpression = false;
std::string version = ""; std::string version = "";
}; };
@ -288,7 +288,7 @@ public:
struct PIN struct PIN
{ {
const std::string name; const std::string name;
std::string symbolPinNumber; std::string symbolPinNumber;
static constexpr auto NOT_CONNECTED = -1; static constexpr auto NOT_CONNECTED = -1;
}; };
@ -322,59 +322,50 @@ public:
SUPERFLUOUS SUPERFLUOUS
}; };
struct FLAGS {}; // Legacy.
struct INFO struct INFO
{ {
std::string name = ""; INFO( const std::string& aName = "",
unsigned id = 0; // Legacy (don't remove). unsigned aId = 0,
DIR dir = DIR_INOUT; DIR aDir = DIR_INOUT,
SIM_VALUE::TYPE type = SIM_VALUE::TYPE_FLOAT; SIM_VALUE::TYPE aType = SIM_VALUE::TYPE_FLOAT,
FLAGS flags = {}; // Legacy (don't remove). const std::string& aUnit = "",
std::string unit = ""; CATEGORY aCategory = CATEGORY::PRINCIPAL,
CATEGORY category = CATEGORY::PRINCIPAL; const std::string& aDefaultValue = "",
std::string defaultValue = ""; const std::string& legacy_unused_value = "",
std::string defaultValueOfOtherVariant = ""; // Legacy (don't remove). const std::string& aDescription = "",
std::string description = ""; bool aIsSpiceInstanceParam = false,
bool isSpiceInstanceParam = false; bool aIsInstanceParam = false,
bool isInstanceParam = false; const std::string& aSpiceModelName = "",
std::string spiceModelName = ""; const std::string& aSpiceInstanceName = "",
std::string spiceInstanceName = "";
std::vector<std::string> enumValues = {};
// TODO: Stop using brace-initializers, use this constructor for all info structs.
INFO( std::string aName = "",
unsigned aId = 0,
DIR aDir = DIR_INOUT,
SIM_VALUE::TYPE aType = SIM_VALUE::TYPE_FLOAT,
FLAGS aFlags = {},
const std::string& aUnit = "",
CATEGORY aCategory = CATEGORY::PRINCIPAL,
const std::string& aDefaultValue = "",
const std::string& aDefaultValueOfOtherVariant = "",
const std::string& aDescription = "",
bool aIsSpiceInstanceParam = false,
bool aIsInstanceParam = false,
const std::string& aSpiceModelName = "",
const std::string& aSpiceInstanceName = "",
std::vector<std::string> aEnumValues = {} ) : std::vector<std::string> aEnumValues = {} ) :
name( aName ), name( aName ),
id( aId ), id( aId ),
dir( aDir ), dir( aDir ),
type( aType ), type( aType ),
flags( aFlags ),
unit( aUnit ), unit( aUnit ),
category( aCategory ), category( aCategory ),
defaultValue( aDefaultValue ), defaultValue( aDefaultValue ),
defaultValueOfOtherVariant( aDefaultValueOfOtherVariant ),
description( aDescription ), description( aDescription ),
isSpiceInstanceParam( aIsSpiceInstanceParam ), isSpiceInstanceParam( aIsSpiceInstanceParam ),
isInstanceParam( aIsInstanceParam ), isInstanceParam( aIsInstanceParam ),
spiceModelName( aSpiceModelName ), spiceModelName( aSpiceModelName ),
spiceInstanceName( aSpiceInstanceName ), spiceInstanceName( aSpiceInstanceName ),
enumValues( std::move( aEnumValues ) ) enumValues( std::move( aEnumValues ) )
{ {}
}
std::string name;
unsigned id;
DIR dir;
SIM_VALUE::TYPE type;
std::string unit;
CATEGORY category;
std::string defaultValue;
std::string description;
bool isSpiceInstanceParam;
bool isInstanceParam;
std::string spiceModelName;
std::string spiceInstanceName;
std::vector<std::string> enumValues;
}; };
std::string value; std::string value;
@ -442,8 +433,6 @@ public:
template <typename T> template <typename T>
void WriteFields( std::vector<T>& aFields ) const; void WriteFields( std::vector<T>& aFields ) const;
virtual bool HasToIncludeSpiceLibrary() const { return GetBaseModel() && !HasOverrides(); }
SPICE_INFO GetSpiceInfo() const { return SpiceInfo( GetType() ); } SPICE_INFO GetSpiceInfo() const { return SpiceInfo( GetType() ); }
void AddPin( const PIN& aPin ); void AddPin( const PIN& aPin );

View File

@ -105,15 +105,13 @@ bool SIM_MODEL_BEHAVIORAL::parseValueField( const std::string& aValueField )
} }
SIM_MODEL::PARAM::INFO SIM_MODEL_BEHAVIORAL::makeParams( std::string aName, std::string aDescription, SIM_MODEL::PARAM::INFO SIM_MODEL_BEHAVIORAL::makeParams( const std::string& aName,
std::string aUnit ) const std::string& aDescription,
const std::string& aUnit )
{ {
PARAM::INFO paramInfo = {}; PARAM::INFO paramInfo( aName, 0, PARAM::DIR_INOUT, SIM_VALUE::TYPE_STRING, aUnit,
PARAM::CATEGORY::PRINCIPAL );
paramInfo.name = aName;
paramInfo.type = SIM_VALUE::TYPE_STRING;
paramInfo.unit = aUnit;
paramInfo.category = PARAM::CATEGORY::PRINCIPAL;
paramInfo.description = aDescription; paramInfo.description = aDescription;
return paramInfo; return paramInfo;

View File

@ -50,7 +50,8 @@ public:
private: private:
bool parseValueField( const std::string& aValueField ); bool parseValueField( const std::string& aValueField );
static PARAM::INFO makeParams( std::string aName, std::string aDescription, std::string aUnit ); static PARAM::INFO makeParams( const std::string& aName, const std::string& aDescription,
const std::string& aUnit );
}; };
#endif // SIM_MODEL_BEHAVIORAL_H #endif // SIM_MODEL_BEHAVIORAL_H

View File

@ -72,15 +72,13 @@ SIM_MODEL_IDEAL::SIM_MODEL_IDEAL( TYPE aType ) :
} }
SIM_MODEL::PARAM::INFO SIM_MODEL_IDEAL::makeParamInfo( std::string aName, std::string aDescription, SIM_MODEL::PARAM::INFO SIM_MODEL_IDEAL::makeParamInfo( const std::string& aName,
std::string aUnit ) const std::string& aDescription,
const std::string& aUnit )
{ {
SIM_MODEL::PARAM::INFO paramInfo = {}; PARAM::INFO paramInfo( aName, 0, PARAM::DIR_INOUT, SIM_VALUE::TYPE_FLOAT, aUnit,
PARAM::CATEGORY::PRINCIPAL );
paramInfo.name = aName;
paramInfo.type = SIM_VALUE::TYPE_FLOAT;
paramInfo.unit = aUnit;
paramInfo.category = SIM_MODEL::PARAM::CATEGORY::PRINCIPAL;
paramInfo.description = aDescription; paramInfo.description = aDescription;
return paramInfo; return paramInfo;

View File

@ -52,7 +52,8 @@ public:
std::vector<std::string> GetPinNames() const override { return { "+", "-" }; } std::vector<std::string> GetPinNames() const override { return { "+", "-" }; }
private: private:
static PARAM::INFO makeParamInfo( std::string aName, std::string aDescription, std::string aUnit ); static PARAM::INFO makeParamInfo( const std::string& aName, const std::string& aDescription,
const std::string& aUnit );
}; };
#endif // SIM_MODEL_IDEAL_H #endif // SIM_MODEL_IDEAL_H

File diff suppressed because it is too large Load Diff

View File

@ -291,8 +291,3 @@ SIM_MODEL::TYPE SPICE_MODEL_PARSER::ReadTypeFromSpiceStrings( const std::string&
return SIM_MODEL::TYPE::RAWSPICE; return SIM_MODEL::TYPE::RAWSPICE;
} }
void SPICE_MODEL_PARSER::CopyModelFromLibrary( const SIM_LIBRARY_SPICE& aSourceLibrary,
const std::string& aModelName )
{
}

View File

@ -48,9 +48,6 @@ protected:
const std::string& aVersion = "", const std::string& aVersion = "",
bool aSkipDefaultLevel = true ); bool aSkipDefaultLevel = true );
void CopyModelFromLibrary( const SIM_LIBRARY_SPICE& aSourceLibrary,
const std::string& aModelName );
SIM_MODEL_SPICE& m_model; SIM_MODEL_SPICE& m_model;
}; };