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

261 lines
5.8 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 "Dataset_settings_unit_cell.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Dataset_settings_unit_cell::Dataset_settings_unit_cell()
{
m_a = 0.0f;
m_b = 0.0f;
m_c = 0.0f;
m_Alpha = 0.0f;
m_Beta = 0.0f;
m_Gamma = 0.0f;
}
void Dataset_settings_unit_cell::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Dataset_settings_unit_cell::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Dataset_settings_unit_cell::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Dataset_settings_unit_cell" : pathPrefix;
/* a */ {
const float& value = m_a;
const std::string currentValuePath = _pathPrefix + ".A";
if (value < static_cast<float>(0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
/* b */ {
const float& value = m_b;
const std::string currentValuePath = _pathPrefix + ".B";
if (value < static_cast<float>(0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
/* c */ {
const float& value = m_c;
const std::string currentValuePath = _pathPrefix + ".C";
if (value < static_cast<float>(0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
/* Alpha */ {
const float& value = m_Alpha;
const std::string currentValuePath = _pathPrefix + ".alpha";
if (value < static_cast<float>(0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
if (value > static_cast<float>(360))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 360;";
}
}
/* Beta */ {
const float& value = m_Beta;
const std::string currentValuePath = _pathPrefix + ".beta";
if (value < static_cast<float>(0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
if (value > static_cast<float>(360))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 360;";
}
}
/* Gamma */ {
const float& value = m_Gamma;
const std::string currentValuePath = _pathPrefix + ".gamma";
if (value < static_cast<float>(0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
if (value > static_cast<float>(360))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 360;";
}
}
return success;
}
bool Dataset_settings_unit_cell::operator==(const Dataset_settings_unit_cell& rhs) const
{
return
(getA() == rhs.getA())
&&
(getB() == rhs.getB())
&&
(getC() == rhs.getC())
&&
(getAlpha() == rhs.getAlpha())
&&
(getBeta() == rhs.getBeta())
&&
(getGamma() == rhs.getGamma())
;
}
bool Dataset_settings_unit_cell::operator!=(const Dataset_settings_unit_cell& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Dataset_settings_unit_cell& o)
{
j = nlohmann::json::object();
j["a"] = o.m_a;
j["b"] = o.m_b;
j["c"] = o.m_c;
j["alpha"] = o.m_Alpha;
j["beta"] = o.m_Beta;
j["gamma"] = o.m_Gamma;
}
void from_json(const nlohmann::json& j, Dataset_settings_unit_cell& o)
{
j.at("a").get_to(o.m_a);
j.at("b").get_to(o.m_b);
j.at("c").get_to(o.m_c);
j.at("alpha").get_to(o.m_Alpha);
j.at("beta").get_to(o.m_Beta);
j.at("gamma").get_to(o.m_Gamma);
}
float Dataset_settings_unit_cell::getA() const
{
return m_a;
}
void Dataset_settings_unit_cell::setA(float const value)
{
m_a = value;
}
float Dataset_settings_unit_cell::getB() const
{
return m_b;
}
void Dataset_settings_unit_cell::setB(float const value)
{
m_b = value;
}
float Dataset_settings_unit_cell::getC() const
{
return m_c;
}
void Dataset_settings_unit_cell::setC(float const value)
{
m_c = value;
}
float Dataset_settings_unit_cell::getAlpha() const
{
return m_Alpha;
}
void Dataset_settings_unit_cell::setAlpha(float const value)
{
m_Alpha = value;
}
float Dataset_settings_unit_cell::getBeta() const
{
return m_Beta;
}
void Dataset_settings_unit_cell::setBeta(float const value)
{
m_Beta = value;
}
float Dataset_settings_unit_cell::getGamma() const
{
return m_Gamma;
}
void Dataset_settings_unit_cell::setGamma(float const value)
{
m_Gamma = value;
}
} // namespace org::openapitools::server::model