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

251 lines
6.4 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 "Indexing_settings.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Indexing_settings::Indexing_settings()
{
m_Fft_max_unit_cell_A = 250.0f;
m_Fft_min_unit_cell_A = 10.0f;
m_Fft_high_resolution_A = 2.0f;
m_Fft_num_vectors = 16384L;
m_Tolerance = 0.0f;
}
void Indexing_settings::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Indexing_settings::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Indexing_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Indexing_settings" : pathPrefix;
/* Fft_max_unit_cell_A */ {
const float& value = m_Fft_max_unit_cell_A;
const std::string currentValuePath = _pathPrefix + ".fftMaxUnitCellA";
if (value < static_cast<float>(50))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 50;";
}
if (value > static_cast<float>(500))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 500;";
}
}
/* Fft_min_unit_cell_A */ {
const float& value = m_Fft_min_unit_cell_A;
const std::string currentValuePath = _pathPrefix + ".fftMinUnitCellA";
if (value < static_cast<float>(5))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 5;";
}
if (value > static_cast<float>(40))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 40;";
}
}
/* Fft_high_resolution_A */ {
const float& value = m_Fft_high_resolution_A;
const std::string currentValuePath = _pathPrefix + ".fftHighResolutionA";
if (value < static_cast<float>(0.5))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0.5;";
}
if (value > static_cast<float>(6.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 6.0;";
}
}
/* Fft_num_vectors */ {
const int64_t& value = m_Fft_num_vectors;
const std::string currentValuePath = _pathPrefix + ".fftNumVectors";
if (value < 128ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 128;";
}
}
/* Tolerance */ {
const float& value = m_Tolerance;
const std::string currentValuePath = _pathPrefix + ".tolerance";
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>(0.5))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 0.5;";
}
}
return success;
}
bool Indexing_settings::operator==(const Indexing_settings& rhs) const
{
return
(getAlgorithm() == rhs.getAlgorithm())
&&
(getFftMaxUnitCellA() == rhs.getFftMaxUnitCellA())
&&
(getFftMinUnitCellA() == rhs.getFftMinUnitCellA())
&&
(getFftHighResolutionA() == rhs.getFftHighResolutionA())
&&
(getFftNumVectors() == rhs.getFftNumVectors())
&&
(getTolerance() == rhs.getTolerance())
;
}
bool Indexing_settings::operator!=(const Indexing_settings& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Indexing_settings& o)
{
j = nlohmann::json::object();
j["algorithm"] = o.m_Algorithm;
j["fft_max_unit_cell_A"] = o.m_Fft_max_unit_cell_A;
j["fft_min_unit_cell_A"] = o.m_Fft_min_unit_cell_A;
j["fft_high_resolution_A"] = o.m_Fft_high_resolution_A;
j["fft_num_vectors"] = o.m_Fft_num_vectors;
j["tolerance"] = o.m_Tolerance;
}
void from_json(const nlohmann::json& j, Indexing_settings& o)
{
j.at("algorithm").get_to(o.m_Algorithm);
j.at("fft_max_unit_cell_A").get_to(o.m_Fft_max_unit_cell_A);
j.at("fft_min_unit_cell_A").get_to(o.m_Fft_min_unit_cell_A);
j.at("fft_high_resolution_A").get_to(o.m_Fft_high_resolution_A);
j.at("fft_num_vectors").get_to(o.m_Fft_num_vectors);
j.at("tolerance").get_to(o.m_Tolerance);
}
org::openapitools::server::model::Indexing_algorithm Indexing_settings::getAlgorithm() const
{
return m_Algorithm;
}
void Indexing_settings::setAlgorithm(org::openapitools::server::model::Indexing_algorithm const& value)
{
m_Algorithm = value;
}
float Indexing_settings::getFftMaxUnitCellA() const
{
return m_Fft_max_unit_cell_A;
}
void Indexing_settings::setFftMaxUnitCellA(float const value)
{
m_Fft_max_unit_cell_A = value;
}
float Indexing_settings::getFftMinUnitCellA() const
{
return m_Fft_min_unit_cell_A;
}
void Indexing_settings::setFftMinUnitCellA(float const value)
{
m_Fft_min_unit_cell_A = value;
}
float Indexing_settings::getFftHighResolutionA() const
{
return m_Fft_high_resolution_A;
}
void Indexing_settings::setFftHighResolutionA(float const value)
{
m_Fft_high_resolution_A = value;
}
int64_t Indexing_settings::getFftNumVectors() const
{
return m_Fft_num_vectors;
}
void Indexing_settings::setFftNumVectors(int64_t const value)
{
m_Fft_num_vectors = value;
}
float Indexing_settings::getTolerance() const
{
return m_Tolerance;
}
void Indexing_settings::setTolerance(float const value)
{
m_Tolerance = value;
}
} // namespace org::openapitools::server::model