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 inlineTypeString = "";
std::string level = "";
bool isDefaultLevel = false;
bool hasExpression = false;
bool isDefaultLevel = false;
bool hasExpression = false;
std::string version = "";
};
@ -288,7 +288,7 @@ public:
struct PIN
{
const std::string name;
std::string symbolPinNumber;
std::string symbolPinNumber;
static constexpr auto NOT_CONNECTED = -1;
};
@ -322,59 +322,50 @@ public:
SUPERFLUOUS
};
struct FLAGS {}; // Legacy.
struct INFO
{
std::string name = "";
unsigned id = 0; // Legacy (don't remove).
DIR dir = DIR_INOUT;
SIM_VALUE::TYPE type = SIM_VALUE::TYPE_FLOAT;
FLAGS flags = {}; // Legacy (don't remove).
std::string unit = "";
CATEGORY category = CATEGORY::PRINCIPAL;
std::string defaultValue = "";
std::string defaultValueOfOtherVariant = ""; // Legacy (don't remove).
std::string description = "";
bool isSpiceInstanceParam = false;
bool isInstanceParam = false;
std::string spiceModelName = "";
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 = "",
INFO( const std::string& aName = "",
unsigned aId = 0,
DIR aDir = DIR_INOUT,
SIM_VALUE::TYPE aType = SIM_VALUE::TYPE_FLOAT,
const std::string& aUnit = "",
CATEGORY aCategory = CATEGORY::PRINCIPAL,
const std::string& aDefaultValue = "",
const std::string& legacy_unused_value = "",
const std::string& aDescription = "",
bool aIsSpiceInstanceParam = false,
bool aIsInstanceParam = false,
const std::string& aSpiceModelName = "",
const std::string& aSpiceInstanceName = "",
std::vector<std::string> aEnumValues = {} ) :
name( aName ),
id( aId ),
dir( aDir ),
type( aType ),
flags( aFlags ),
unit( aUnit ),
category( aCategory ),
defaultValue( aDefaultValue ),
defaultValueOfOtherVariant( aDefaultValueOfOtherVariant ),
description( aDescription ),
isSpiceInstanceParam( aIsSpiceInstanceParam ),
isInstanceParam( aIsInstanceParam ),
spiceModelName( aSpiceModelName ),
spiceInstanceName( aSpiceInstanceName ),
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;
@ -442,8 +433,6 @@ public:
template <typename T>
void WriteFields( std::vector<T>& aFields ) const;
virtual bool HasToIncludeSpiceLibrary() const { return GetBaseModel() && !HasOverrides(); }
SPICE_INFO GetSpiceInfo() const { return SpiceInfo( GetType() ); }
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,
std::string aUnit )
SIM_MODEL::PARAM::INFO SIM_MODEL_BEHAVIORAL::makeParams( const std::string& aName,
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;
return paramInfo;

View File

@ -50,7 +50,8 @@ public:
private:
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

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,
std::string aUnit )
SIM_MODEL::PARAM::INFO SIM_MODEL_IDEAL::makeParamInfo( const std::string& aName,
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;
return paramInfo;

View File

@ -52,7 +52,8 @@ public:
std::vector<std::string> GetPinNames() const override { return { "+", "-" }; }
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

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;
}
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 = "",
bool aSkipDefaultLevel = true );
void CopyModelFromLibrary( const SIM_LIBRARY_SPICE& aSourceLibrary,
const std::string& aModelName );
SIM_MODEL_SPICE& m_model;
};