Commit 69a3d3a6 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Fix issue for json parser

parent 4d08cf67
...@@ -43,10 +43,16 @@ void PduSessionType::validate() { ...@@ -43,10 +43,16 @@ void PduSessionType::validate() {
// TODO: implement validation // TODO: implement validation
} }
void to_json(nlohmann::json &j, const PduSessionType &o) { void PduSessionType::set_value(std::string value) { this->value = value; }
j = nlohmann::json(); void PduSessionType::get_value(std::string &value) const {
value = this->value;
} }
std::string PduSessionType::get_value() const { return value; }
void from_json(const nlohmann::json &j, PduSessionType &o) {} void to_json(nlohmann::json &j, const PduSessionType &o) { j = o.get_value(); }
} // namespace oai::udr::model void from_json(const nlohmann::json &j, PduSessionType &o) {
o.set_value(j.get<std::string>());
}
} // namespace oai::udr::model
...@@ -47,21 +47,26 @@ namespace oai::udr::model { ...@@ -47,21 +47,26 @@ namespace oai::udr::model {
/// ///
/// </summary> /// </summary>
class PduSessionType { class PduSessionType {
public: public:
PduSessionType(); PduSessionType();
virtual ~PduSessionType(); virtual ~PduSessionType();
void validate(); void validate();
void set_value(std::string value);
void get_value(std::string &value) const;
std::string get_value() const;
///////////////////////////////////////////// /////////////////////////////////////////////
/// PduSessionType members /// PduSessionType members
friend void to_json(nlohmann::json &j, const PduSessionType &o); friend void to_json(nlohmann::json &j, const PduSessionType &o);
friend void from_json(const nlohmann::json &j, PduSessionType &o); friend void from_json(const nlohmann::json &j, PduSessionType &o);
protected: protected:
std::string value;
}; };
} // namespace oai::udr::model } // namespace oai::udr::model
#endif /* PduSessionType_H_ */ #endif /* PduSessionType_H_ */
...@@ -44,9 +44,11 @@ void PreemptionCapability::validate() { ...@@ -44,9 +44,11 @@ void PreemptionCapability::validate() {
} }
void to_json(nlohmann::json &j, const PreemptionCapability &o) { void to_json(nlohmann::json &j, const PreemptionCapability &o) {
j = nlohmann::json(); j = o.get_value();
} }
void from_json(const nlohmann::json &j, PreemptionCapability &o) {} void from_json(const nlohmann::json &j, PreemptionCapability &o) {
o.set_value(j.get<std::string>());
}
} // namespace oai::udr::model } // namespace oai::udr::model
...@@ -47,7 +47,7 @@ namespace oai::udr::model { ...@@ -47,7 +47,7 @@ namespace oai::udr::model {
/// ///
/// </summary> /// </summary>
class PreemptionCapability { class PreemptionCapability {
public: public:
PreemptionCapability(); PreemptionCapability();
virtual ~PreemptionCapability(); virtual ~PreemptionCapability();
...@@ -59,9 +59,10 @@ public: ...@@ -59,9 +59,10 @@ public:
friend void to_json(nlohmann::json &j, const PreemptionCapability &o); friend void to_json(nlohmann::json &j, const PreemptionCapability &o);
friend void from_json(const nlohmann::json &j, PreemptionCapability &o); friend void from_json(const nlohmann::json &j, PreemptionCapability &o);
protected: protected:
std::string value;
}; };
} // namespace oai::udr::model } // namespace oai::udr::model
#endif /* PreemptionCapability_H_ */ #endif /* PreemptionCapability_H_ */
...@@ -44,9 +44,11 @@ void PreemptionVulnerability::validate() { ...@@ -44,9 +44,11 @@ void PreemptionVulnerability::validate() {
} }
void to_json(nlohmann::json &j, const PreemptionVulnerability &o) { void to_json(nlohmann::json &j, const PreemptionVulnerability &o) {
j = nlohmann::json(); j = o.get_value();
} }
void from_json(const nlohmann::json &j, PreemptionVulnerability &o) {} void from_json(const nlohmann::json &j, PreemptionVulnerability &o) {
o.set_value(j.get<std::string>());
}
} // namespace oai::udr::model } // namespace oai::udr::model
...@@ -47,7 +47,7 @@ namespace oai::udr::model { ...@@ -47,7 +47,7 @@ namespace oai::udr::model {
/// ///
/// </summary> /// </summary>
class PreemptionVulnerability { class PreemptionVulnerability {
public: public:
PreemptionVulnerability(); PreemptionVulnerability();
virtual ~PreemptionVulnerability(); virtual ~PreemptionVulnerability();
...@@ -59,9 +59,10 @@ public: ...@@ -59,9 +59,10 @@ public:
friend void to_json(nlohmann::json &j, const PreemptionVulnerability &o); friend void to_json(nlohmann::json &j, const PreemptionVulnerability &o);
friend void from_json(const nlohmann::json &j, PreemptionVulnerability &o); friend void from_json(const nlohmann::json &j, PreemptionVulnerability &o);
protected: protected:
std::string value;
}; };
} // namespace oai::udr::model } // namespace oai::udr::model
#endif /* PreemptionVulnerability_H_ */ #endif /* PreemptionVulnerability_H_ */
...@@ -43,8 +43,10 @@ void SscMode::validate() { ...@@ -43,8 +43,10 @@ void SscMode::validate() {
// TODO: implement validation // TODO: implement validation
} }
void to_json(nlohmann::json &j, const SscMode &o) { j = nlohmann::json(); } void to_json(nlohmann::json &j, const SscMode &o) { j = o.get_value(); }
void from_json(const nlohmann::json &j, SscMode &o) {} void from_json(const nlohmann::json &j, SscMode &o) {
o.set_value(j.get<std::string>());
}
} // namespace oai::udr::model } // namespace oai::udr::model
...@@ -47,7 +47,7 @@ namespace oai::udr::model { ...@@ -47,7 +47,7 @@ namespace oai::udr::model {
/// ///
/// </summary> /// </summary>
class SscMode { class SscMode {
public: public:
SscMode(); SscMode();
virtual ~SscMode(); virtual ~SscMode();
...@@ -59,9 +59,10 @@ public: ...@@ -59,9 +59,10 @@ public:
friend void to_json(nlohmann::json &j, const SscMode &o); friend void to_json(nlohmann::json &j, const SscMode &o);
friend void from_json(const nlohmann::json &j, SscMode &o); friend void from_json(const nlohmann::json &j, SscMode &o);
protected: protected:
std::string value;
}; };
} // namespace oai::udr::model } // namespace oai::udr::model
#endif /* SscMode_H_ */ #endif /* SscMode_H_ */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment