25#ifndef SIM_MODEL_SERIALIZER_H
26#define SIM_MODEL_SERIALIZER_H
35 struct sep : plus<space> {};
46 struct pinName : plus<not_at<sep>, any> {};
65 struct flagParam : sor<seq<TAO_PEGTL_ISTRING( "off" ), not_at<alnum>>,
66 seq<TAO_PEGTL_ISTRING( "thermal" ), not_at<alnum>>,
67 seq<TAO_PEGTL_ISTRING( "xpart" ), not_at<alnum>>> {};
78 opt<fieldParamValuePairs>,
83 number<SIM_VALUE::TYPE_FLOAT, NOTATION::SI>> {};
90 template <
typename>
inline constexpr const char*
errorMessage =
nullptr;
91 template <>
inline constexpr auto errorMessage<opt<sep>> =
"";
92 template <>
inline constexpr auto errorMessage<opt<pinSequence>> =
"";
97 "expected quoted or unquoted string";
99 "expected parameter=value pairs";
100 template <>
inline constexpr auto errorMessage<opt<fieldParamValuePairs>> =
"";
102 "expected 'R', 'C', 'L', 'V', 'I' or a number";
103 template <>
inline constexpr auto errorMessage<tao::pegtl::eof> =
104 "expected end of string";
109 template <
typename Rule>
static constexpr auto message = errorMessage<Rule>;
112 template <
typename Rule>
using control = must_if<error>::control<Rule>;
137 void ParsePins(
const std::string& aPins );
Serializes/deserializes a SIM_MODEL for storage in LIB_FIELDs/SCH_FIELDs.
std::string GeneratePins() const
static constexpr auto VALUE_FIELD
SIM_MODEL_SERIALIZER(SIM_MODEL &aModel)
void ParsePins(const std::string &aPins)
std::string generateParamValuePair(const SIM_MODEL::PARAM &aParam) const
std::string GenerateParams() const
std::string GenerateValue() const
void ParseValue(const std::string &aValue)
void ParseEnable(const std::string &aEnable)
std::string GenerateEnable() const
std::string GenerateDevice() const
virtual ~SIM_MODEL_SERIALIZER()=default
bool ParseParams(const std::string &aParams)
std::string GenerateDeviceSubtype() const
static constexpr auto REFERENCE_FIELD
constexpr auto errorMessage< fieldInferValue >
must_if< error >::control< Rule > control
constexpr auto errorMessage< fieldParamValuePairs >
constexpr const char * errorMessage
static constexpr bool raise_on_failure
static constexpr auto message