162 lines
3.4 KiB
C++
162 lines
3.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.26
|
|
* 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
|
|
|