#include "CertifyCalculation/CertifyCalculation.h" #include #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()); b_inf.Unit(j.at("Unit").get()); b_inf.Caption(j.at("Caption").get()); b_inf.ValueType(j.at("ValueType").get()); b_inf.Value(j.at("Value").get()); b_inf.Remark(j.at("Remark").get()); 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()); v1_inf.Unit(j.at("Unit").get()); v1_inf.Caption(j.at("Caption").get()); v1_inf.ValueType(j.at("ValueType").get()); v1_inf.Value(j.at("Value").get()); v1_inf.Remark(j.at("Remark").get()); 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()); v1_simpson.V(j.at("V").get()); v1_simpson.L(j.at("L").get()); v1_simpson.n(j.at("n").get()); v1_simpson.SParam(j.at("SParam").get()); 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()); v2_simpson.V(j.at("V").get()); v2_simpson.L(j.at("L").get()); v2_simpson.n(j.at("n").get()); v2_simpson.S(j.at("S").get()); v2_simpson.H(j.at("H").get()); v2_simpson.BParam(j.at("BParam").get()); v2_simpson.HParam(j.at("HParam").get()); 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()); v2_block.V(j.at("V").get()); v2_block.L(j.at("L").get()); v2_block.B(j.at("B").get()); v2_block.H(j.at("H").get()); 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()); v2_other.V(j.at("V").get()); v2_other.Remark(j.at("Remark").get()); 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()); v3.V(j.at("V").get()); v3.Type(j.at("Type").get()); v3.S(j.at("S").get()); v3.H(j.at("H").get()); 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(), j.at("id").get()); v3_other.V(j.at("V").get()); v3_other.S(j.at("S").get()); v3_other.H(j.at("H").get()); v3_other.hc(j.at("hc").get()); 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()); v41.V(j.at("V").get()); v41.Type(j.at("Type").get()); v41.S(j.at("S").get()); v41.L(j.at("L").get()); v41.B(j.at("B").get()); v41.H(j.at("H").get()); v41.Ha(j.at("Ha").get()); 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(),j.at("IsCar").get()); v42.V(j.at("V").get()); v42.S(j.at("S").get()); v42.H(j.at("H").get()); v42.Hv(j.at("Hv").get()); v42.Ha(j.at("Ha").get()); 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()); v43_total.V(j.at("V").get()); 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()); v5.V(j.at("V").get()); v5.Remark(j.at("Remark").get()); 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()); v2_entity.EntityID(j.at("EntityId").get()); v2_entity.V(j.at("V").get()); v2_entity.Remark(j.at("Remark").get()); v2_entity.SID(j.at("SId").get()); 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()); v1_entity.EntityID(j.at("EntityId").get()); v1_entity.V(j.at("V").get()); v1_entity.Remark(j.at("Remark").get()); v1_entity.SID(j.at("SId").get()); 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()); b_inf.Unit(j.at("Unit").get()); b_inf.Caption(j.at("Caption").get()); b_inf.ValueType(j.at("ValueType").get()); b_inf.Value(j.at("Value").get()); b_inf.Remark(j.at("Remark").get()); 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()); me.Yard(j.at("Yard").get()); me.Type(j.at("Type").get()); me.MCR(j.at("MCR").get()); me.MPP(j.at("MPP").get()); me.SFC(j.at("SFC").get()); me.FuelType(j.at("FuelType").get()); 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()); ae.Yard(j.at("Yard").get()); ae.Type(j.at("Type").get()); ae.MCR(j.at("MCR").get()); ae.MPP(j.at("MPP").get()); ae.SFC(j.at("SFC").get()); ae.FuelType(j.at("FuelType").get()); 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()); pti.SysNo(j.at("SysNo").get()); pti.Yard(j.at("Yard").get()); pti.Power(j.at("Power").get()); pti.EtaPTI(j.at("EtaPTI").get()); 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()); pto.SysNo(j.at("SysNo").get()); pto.Yard(j.at("Yard").get()); pto.Power(j.at("Power").get()); 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()); propelor.PType(j.at("PType").get()); propelor.PBlade(j.at("PBlade").get()); propelor.DIA(j.at("DIA").get()); return propelor; }