LibreVNA/Software/PC_Application/LibreVNA-GUI/VNA/Deembedding/deembeddingoption.cpp

49 lines
1.2 KiB
C++
Raw Normal View History

2022-10-01 23:10:44 +08:00
#include "deembeddingoption.h"
#include "portextension.h"
#include "twothru.h"
#include "matchingnetwork.h"
#include "impedancerenormalization.h"
DeembeddingOption *DeembeddingOption::create(DeembeddingOption::Type type)
{
switch(type) {
case Type::PortExtension:
return new PortExtension();
case Type::TwoThru:
return new TwoThru();
case Type::MatchingNetwork:
return new MatchingNetwork();
case Type::ImpedanceRenormalization:
return new ImpedanceRenormalization();
default:
return nullptr;
}
}
2022-12-13 00:39:17 +08:00
QString DeembeddingOption::TypeToString(DeembeddingOption::Type type)
2022-10-01 23:10:44 +08:00
{
switch(type) {
case Type::PortExtension:
return "Port Extension";
case Type::TwoThru:
return "2xThru";
case Type::MatchingNetwork:
return "Matching Network";
case Type::ImpedanceRenormalization:
return "Impedance Renormalization";
default:
return "";
}
}
2022-12-13 00:39:17 +08:00
DeembeddingOption::Type DeembeddingOption::TypeFromString(QString string)
{
for(unsigned int i=0;i<(int) Type::Last;i++) {
if(TypeToString((Type) i).compare(string, Qt::CaseInsensitive) == 0) {
2022-12-13 00:39:17 +08:00
return (Type) i;
}
}
return Type::Last;
}