Files
Jungfraujoch/broker/gen/model/Spot_finding_settings.cpp
2024-12-02 21:17:14 +01:00

351 lines
9.7 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.27
* 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_Filter_powder_rings = false;
m_Filter_powder_ringsIsSet = false;
m_Min_spot_count_powder_ring = 0L;
m_Min_spot_count_powder_ringIsSet = false;
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_Indexing_tolerance = 0.0f;
}
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;
if (minSpotCountPowderRingIsSet())
{
const int64_t& value = m_Min_spot_count_powder_ring;
const std::string currentValuePath = _pathPrefix + ".minSpotCountPowderRing";
if (value < 5ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 5;";
}
}
/* 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;";
}
}
/* Indexing_tolerance */ {
const float& value = m_Indexing_tolerance;
const std::string currentValuePath = _pathPrefix + ".indexingTolerance";
if (value < static_cast<float>(0.0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0.0;";
}
if (value > static_cast<float>(1.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 1.0;";
}
}
return success;
}
bool Spot_finding_settings::operator==(const Spot_finding_settings& rhs) const
{
return
(isEnable() == rhs.isEnable())
&&
(isIndexing() == rhs.isIndexing())
&&
((!filterPowderRingsIsSet() && !rhs.filterPowderRingsIsSet()) || (filterPowderRingsIsSet() && rhs.filterPowderRingsIsSet() && isFilterPowderRings() == rhs.isFilterPowderRings())) &&
((!minSpotCountPowderRingIsSet() && !rhs.minSpotCountPowderRingIsSet()) || (minSpotCountPowderRingIsSet() && rhs.minSpotCountPowderRingIsSet() && getMinSpotCountPowderRing() == rhs.getMinSpotCountPowderRing())) &&
(getSignalToNoiseThreshold() == rhs.getSignalToNoiseThreshold())
&&
(getPhotonCountThreshold() == rhs.getPhotonCountThreshold())
&&
(getMinPixPerSpot() == rhs.getMinPixPerSpot())
&&
(getMaxPixPerSpot() == rhs.getMaxPixPerSpot())
&&
(getHighResolutionLimit() == rhs.getHighResolutionLimit())
&&
(getLowResolutionLimit() == rhs.getLowResolutionLimit())
&&
(getIndexingTolerance() == rhs.getIndexingTolerance())
;
}
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;
if(o.filterPowderRingsIsSet())
j["filter_powder_rings"] = o.m_Filter_powder_rings;
if(o.minSpotCountPowderRingIsSet())
j["min_spot_count_powder_ring"] = o.m_Min_spot_count_powder_ring;
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["indexing_tolerance"] = o.m_Indexing_tolerance;
}
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);
if(j.find("filter_powder_rings") != j.end())
{
j.at("filter_powder_rings").get_to(o.m_Filter_powder_rings);
o.m_Filter_powder_ringsIsSet = true;
}
if(j.find("min_spot_count_powder_ring") != j.end())
{
j.at("min_spot_count_powder_ring").get_to(o.m_Min_spot_count_powder_ring);
o.m_Min_spot_count_powder_ringIsSet = true;
}
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("indexing_tolerance").get_to(o.m_Indexing_tolerance);
}
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;
}
bool Spot_finding_settings::isFilterPowderRings() const
{
return m_Filter_powder_rings;
}
void Spot_finding_settings::setFilterPowderRings(bool const value)
{
m_Filter_powder_rings = value;
m_Filter_powder_ringsIsSet = true;
}
bool Spot_finding_settings::filterPowderRingsIsSet() const
{
return m_Filter_powder_ringsIsSet;
}
void Spot_finding_settings::unsetFilter_powder_rings()
{
m_Filter_powder_ringsIsSet = false;
}
int64_t Spot_finding_settings::getMinSpotCountPowderRing() const
{
return m_Min_spot_count_powder_ring;
}
void Spot_finding_settings::setMinSpotCountPowderRing(int64_t const value)
{
m_Min_spot_count_powder_ring = value;
m_Min_spot_count_powder_ringIsSet = true;
}
bool Spot_finding_settings::minSpotCountPowderRingIsSet() const
{
return m_Min_spot_count_powder_ringIsSet;
}
void Spot_finding_settings::unsetMin_spot_count_powder_ring()
{
m_Min_spot_count_powder_ringIsSet = false;
}
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::getIndexingTolerance() const
{
return m_Indexing_tolerance;
}
void Spot_finding_settings::setIndexingTolerance(float const value)
{
m_Indexing_tolerance = value;
}
} // namespace org::openapitools::server::model