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

192 lines
4.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.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 "Grid_scan.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Grid_scan::Grid_scan()
{
m_N_fast = 0L;
m_Step_x_um = 0.0f;
m_Step_y_um = 0.0f;
m_Vertical = false;
m_VerticalIsSet = false;
m_Snake = false;
m_SnakeIsSet = false;
}
void Grid_scan::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Grid_scan::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Grid_scan::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Grid_scan" : pathPrefix;
/* N_fast */ {
const int64_t& value = m_N_fast;
const std::string currentValuePath = _pathPrefix + ".nFast";
if (value < 1ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
}
return success;
}
bool Grid_scan::operator==(const Grid_scan& rhs) const
{
return
(getNFast() == rhs.getNFast())
&&
(getStepXUm() == rhs.getStepXUm())
&&
(getStepYUm() == rhs.getStepYUm())
&&
((!verticalIsSet() && !rhs.verticalIsSet()) || (verticalIsSet() && rhs.verticalIsSet() && isVertical() == rhs.isVertical())) &&
((!snakeIsSet() && !rhs.snakeIsSet()) || (snakeIsSet() && rhs.snakeIsSet() && isSnake() == rhs.isSnake()))
;
}
bool Grid_scan::operator!=(const Grid_scan& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Grid_scan& o)
{
j = nlohmann::json::object();
j["n_fast"] = o.m_N_fast;
j["step_x_um"] = o.m_Step_x_um;
j["step_y_um"] = o.m_Step_y_um;
if(o.verticalIsSet())
j["vertical"] = o.m_Vertical;
if(o.snakeIsSet())
j["snake"] = o.m_Snake;
}
void from_json(const nlohmann::json& j, Grid_scan& o)
{
j.at("n_fast").get_to(o.m_N_fast);
j.at("step_x_um").get_to(o.m_Step_x_um);
j.at("step_y_um").get_to(o.m_Step_y_um);
if(j.find("vertical") != j.end())
{
j.at("vertical").get_to(o.m_Vertical);
o.m_VerticalIsSet = true;
}
if(j.find("snake") != j.end())
{
j.at("snake").get_to(o.m_Snake);
o.m_SnakeIsSet = true;
}
}
int64_t Grid_scan::getNFast() const
{
return m_N_fast;
}
void Grid_scan::setNFast(int64_t const value)
{
m_N_fast = value;
}
float Grid_scan::getStepXUm() const
{
return m_Step_x_um;
}
void Grid_scan::setStepXUm(float const value)
{
m_Step_x_um = value;
}
float Grid_scan::getStepYUm() const
{
return m_Step_y_um;
}
void Grid_scan::setStepYUm(float const value)
{
m_Step_y_um = value;
}
bool Grid_scan::isVertical() const
{
return m_Vertical;
}
void Grid_scan::setVertical(bool const value)
{
m_Vertical = value;
m_VerticalIsSet = true;
}
bool Grid_scan::verticalIsSet() const
{
return m_VerticalIsSet;
}
void Grid_scan::unsetVertical()
{
m_VerticalIsSet = false;
}
bool Grid_scan::isSnake() const
{
return m_Snake;
}
void Grid_scan::setSnake(bool const value)
{
m_Snake = value;
m_SnakeIsSet = true;
}
bool Grid_scan::snakeIsSet() const
{
return m_SnakeIsSet;
}
void Grid_scan::unsetSnake()
{
m_SnakeIsSet = false;
}
} // namespace org::openapitools::server::model