/** * Jungfraujoch * API to control Jungfraujoch developed by the Paul Scherrer Institute (Switzerland). Jungfraujoch is a data acquisition and analysis system for pixel array detectors, primarly PSI JUNGFRAU. Jungfraujoch uses FPGA boards to acquire data at high data rates. * * The version of the OpenAPI document: 1.0.0-rc.58 * Contact: filip.leonarski@psi.ch * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ #include "Detector_state.h" #include "Helpers.h" #include #include namespace org::openapitools::server::model { Detector_state::Detector_state() { } void Detector_state::validate() const { std::stringstream msg; if (!validate(msg)) { throw org::openapitools::server::helpers::ValidationException(msg.str()); } } bool Detector_state::validate(std::stringstream& msg) const { return validate(msg, ""); } bool Detector_state::validate(std::stringstream& msg, const std::string& pathPrefix) const { bool success = true; const std::string _pathPrefix = pathPrefix.empty() ? "Detector_state" : pathPrefix; if (m_value == Detector_state::eDetector_state::INVALID_VALUE_OPENAPI_GENERATED) { success = false; msg << _pathPrefix << ": has no value;"; } return success; } bool Detector_state::operator==(const Detector_state& rhs) const { return getValue() == rhs.getValue() ; } bool Detector_state::operator!=(const Detector_state& rhs) const { return !(*this == rhs); } void to_json(nlohmann::json& j, const Detector_state& o) { j = nlohmann::json::object(); switch (o.getValue()) { case Detector_state::eDetector_state::INVALID_VALUE_OPENAPI_GENERATED: j = "INVALID_VALUE_OPENAPI_GENERATED"; break; case Detector_state::eDetector_state::IDLE: j = "Idle"; break; case Detector_state::eDetector_state::WAITING: j = "Waiting"; break; case Detector_state::eDetector_state::BUSY: j = "Busy"; break; case Detector_state::eDetector_state::ERROR: j = "Error"; break; case Detector_state::eDetector_state::NOT_CONNECTED: j = "Not connected"; break; } } void from_json(const nlohmann::json& j, Detector_state& o) { auto s = j.get(); if (s == "Idle") { o.setValue(Detector_state::eDetector_state::IDLE); } else if (s == "Waiting") { o.setValue(Detector_state::eDetector_state::WAITING); } else if (s == "Busy") { o.setValue(Detector_state::eDetector_state::BUSY); } else if (s == "Error") { o.setValue(Detector_state::eDetector_state::ERROR); } else if (s == "Not connected") { o.setValue(Detector_state::eDetector_state::NOT_CONNECTED); } else { std::stringstream ss; ss << "Unexpected value " << s << " in json" << " cannot be converted to enum of type" << " Detector_state::eDetector_state"; throw std::invalid_argument(ss.str()); } } Detector_state::eDetector_state Detector_state::getValue() const { return m_value; } void Detector_state::setValue(Detector_state::eDetector_state value) { m_value = value; } } // namespace org::openapitools::server::model