Files
Jungfraujoch/broker/gen/model/Roi_box.cpp
2024-12-02 21:17:14 +01:00

218 lines
4.5 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.27
* 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_box.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Roi_box::Roi_box()
{
m_Name = "";
m_Min_x_pxl = 0L;
m_Max_x_pxl = 0L;
m_Min_y_pxl = 0L;
m_Max_y_pxl = 0L;
}
void Roi_box::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Roi_box::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Roi_box::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Roi_box" : 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;";
}
}
/* Min_x_pxl */ {
const int64_t& value = m_Min_x_pxl;
const std::string currentValuePath = _pathPrefix + ".minXPxl";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
/* Max_x_pxl */ {
const int64_t& value = m_Max_x_pxl;
const std::string currentValuePath = _pathPrefix + ".maxXPxl";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
/* Min_y_pxl */ {
const int64_t& value = m_Min_y_pxl;
const std::string currentValuePath = _pathPrefix + ".minYPxl";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
/* Max_y_pxl */ {
const int64_t& value = m_Max_y_pxl;
const std::string currentValuePath = _pathPrefix + ".maxYPxl";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
return success;
}
bool Roi_box::operator==(const Roi_box& rhs) const
{
return
(getName() == rhs.getName())
&&
(getMinXPxl() == rhs.getMinXPxl())
&&
(getMaxXPxl() == rhs.getMaxXPxl())
&&
(getMinYPxl() == rhs.getMinYPxl())
&&
(getMaxYPxl() == rhs.getMaxYPxl())
;
}
bool Roi_box::operator!=(const Roi_box& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Roi_box& o)
{
j = nlohmann::json::object();
j["name"] = o.m_Name;
j["min_x_pxl"] = o.m_Min_x_pxl;
j["max_x_pxl"] = o.m_Max_x_pxl;
j["min_y_pxl"] = o.m_Min_y_pxl;
j["max_y_pxl"] = o.m_Max_y_pxl;
}
void from_json(const nlohmann::json& j, Roi_box& o)
{
j.at("name").get_to(o.m_Name);
j.at("min_x_pxl").get_to(o.m_Min_x_pxl);
j.at("max_x_pxl").get_to(o.m_Max_x_pxl);
j.at("min_y_pxl").get_to(o.m_Min_y_pxl);
j.at("max_y_pxl").get_to(o.m_Max_y_pxl);
}
std::string Roi_box::getName() const
{
return m_Name;
}
void Roi_box::setName(std::string const& value)
{
m_Name = value;
}
int64_t Roi_box::getMinXPxl() const
{
return m_Min_x_pxl;
}
void Roi_box::setMinXPxl(int64_t const value)
{
m_Min_x_pxl = value;
}
int64_t Roi_box::getMaxXPxl() const
{
return m_Max_x_pxl;
}
void Roi_box::setMaxXPxl(int64_t const value)
{
m_Max_x_pxl = value;
}
int64_t Roi_box::getMinYPxl() const
{
return m_Min_y_pxl;
}
void Roi_box::setMinYPxl(int64_t const value)
{
m_Min_y_pxl = value;
}
int64_t Roi_box::getMaxYPxl() const
{
return m_Max_y_pxl;
}
void Roi_box::setMaxYPxl(int64_t const value)
{
m_Max_y_pxl = value;
}
} // namespace org::openapitools::server::model