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

323 lines
8.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 "Preview_settings.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Preview_settings::Preview_settings()
{
m_Saturation = 0L;
m_Show_spots = true;
m_Show_spotsIsSet = false;
m_Show_roi = false;
m_Show_roiIsSet = false;
m_Jpeg_quality = 100L;
m_Jpeg_qualityIsSet = false;
m_Show_indexed = false;
m_Show_indexedIsSet = false;
m_Show_user_mask = false;
m_Show_user_maskIsSet = false;
m_Resolution_ring = 0.1f;
m_Resolution_ringIsSet = false;
}
void Preview_settings::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Preview_settings::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Preview_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Preview_settings" : pathPrefix;
/* Saturation */ {
const int64_t& value = m_Saturation;
const std::string currentValuePath = _pathPrefix + ".saturation";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
if (value > 65535ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 65535;";
}
}
if (jpegQualityIsSet())
{
const int64_t& value = m_Jpeg_quality;
const std::string currentValuePath = _pathPrefix + ".jpegQuality";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
if (value > 100ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 100;";
}
}
if (resolutionRingIsSet())
{
const float& value = m_Resolution_ring;
const std::string currentValuePath = _pathPrefix + ".resolutionRing";
if (value < static_cast<float>(0.1))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0.1;";
}
if (value > static_cast<float>(100.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 100.0;";
}
}
return success;
}
bool Preview_settings::operator==(const Preview_settings& rhs) const
{
return
(getSaturation() == rhs.getSaturation())
&&
((!showSpotsIsSet() && !rhs.showSpotsIsSet()) || (showSpotsIsSet() && rhs.showSpotsIsSet() && isShowSpots() == rhs.isShowSpots())) &&
((!showRoiIsSet() && !rhs.showRoiIsSet()) || (showRoiIsSet() && rhs.showRoiIsSet() && isShowRoi() == rhs.isShowRoi())) &&
((!jpegQualityIsSet() && !rhs.jpegQualityIsSet()) || (jpegQualityIsSet() && rhs.jpegQualityIsSet() && getJpegQuality() == rhs.getJpegQuality())) &&
((!showIndexedIsSet() && !rhs.showIndexedIsSet()) || (showIndexedIsSet() && rhs.showIndexedIsSet() && isShowIndexed() == rhs.isShowIndexed())) &&
((!showUserMaskIsSet() && !rhs.showUserMaskIsSet()) || (showUserMaskIsSet() && rhs.showUserMaskIsSet() && isShowUserMask() == rhs.isShowUserMask())) &&
((!resolutionRingIsSet() && !rhs.resolutionRingIsSet()) || (resolutionRingIsSet() && rhs.resolutionRingIsSet() && getResolutionRing() == rhs.getResolutionRing()))
;
}
bool Preview_settings::operator!=(const Preview_settings& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Preview_settings& o)
{
j = nlohmann::json::object();
j["saturation"] = o.m_Saturation;
if(o.showSpotsIsSet())
j["show_spots"] = o.m_Show_spots;
if(o.showRoiIsSet())
j["show_roi"] = o.m_Show_roi;
if(o.jpegQualityIsSet())
j["jpeg_quality"] = o.m_Jpeg_quality;
if(o.showIndexedIsSet())
j["show_indexed"] = o.m_Show_indexed;
if(o.showUserMaskIsSet())
j["show_user_mask"] = o.m_Show_user_mask;
if(o.resolutionRingIsSet())
j["resolution_ring"] = o.m_Resolution_ring;
}
void from_json(const nlohmann::json& j, Preview_settings& o)
{
j.at("saturation").get_to(o.m_Saturation);
if(j.find("show_spots") != j.end())
{
j.at("show_spots").get_to(o.m_Show_spots);
o.m_Show_spotsIsSet = true;
}
if(j.find("show_roi") != j.end())
{
j.at("show_roi").get_to(o.m_Show_roi);
o.m_Show_roiIsSet = true;
}
if(j.find("jpeg_quality") != j.end())
{
j.at("jpeg_quality").get_to(o.m_Jpeg_quality);
o.m_Jpeg_qualityIsSet = true;
}
if(j.find("show_indexed") != j.end())
{
j.at("show_indexed").get_to(o.m_Show_indexed);
o.m_Show_indexedIsSet = true;
}
if(j.find("show_user_mask") != j.end())
{
j.at("show_user_mask").get_to(o.m_Show_user_mask);
o.m_Show_user_maskIsSet = true;
}
if(j.find("resolution_ring") != j.end())
{
j.at("resolution_ring").get_to(o.m_Resolution_ring);
o.m_Resolution_ringIsSet = true;
}
}
int64_t Preview_settings::getSaturation() const
{
return m_Saturation;
}
void Preview_settings::setSaturation(int64_t const value)
{
m_Saturation = value;
}
bool Preview_settings::isShowSpots() const
{
return m_Show_spots;
}
void Preview_settings::setShowSpots(bool const value)
{
m_Show_spots = value;
m_Show_spotsIsSet = true;
}
bool Preview_settings::showSpotsIsSet() const
{
return m_Show_spotsIsSet;
}
void Preview_settings::unsetShow_spots()
{
m_Show_spotsIsSet = false;
}
bool Preview_settings::isShowRoi() const
{
return m_Show_roi;
}
void Preview_settings::setShowRoi(bool const value)
{
m_Show_roi = value;
m_Show_roiIsSet = true;
}
bool Preview_settings::showRoiIsSet() const
{
return m_Show_roiIsSet;
}
void Preview_settings::unsetShow_roi()
{
m_Show_roiIsSet = false;
}
int64_t Preview_settings::getJpegQuality() const
{
return m_Jpeg_quality;
}
void Preview_settings::setJpegQuality(int64_t const value)
{
m_Jpeg_quality = value;
m_Jpeg_qualityIsSet = true;
}
bool Preview_settings::jpegQualityIsSet() const
{
return m_Jpeg_qualityIsSet;
}
void Preview_settings::unsetJpeg_quality()
{
m_Jpeg_qualityIsSet = false;
}
bool Preview_settings::isShowIndexed() const
{
return m_Show_indexed;
}
void Preview_settings::setShowIndexed(bool const value)
{
m_Show_indexed = value;
m_Show_indexedIsSet = true;
}
bool Preview_settings::showIndexedIsSet() const
{
return m_Show_indexedIsSet;
}
void Preview_settings::unsetShow_indexed()
{
m_Show_indexedIsSet = false;
}
bool Preview_settings::isShowUserMask() const
{
return m_Show_user_mask;
}
void Preview_settings::setShowUserMask(bool const value)
{
m_Show_user_mask = value;
m_Show_user_maskIsSet = true;
}
bool Preview_settings::showUserMaskIsSet() const
{
return m_Show_user_maskIsSet;
}
void Preview_settings::unsetShow_user_mask()
{
m_Show_user_maskIsSet = false;
}
float Preview_settings::getResolutionRing() const
{
return m_Resolution_ring;
}
void Preview_settings::setResolutionRing(float const value)
{
m_Resolution_ring = value;
m_Resolution_ringIsSet = true;
}
bool Preview_settings::resolutionRingIsSet() const
{
return m_Resolution_ringIsSet;
}
void Preview_settings::unsetResolution_ring()
{
m_Resolution_ringIsSet = false;
}
} // namespace org::openapitools::server::model