Files
Jungfraujoch/broker/gen/model/Pixel_mask_statistics.cpp
2025-07-03 15:10:04 +02:00

207 lines
5.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.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 "Pixel_mask_statistics.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Pixel_mask_statistics::Pixel_mask_statistics()
{
m_User_mask = 0L;
m_User_maskIsSet = false;
m_Too_high_pedestal_rms = 0L;
m_Too_high_pedestal_rmsIsSet = false;
m_Wrong_gain = 0L;
m_Wrong_gainIsSet = false;
}
void Pixel_mask_statistics::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Pixel_mask_statistics::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Pixel_mask_statistics::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Pixel_mask_statistics" : pathPrefix;
if (userMaskIsSet())
{
const int64_t& value = m_User_mask;
const std::string currentValuePath = _pathPrefix + ".userMask";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (tooHighPedestalRmsIsSet())
{
const int64_t& value = m_Too_high_pedestal_rms;
const std::string currentValuePath = _pathPrefix + ".tooHighPedestalRms";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (wrongGainIsSet())
{
const int64_t& value = m_Wrong_gain;
const std::string currentValuePath = _pathPrefix + ".wrongGain";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
return success;
}
bool Pixel_mask_statistics::operator==(const Pixel_mask_statistics& rhs) const
{
return
((!userMaskIsSet() && !rhs.userMaskIsSet()) || (userMaskIsSet() && rhs.userMaskIsSet() && getUserMask() == rhs.getUserMask())) &&
((!tooHighPedestalRmsIsSet() && !rhs.tooHighPedestalRmsIsSet()) || (tooHighPedestalRmsIsSet() && rhs.tooHighPedestalRmsIsSet() && getTooHighPedestalRms() == rhs.getTooHighPedestalRms())) &&
((!wrongGainIsSet() && !rhs.wrongGainIsSet()) || (wrongGainIsSet() && rhs.wrongGainIsSet() && getWrongGain() == rhs.getWrongGain()))
;
}
bool Pixel_mask_statistics::operator!=(const Pixel_mask_statistics& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Pixel_mask_statistics& o)
{
j = nlohmann::json::object();
if(o.userMaskIsSet())
j["user_mask"] = o.m_User_mask;
if(o.tooHighPedestalRmsIsSet())
j["too_high_pedestal_rms"] = o.m_Too_high_pedestal_rms;
if(o.wrongGainIsSet())
j["wrong_gain"] = o.m_Wrong_gain;
}
void from_json(const nlohmann::json& j, Pixel_mask_statistics& o)
{
if(j.find("user_mask") != j.end())
{
j.at("user_mask").get_to(o.m_User_mask);
o.m_User_maskIsSet = true;
}
if(j.find("too_high_pedestal_rms") != j.end())
{
j.at("too_high_pedestal_rms").get_to(o.m_Too_high_pedestal_rms);
o.m_Too_high_pedestal_rmsIsSet = true;
}
if(j.find("wrong_gain") != j.end())
{
j.at("wrong_gain").get_to(o.m_Wrong_gain);
o.m_Wrong_gainIsSet = true;
}
}
int64_t Pixel_mask_statistics::getUserMask() const
{
return m_User_mask;
}
void Pixel_mask_statistics::setUserMask(int64_t const value)
{
m_User_mask = value;
m_User_maskIsSet = true;
}
bool Pixel_mask_statistics::userMaskIsSet() const
{
return m_User_maskIsSet;
}
void Pixel_mask_statistics::unsetUser_mask()
{
m_User_maskIsSet = false;
}
int64_t Pixel_mask_statistics::getTooHighPedestalRms() const
{
return m_Too_high_pedestal_rms;
}
void Pixel_mask_statistics::setTooHighPedestalRms(int64_t const value)
{
m_Too_high_pedestal_rms = value;
m_Too_high_pedestal_rmsIsSet = true;
}
bool Pixel_mask_statistics::tooHighPedestalRmsIsSet() const
{
return m_Too_high_pedestal_rmsIsSet;
}
void Pixel_mask_statistics::unsetToo_high_pedestal_rms()
{
m_Too_high_pedestal_rmsIsSet = false;
}
int64_t Pixel_mask_statistics::getWrongGain() const
{
return m_Wrong_gain;
}
void Pixel_mask_statistics::setWrongGain(int64_t const value)
{
m_Wrong_gain = value;
m_Wrong_gainIsSet = true;
}
bool Pixel_mask_statistics::wrongGainIsSet() const
{
return m_Wrong_gainIsSet;
}
void Pixel_mask_statistics::unsetWrong_gain()
{
m_Wrong_gainIsSet = false;
}
} // namespace org::openapitools::server::model