COMPASSi/trunk/code/projects/DataManager/Infrastructure.Data/CertifyCalculation/CertifyCalculation.cpp

439 lines
13 KiB
C++

#include "CertifyCalculation/CertifyCalculation.h"
#include <unordered_set>
#include "XmlSerialization.h"
nlohmann::json tonnagemodel_ds::JsonBInf::to_json(const BInf &b_inf)
{
nlohmann::json j;
j["paramid"] = b_inf.ParamID();
j["Unit"] = b_inf.Unit().get();
j["Caption"] = b_inf.Caption().get();
j["ValueType"] = b_inf.ValueType().get();
j["Value"] = b_inf.Value().get();
j["Remark"] = b_inf.Remark().get();
return j;
}
tonnagemodel_ds::BInf tonnagemodel_ds::JsonBInf::from_json(const nlohmann::json &j)
{
BInf b_inf(j.at("paramid").get<std::string>());
b_inf.Unit(j.at("Unit").get<std::string>());
b_inf.Caption(j.at("Caption").get<std::string>());
b_inf.ValueType(j.at("ValueType").get<std::string>());
b_inf.Value(j.at("Value").get<std::string>());
b_inf.Remark(j.at("Remark").get<std::string>());
return b_inf;
}
nlohmann::json tonnagemodel_ds::JsonV1Inf::to_json(const V1Inf &v1_inf)
{
nlohmann::json j;
j["paramid"] = v1_inf.ParamID();
j["Unit"] = v1_inf.Unit().get();
j["Caption"] = v1_inf.Caption().get();
j["ValueType"] = v1_inf.ValueType().get();
j["Value"] = v1_inf.Value().get();
j["Remark"] = v1_inf.Remark().get();
return j;
}
tonnagemodel_ds::V1Inf tonnagemodel_ds::JsonV1Inf::from_json(const nlohmann::json &j)
{
V1Inf v1_inf(j.at("paramid").get<std::string>());
v1_inf.Unit(j.at("Unit").get<std::string>());
v1_inf.Caption(j.at("Caption").get<std::string>());
v1_inf.ValueType(j.at("ValueType").get<std::string>());
v1_inf.Value(j.at("Value").get<std::string>());
v1_inf.Remark(j.at("Remark").get<std::string>());
return v1_inf;
}
nlohmann::json tonnagemodel_ds::JsonV1Simpson::to_json(const V1Simpson &v1_simpson)
{
nlohmann::json j;
j["id"] = v1_simpson.ID();
j["V"] = v1_simpson.V().get();
j["L"] = v1_simpson.L().get();
j["n"] = v1_simpson.n().get();
j["SParam"] = v1_simpson.SParam().get();
return j;
}
tonnagemodel_ds::V1Simpson tonnagemodel_ds::JsonV1Simpson::from_json(const nlohmann::json &j)
{
V1Simpson v1_simpson(j.at("id").get<std::string>());
v1_simpson.V(j.at("V").get<double>());
v1_simpson.L(j.at("L").get<double>());
v1_simpson.n(j.at("n").get<int>());
v1_simpson.SParam(j.at("SParam").get<std::string>());
return v1_simpson;
}
nlohmann::json tonnagemodel_ds::JsonV2Simpson::to_json(const V2Simpson &m_v2_simpson)
{
nlohmann::json j;
j["id"] = m_v2_simpson.ID();
j["V"] = m_v2_simpson.V().get();
j["L"] = m_v2_simpson.L().get();
j["n"] = m_v2_simpson.n().get();
j["S"] = m_v2_simpson.S().get();
j["H"] = m_v2_simpson.H().get();
j["BParam"] = m_v2_simpson.BParam().get();
j["HParam"] = m_v2_simpson.HParam().get();
return j;
}
tonnagemodel_ds::V2Simpson tonnagemodel_ds::JsonV2Simpson::from_json(const nlohmann::json &j)
{
V2Simpson v2_simpson(j.at("id").get<std::string>());
v2_simpson.V(j.at("V").get<double>());
v2_simpson.L(j.at("L").get<double>());
v2_simpson.n(j.at("n").get<int>());
v2_simpson.S(j.at("S").get<double>());
v2_simpson.H(j.at("H").get<double>());
v2_simpson.BParam(j.at("BParam").get<std::string>());
v2_simpson.HParam(j.at("HParam").get<std::string>());
return v2_simpson;
}
nlohmann::json tonnagemodel_ds::JsonV2Block::to_json(const V2Block &m_v2_block)
{
nlohmann::json j;
j["id"] = m_v2_block.ID();
j["V"] = m_v2_block.V().get();
j["L"] = m_v2_block.L().get();
j["B"] = m_v2_block.B().get();
j["H"] = m_v2_block.H().get();
return j;
}
tonnagemodel_ds::V2Block tonnagemodel_ds::JsonV2Block::from_json(const nlohmann::json &j)
{
V2Block v2_block(j.at("id").get<std::string>());
v2_block.V(j.at("V").get<double>());
v2_block.L(j.at("L").get<double>());
v2_block.B(j.at("B").get<double>());
v2_block.H(j.at("H").get<double>());
return v2_block;
}
nlohmann::json tonnagemodel_ds::JsonV2other::to_json(const V2other &m_v2_other)
{
nlohmann::json j;
j["id"] = m_v2_other.ID();
j["V"] = m_v2_other.V().get();
j["Remark"] = m_v2_other.Remark().get();
return j;
}
tonnagemodel_ds::V2other tonnagemodel_ds::JsonV2other::from_json(const nlohmann::json &j)
{
V2other v2_other(j.at("id").get<std::string>());
v2_other.V(j.at("V").get<double>());
v2_other.Remark(j.at("Remark").get<std::string>());
return v2_other;
}
nlohmann::json tonnagemodel_ds::JsonV3::to_json(const V3 &m_v3)
{
nlohmann::json j;
j["id"] = m_v3.ID();
j["V"] = m_v3.V().get();
j["Type"] = m_v3.Type().get();
j["S"] = m_v3.S().get();
j["H"] = m_v3.H().get();
return j;
}
tonnagemodel_ds::V3 tonnagemodel_ds::JsonV3::from_json(const nlohmann::json &j)
{
V3 v3(j.at("id").get<std::string>());
v3.V(j.at("V").get<double>());
v3.Type(j.at("Type").get<int>());
v3.S(j.at("S").get<double>());
v3.H(j.at("H").get<double>());
return v3;
}
nlohmann::json tonnagemodel_ds::JsonV43::to_json(const V43 &m_v43)
{
nlohmann::json j;
j["Case"] = m_v43.Case();
j["id"] = m_v43.ID();
j["V"] = m_v43.V().get();
j["S"] = m_v43.S().get();
j["H"] = m_v43.H().get();
j["hc"] = m_v43.hc().get();
return j;
}
tonnagemodel_ds::V43 tonnagemodel_ds::JsonV43::from_json(const nlohmann::json &j)
{
V43 v3_other(j.at("Case").get<std::string>(), j.at("id").get<std::string>());
v3_other.V(j.at("V").get<double>());
v3_other.S(j.at("S").get<double>());
v3_other.H(j.at("H").get<double>());
v3_other.hc(j.at("hc").get<double>());
return v3_other;
}
nlohmann::json tonnagemodel_ds::JsonV41::to_json(const V41 &m_v41)
{
nlohmann::json j;
j["id"] = m_v41.ID();
j["V"] = m_v41.V().get();
j["Type"] = m_v41.Type().get();
j["S"] = m_v41.S().get();
j["L"] = m_v41.L().get();
j["B"] = m_v41.B().get();
j["H"] = m_v41.H().get();
j["Ha"] = m_v41.Ha().get();
return j;
}
tonnagemodel_ds::V41 tonnagemodel_ds::JsonV41::from_json(const nlohmann::json &j)
{
V41 v41(j.at("id").get<std::string>());
v41.V(j.at("V").get<double>());
v41.Type(j.at("Type").get<int>());
v41.S(j.at("S").get<double>());
v41.L(j.at("L").get<double>());
v41.B(j.at("B").get<double>());
v41.H(j.at("H").get<double>());
v41.Ha(j.at("Ha").get<double>());
return v41;
}
nlohmann::json tonnagemodel_ds::JsonV42::to_json(const V42 &m_v42)
{
nlohmann::json j;
j["id"] = m_v42.ID();
j["V"] = m_v42.V().get();
j["IsCar"] = m_v42.IsCar();
j["S"] = m_v42.S().get();
j["H"] = m_v42.H().get();
j["Hv"] = m_v42.Hv().get();
j["Ha"] = m_v42.Ha().get();
return j;
}
tonnagemodel_ds::V42 tonnagemodel_ds::JsonV42::from_json(const nlohmann::json &j)
{
V42 v42(j.at("id").get<std::string>(),j.at("IsCar").get<bool>());
v42.V(j.at("V").get<double>());
v42.S(j.at("S").get<double>());
v42.H(j.at("H").get<double>());
v42.Hv(j.at("Hv").get<double>());
v42.Ha(j.at("Ha").get<double>());
return v42;
}
nlohmann::json tonnagemodel_ds::JsonV43Total::to_json(const V43Total &m_v43_total)
{
nlohmann::json j;
j["Case"] = m_v43_total.Case();
j["V"] = m_v43_total.V().get();
return j;
}
tonnagemodel_ds::V43Total tonnagemodel_ds::JsonV43Total::from_json(const nlohmann::json &j)
{
V43Total v43_total(j.at("Case").get<std::string>());
v43_total.V(j.at("V").get<double>());
return v43_total;
}
nlohmann::json tonnagemodel_ds::JsonV5::to_json(const V5 &m_v5)
{
nlohmann::json j;
j["id"] = m_v5.ID();
j["V"] = m_v5.V().get();
j["Remark"] = m_v5.Remark().get();
return j;
}
tonnagemodel_ds::V5 tonnagemodel_ds::JsonV5::from_json(const nlohmann::json &j)
{
V5 v5(j.at("id").get<std::string>());
v5.V(j.at("V").get<double>());
v5.Remark(j.at("Remark").get<std::string>());
return v5;
}
nlohmann::json tonnagemodel_ds::JsonV2Entity::to_json(const V2Entity &m_v2_entity)
{
nlohmann::json j;
j["id"] = m_v2_entity.ID();
j["EntityId"] = m_v2_entity.EntityID().get();
j["V"] = m_v2_entity.V().get();
j["Remark"] = m_v2_entity.Remark().get();
j["SId"] = m_v2_entity.SID().get();
return j;
}
tonnagemodel_ds::V2Entity tonnagemodel_ds::JsonV2Entity::from_json(const nlohmann::json &j)
{
V2Entity v2_entity(j.at("id").get<std::string>());
v2_entity.EntityID(j.at("EntityId").get<std::string>());
v2_entity.V(j.at("V").get<double>());
v2_entity.Remark(j.at("Remark").get<std::string>());
v2_entity.SID(j.at("SId").get<int>());
return v2_entity;
}
nlohmann::json tonnagemodel_ds::JsonV1Entity::to_json(const V1Entity &m_v1_entity)
{
nlohmann::json j;
j["id"] = m_v1_entity.ID();
j["EntityId"] = m_v1_entity.EntityID().get();
j["V"] = m_v1_entity.V().get();
j["Remark"] = m_v1_entity.Remark().get();
j["SId"] = m_v1_entity.SID().get();
return j;
}
tonnagemodel_ds::V1Entity tonnagemodel_ds::JsonV1Entity::from_json(const nlohmann::json &j)
{
V1Entity v1_entity(j.at("id").get<std::string>());
v1_entity.EntityID(j.at("EntityId").get<std::string>());
v1_entity.V(j.at("V").get<double>());
v1_entity.Remark(j.at("Remark").get<std::string>());
v1_entity.SID(j.at("SId").get<int>());
return v1_entity;
}
nlohmann::json eedimodel_ds::JsonBInf::to_json(const BInf &b_inf)
{
nlohmann::json j;
j["paramid"] = b_inf.ParamID();
j["Unit"] = b_inf.Unit().get();
j["Caption"] = b_inf.Caption().get();
j["ValueType"] = b_inf.ValueType().get();
j["Value"] = b_inf.Value().get();
j["Remark"] = b_inf.Remark().get();
return j;
}
eedimodel_ds::BInf eedimodel_ds::JsonBInf::from_json(const nlohmann::json &j)
{
BInf b_inf(j.at("paramid").get<std::string>());
b_inf.Unit(j.at("Unit").get<std::string>());
b_inf.Caption(j.at("Caption").get<std::string>());
b_inf.ValueType(j.at("ValueType").get<std::string>());
b_inf.Value(j.at("Value").get<std::string>());
b_inf.Remark(j.at("Remark").get<std::string>());
return b_inf;
}
nlohmann::json eedimodel_ds::JsonME::to_json(const ME &me)
{
nlohmann::json j;
j["id"] = me.ID();
j["Yard"] = me.Yard().get();
j["Type"] = me.Type().get();
j["MCR"] = me.MCR().get();
j["MPP"] = me.MPP().get();
j["SFC"] = me.SFC().get();
j["FuelType"] = me.FuelType().get();
return j;
}
eedimodel_ds::ME eedimodel_ds::JsonME::from_json(const nlohmann::json &j)
{
ME me(j.at("id").get<std::string>());
me.Yard(j.at("Yard").get<std::string>());
me.Type(j.at("Type").get<std::string>());
me.MCR(j.at("MCR").get<double>());
me.MPP(j.at("MPP").get<double>());
me.SFC(j.at("SFC").get<double>());
me.FuelType(j.at("FuelType").get<int>());
return me;
}
nlohmann::json eedimodel_ds::JsonAE::to_json(const AE &ae)
{
nlohmann::json j;
j["id"] = ae.ID();
j["Yard"] = ae.Yard().get();
j["Type"] = ae.Type().get();
j["MCR"] = ae.MCR().get();
j["MPP"] = ae.MPP().get();
j["SFC"] = ae.SFC().get();
j["FuelType"] = ae.FuelType().get();
return j;
}
eedimodel_ds::AE eedimodel_ds::JsonAE::from_json(const nlohmann::json &j)
{
AE ae(j.at("id").get<std::string>());
ae.Yard(j.at("Yard").get<std::string>());
ae.Type(j.at("Type").get<std::string>());
ae.MCR(j.at("MCR").get<double>());
ae.MPP(j.at("MPP").get<double>());
ae.SFC(j.at("SFC").get<double>());
ae.FuelType(j.at("FuelType").get<int>());
return ae;
}
nlohmann::json eedimodel_ds::JsonPTI::to_json(const PTI &pti)
{
nlohmann::json j;
j["id"] = pti.ID();
j["SysNo"] = pti.SysNo().get();
j["Yard"] = pti.Yard().get();
j["Power"] = pti.Power().get();
j["EtaPTI"] = pti.EtaPTI().get();
return j;
}
eedimodel_ds::PTI eedimodel_ds::JsonPTI::from_json(const nlohmann::json &j)
{
PTI pti(j.at("id").get<std::string>());
pti.SysNo(j.at("SysNo").get<std::string>());
pti.Yard(j.at("Yard").get<std::string>());
pti.Power(j.at("Power").get<double>());
pti.EtaPTI(j.at("EtaPTI").get<double>());
return pti;
}
nlohmann::json eedimodel_ds::JsonPTO::to_json(const PTO &pto)
{
nlohmann::json j;
j["id"] = pto.ID();
j["SysNo"] = pto.SysNo().get();
j["Yard"] = pto.Yard().get();
j["Power"] = pto.Power().get();
return j;
}
eedimodel_ds::PTO eedimodel_ds::JsonPTO::from_json(const nlohmann::json &j)
{
PTO pto(j.at("id").get<std::string>());
pto.SysNo(j.at("SysNo").get<std::string>());
pto.Yard(j.at("Yard").get<std::string>());
pto.Power(j.at("Power").get<double>());
return pto;
}
nlohmann::json eedimodel_ds::JsonPropelor::to_json(const Propelor &propelor)
{
nlohmann::json j;
j["id"] = propelor.ID();
j["PType"] = propelor.PType().get();
j["PBlade"] = propelor.PBlade().get();
j["DIA"] = propelor.DIA().get();
return j;
}
eedimodel_ds::Propelor eedimodel_ds::JsonPropelor::from_json(const nlohmann::json &j)
{
Propelor propelor(j.at("id").get<std::string>());
propelor.PType(j.at("PType").get<std::string>());
propelor.PBlade(j.at("PBlade").get<int>());
propelor.DIA(j.at("DIA").get<double>());
return propelor;
}