129 lines
3.6 KiB
C++
129 lines
3.6 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.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_module_direction.h"
|
|
#include "Helpers.h"
|
|
#include <stdexcept>
|
|
#include <sstream>
|
|
|
|
namespace org::openapitools::server::model
|
|
{
|
|
|
|
Detector_module_direction::Detector_module_direction()
|
|
{
|
|
|
|
}
|
|
|
|
void Detector_module_direction::validate() const
|
|
{
|
|
std::stringstream msg;
|
|
if (!validate(msg))
|
|
{
|
|
throw org::openapitools::server::helpers::ValidationException(msg.str());
|
|
}
|
|
}
|
|
|
|
bool Detector_module_direction::validate(std::stringstream& msg) const
|
|
{
|
|
return validate(msg, "");
|
|
}
|
|
|
|
bool Detector_module_direction::validate(std::stringstream& msg, const std::string& pathPrefix) const
|
|
{
|
|
bool success = true;
|
|
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_module_direction" : pathPrefix;
|
|
|
|
|
|
if (m_value == Detector_module_direction::eDetector_module_direction::INVALID_VALUE_OPENAPI_GENERATED)
|
|
{
|
|
success = false;
|
|
msg << _pathPrefix << ": has no value;";
|
|
}
|
|
|
|
return success;
|
|
}
|
|
|
|
bool Detector_module_direction::operator==(const Detector_module_direction& rhs) const
|
|
{
|
|
return
|
|
getValue() == rhs.getValue()
|
|
|
|
;
|
|
}
|
|
|
|
bool Detector_module_direction::operator!=(const Detector_module_direction& rhs) const
|
|
{
|
|
return !(*this == rhs);
|
|
}
|
|
|
|
void to_json(nlohmann::json& j, const Detector_module_direction& o)
|
|
{
|
|
j = nlohmann::json::object();
|
|
|
|
switch (o.getValue())
|
|
{
|
|
case Detector_module_direction::eDetector_module_direction::INVALID_VALUE_OPENAPI_GENERATED:
|
|
j = "INVALID_VALUE_OPENAPI_GENERATED";
|
|
break;
|
|
case Detector_module_direction::eDetector_module_direction::XP:
|
|
j = "Xp";
|
|
break;
|
|
case Detector_module_direction::eDetector_module_direction::XN:
|
|
j = "Xn";
|
|
break;
|
|
case Detector_module_direction::eDetector_module_direction::YP:
|
|
j = "Yp";
|
|
break;
|
|
case Detector_module_direction::eDetector_module_direction::YN:
|
|
j = "Yn";
|
|
break;
|
|
}
|
|
}
|
|
|
|
void from_json(const nlohmann::json& j, Detector_module_direction& o)
|
|
{
|
|
|
|
auto s = j.get<std::string>();
|
|
if (s == "Xp") {
|
|
o.setValue(Detector_module_direction::eDetector_module_direction::XP);
|
|
}
|
|
else if (s == "Xn") {
|
|
o.setValue(Detector_module_direction::eDetector_module_direction::XN);
|
|
}
|
|
else if (s == "Yp") {
|
|
o.setValue(Detector_module_direction::eDetector_module_direction::YP);
|
|
}
|
|
else if (s == "Yn") {
|
|
o.setValue(Detector_module_direction::eDetector_module_direction::YN);
|
|
} else {
|
|
std::stringstream ss;
|
|
ss << "Unexpected value " << s << " in json"
|
|
<< " cannot be converted to enum of type"
|
|
<< " Detector_module_direction::eDetector_module_direction";
|
|
throw std::invalid_argument(ss.str());
|
|
}
|
|
|
|
}
|
|
|
|
Detector_module_direction::eDetector_module_direction Detector_module_direction::getValue() const
|
|
{
|
|
return m_value;
|
|
}
|
|
void Detector_module_direction::setValue(Detector_module_direction::eDetector_module_direction value)
|
|
{
|
|
m_value = value;
|
|
}
|
|
|
|
} // namespace org::openapitools::server::model
|
|
|