Files
Jungfraujoch/broker/gen/model/Detector_timing.cpp
2024-11-22 21:25:20 +01:00

129 lines
3.2 KiB
C++

/**
* 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.25
* 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_timing.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace org::openapitools::server::model
{
Detector_timing::Detector_timing()
{
}
void Detector_timing::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector_timing::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector_timing::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_timing" : pathPrefix;
if (m_value == Detector_timing::eDetector_timing::INVALID_VALUE_OPENAPI_GENERATED)
{
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool Detector_timing::operator==(const Detector_timing& rhs) const
{
return
getValue() == rhs.getValue()
;
}
bool Detector_timing::operator!=(const Detector_timing& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector_timing& o)
{
j = nlohmann::json::object();
switch (o.getValue())
{
case Detector_timing::eDetector_timing::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case Detector_timing::eDetector_timing::AUTO:
j = "auto";
break;
case Detector_timing::eDetector_timing::TRIGGER:
j = "trigger";
break;
case Detector_timing::eDetector_timing::BURST:
j = "burst";
break;
case Detector_timing::eDetector_timing::GATED:
j = "gated";
break;
}
}
void from_json(const nlohmann::json& j, Detector_timing& o)
{
auto s = j.get<std::string>();
if (s == "auto") {
o.setValue(Detector_timing::eDetector_timing::AUTO);
}
else if (s == "trigger") {
o.setValue(Detector_timing::eDetector_timing::TRIGGER);
}
else if (s == "burst") {
o.setValue(Detector_timing::eDetector_timing::BURST);
}
else if (s == "gated") {
o.setValue(Detector_timing::eDetector_timing::GATED);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " Detector_timing::eDetector_timing";
throw std::invalid_argument(ss.str());
}
}
Detector_timing::eDetector_timing Detector_timing::getValue() const
{
return m_value;
}
void Detector_timing::setValue(Detector_timing::eDetector_timing value)
{
m_value = value;
}
} // namespace org::openapitools::server::model