Files
Jungfraujoch/broker/gen/model/Spot_finding_settings.cpp
2025-07-15 09:55:19 +02:00

322 lines
9.0 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.64
* 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 "Spot_finding_settings.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Spot_finding_settings::Spot_finding_settings()
{
m_Enable = true;
m_Indexing = true;
m_Signal_to_noise_threshold = 0.0f;
m_Photon_count_threshold = 0L;
m_Min_pix_per_spot = 0L;
m_Max_pix_per_spot = 0L;
m_High_resolution_limit = 0.0f;
m_Low_resolution_limit = 0.0f;
m_High_resolution_limit_for_spot_count_low_res = 0.0f;
m_Resolution_estimate = true;
m_Resolution_estimateIsSet = false;
m_Quick_integration = false;
}
void Spot_finding_settings::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Spot_finding_settings::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Spot_finding_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Spot_finding_settings" : pathPrefix;
/* Signal_to_noise_threshold */ {
const float& value = m_Signal_to_noise_threshold;
const std::string currentValuePath = _pathPrefix + ".signalToNoiseThreshold";
if (value < static_cast<float>(0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
/* Photon_count_threshold */ {
const int64_t& value = m_Photon_count_threshold;
const std::string currentValuePath = _pathPrefix + ".photonCountThreshold";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
/* Min_pix_per_spot */ {
const int64_t& value = m_Min_pix_per_spot;
const std::string currentValuePath = _pathPrefix + ".minPixPerSpot";
if (value < 1ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
}
/* Max_pix_per_spot */ {
const int64_t& value = m_Max_pix_per_spot;
const std::string currentValuePath = _pathPrefix + ".maxPixPerSpot";
if (value < 1ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
}
/* High_resolution_limit_for_spot_count_low_res */ {
const float& value = m_High_resolution_limit_for_spot_count_low_res;
const std::string currentValuePath = _pathPrefix + ".highResolutionLimitForSpotCountLowRes";
if (value < static_cast<float>(2.0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 2.0;";
}
if (value > static_cast<float>(8.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 8.0;";
}
}
return success;
}
bool Spot_finding_settings::operator==(const Spot_finding_settings& rhs) const
{
return
(isEnable() == rhs.isEnable())
&&
(isIndexing() == rhs.isIndexing())
&&
(getSignalToNoiseThreshold() == rhs.getSignalToNoiseThreshold())
&&
(getPhotonCountThreshold() == rhs.getPhotonCountThreshold())
&&
(getMinPixPerSpot() == rhs.getMinPixPerSpot())
&&
(getMaxPixPerSpot() == rhs.getMaxPixPerSpot())
&&
(getHighResolutionLimit() == rhs.getHighResolutionLimit())
&&
(getLowResolutionLimit() == rhs.getLowResolutionLimit())
&&
(getHighResolutionLimitForSpotCountLowRes() == rhs.getHighResolutionLimitForSpotCountLowRes())
&&
((!resolutionEstimateIsSet() && !rhs.resolutionEstimateIsSet()) || (resolutionEstimateIsSet() && rhs.resolutionEstimateIsSet() && isResolutionEstimate() == rhs.isResolutionEstimate())) &&
(isQuickIntegration() == rhs.isQuickIntegration())
;
}
bool Spot_finding_settings::operator!=(const Spot_finding_settings& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Spot_finding_settings& o)
{
j = nlohmann::json::object();
j["enable"] = o.m_Enable;
j["indexing"] = o.m_Indexing;
j["signal_to_noise_threshold"] = o.m_Signal_to_noise_threshold;
j["photon_count_threshold"] = o.m_Photon_count_threshold;
j["min_pix_per_spot"] = o.m_Min_pix_per_spot;
j["max_pix_per_spot"] = o.m_Max_pix_per_spot;
j["high_resolution_limit"] = o.m_High_resolution_limit;
j["low_resolution_limit"] = o.m_Low_resolution_limit;
j["high_resolution_limit_for_spot_count_low_res"] = o.m_High_resolution_limit_for_spot_count_low_res;
if(o.resolutionEstimateIsSet())
j["resolution_estimate"] = o.m_Resolution_estimate;
j["quick_integration"] = o.m_Quick_integration;
}
void from_json(const nlohmann::json& j, Spot_finding_settings& o)
{
j.at("enable").get_to(o.m_Enable);
j.at("indexing").get_to(o.m_Indexing);
j.at("signal_to_noise_threshold").get_to(o.m_Signal_to_noise_threshold);
j.at("photon_count_threshold").get_to(o.m_Photon_count_threshold);
j.at("min_pix_per_spot").get_to(o.m_Min_pix_per_spot);
j.at("max_pix_per_spot").get_to(o.m_Max_pix_per_spot);
j.at("high_resolution_limit").get_to(o.m_High_resolution_limit);
j.at("low_resolution_limit").get_to(o.m_Low_resolution_limit);
j.at("high_resolution_limit_for_spot_count_low_res").get_to(o.m_High_resolution_limit_for_spot_count_low_res);
if(j.find("resolution_estimate") != j.end())
{
j.at("resolution_estimate").get_to(o.m_Resolution_estimate);
o.m_Resolution_estimateIsSet = true;
}
j.at("quick_integration").get_to(o.m_Quick_integration);
}
bool Spot_finding_settings::isEnable() const
{
return m_Enable;
}
void Spot_finding_settings::setEnable(bool const value)
{
m_Enable = value;
}
bool Spot_finding_settings::isIndexing() const
{
return m_Indexing;
}
void Spot_finding_settings::setIndexing(bool const value)
{
m_Indexing = value;
}
float Spot_finding_settings::getSignalToNoiseThreshold() const
{
return m_Signal_to_noise_threshold;
}
void Spot_finding_settings::setSignalToNoiseThreshold(float const value)
{
m_Signal_to_noise_threshold = value;
}
int64_t Spot_finding_settings::getPhotonCountThreshold() const
{
return m_Photon_count_threshold;
}
void Spot_finding_settings::setPhotonCountThreshold(int64_t const value)
{
m_Photon_count_threshold = value;
}
int64_t Spot_finding_settings::getMinPixPerSpot() const
{
return m_Min_pix_per_spot;
}
void Spot_finding_settings::setMinPixPerSpot(int64_t const value)
{
m_Min_pix_per_spot = value;
}
int64_t Spot_finding_settings::getMaxPixPerSpot() const
{
return m_Max_pix_per_spot;
}
void Spot_finding_settings::setMaxPixPerSpot(int64_t const value)
{
m_Max_pix_per_spot = value;
}
float Spot_finding_settings::getHighResolutionLimit() const
{
return m_High_resolution_limit;
}
void Spot_finding_settings::setHighResolutionLimit(float const value)
{
m_High_resolution_limit = value;
}
float Spot_finding_settings::getLowResolutionLimit() const
{
return m_Low_resolution_limit;
}
void Spot_finding_settings::setLowResolutionLimit(float const value)
{
m_Low_resolution_limit = value;
}
float Spot_finding_settings::getHighResolutionLimitForSpotCountLowRes() const
{
return m_High_resolution_limit_for_spot_count_low_res;
}
void Spot_finding_settings::setHighResolutionLimitForSpotCountLowRes(float const value)
{
m_High_resolution_limit_for_spot_count_low_res = value;
}
bool Spot_finding_settings::isResolutionEstimate() const
{
return m_Resolution_estimate;
}
void Spot_finding_settings::setResolutionEstimate(bool const value)
{
m_Resolution_estimate = value;
m_Resolution_estimateIsSet = true;
}
bool Spot_finding_settings::resolutionEstimateIsSet() const
{
return m_Resolution_estimateIsSet;
}
void Spot_finding_settings::unsetResolution_estimate()
{
m_Resolution_estimateIsSet = false;
}
bool Spot_finding_settings::isQuickIntegration() const
{
return m_Quick_integration;
}
void Spot_finding_settings::setQuickIntegration(bool const value)
{
m_Quick_integration = value;
}
} // namespace org::openapitools::server::model