Files
Jungfraujoch/broker/gen/model/Roi_circle.cpp
2025-10-01 11:18:10 +02:00

162 lines
4.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. # License Clarification While this API definition is licensed under GPL-3.0, **the GPL copyleft provisions do not apply** when this file is used solely to generate OpenAPI clients or when implementing applications that interact with the API. Generated client code and applications using this API definition are not subject to the GPL license requirements and may be distributed under terms of your choosing. This exception is similar in spirit to the Linux Kernel's approach to userspace API headers and the GCC Runtime Library Exception. The Linux Kernel developers have explicitly stated that user programs that merely use the kernel interfaces (syscalls, ioctl definitions, etc.) are not derivative works of the kernel and are not subject to the terms of the GPL. This exception is intended to allow wider use of this API specification without imposing GPL requirements on applications that merely interact with the API, regardless of whether they communicate through network calls or other mechanisms.
*
* The version of the OpenAPI document: 1.0.0-rc.88
* 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 "Roi_circle.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Roi_circle::Roi_circle()
{
m_Name = "";
m_Center_x_pxl = 0.0f;
m_Center_y_pxl = 0.0f;
m_Radius_pxl = 0.0f;
}
void Roi_circle::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Roi_circle::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Roi_circle::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Roi_circle" : pathPrefix;
/* Name */ {
const std::string& value = m_Name;
const std::string currentValuePath = _pathPrefix + ".name";
if (value.length() < 1)
{
success = false;
msg << currentValuePath << ": must be at least 1 characters long;";
}
}
/* Radius_pxl */ {
const float& value = m_Radius_pxl;
const std::string currentValuePath = _pathPrefix + ".radiusPxl";
if (value <= static_cast<float>(0.0))
{
success = false;
msg << currentValuePath << ": must be greater than 0.0;";
}
}
return success;
}
bool Roi_circle::operator==(const Roi_circle& rhs) const
{
return
(getName() == rhs.getName())
&&
(getCenterXPxl() == rhs.getCenterXPxl())
&&
(getCenterYPxl() == rhs.getCenterYPxl())
&&
(getRadiusPxl() == rhs.getRadiusPxl())
;
}
bool Roi_circle::operator!=(const Roi_circle& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Roi_circle& o)
{
j = nlohmann::json::object();
j["name"] = o.m_Name;
j["center_x_pxl"] = o.m_Center_x_pxl;
j["center_y_pxl"] = o.m_Center_y_pxl;
j["radius_pxl"] = o.m_Radius_pxl;
}
void from_json(const nlohmann::json& j, Roi_circle& o)
{
j.at("name").get_to(o.m_Name);
j.at("center_x_pxl").get_to(o.m_Center_x_pxl);
j.at("center_y_pxl").get_to(o.m_Center_y_pxl);
j.at("radius_pxl").get_to(o.m_Radius_pxl);
}
std::string Roi_circle::getName() const
{
return m_Name;
}
void Roi_circle::setName(std::string const& value)
{
m_Name = value;
}
float Roi_circle::getCenterXPxl() const
{
return m_Center_x_pxl;
}
void Roi_circle::setCenterXPxl(float const value)
{
m_Center_x_pxl = value;
}
float Roi_circle::getCenterYPxl() const
{
return m_Center_y_pxl;
}
void Roi_circle::setCenterYPxl(float const value)
{
m_Center_y_pxl = value;
}
float Roi_circle::getRadiusPxl() const
{
return m_Radius_pxl;
}
void Roi_circle::setRadiusPxl(float const value)
{
m_Radius_pxl = value;
}
} // namespace org::openapitools::server::model