Files
Jungfraujoch/broker/gen/model/Standard_detector_geometry.cpp
2024-11-26 16:04:38 +01:00

235 lines
5.6 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 "Standard_detector_geometry.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Standard_detector_geometry::Standard_detector_geometry()
{
m_Nmodules = 0;
m_Gap_x = 8;
m_Gap_xIsSet = false;
m_Gap_y = 36;
m_Gap_yIsSet = false;
m_Modules_in_row = 1;
m_Modules_in_rowIsSet = false;
}
void Standard_detector_geometry::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Standard_detector_geometry::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Standard_detector_geometry::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Standard_detector_geometry" : pathPrefix;
/* Nmodules */ {
const int32_t& value = m_Nmodules;
const std::string currentValuePath = _pathPrefix + ".nmodules";
if (value < 1)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
}
if (gapXIsSet())
{
const int32_t& value = m_Gap_x;
const std::string currentValuePath = _pathPrefix + ".gapX";
if (value < 0)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (gapYIsSet())
{
const int32_t& value = m_Gap_y;
const std::string currentValuePath = _pathPrefix + ".gapY";
if (value < 0)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
if (modulesInRowIsSet())
{
const int32_t& value = m_Modules_in_row;
const std::string currentValuePath = _pathPrefix + ".modulesInRow";
if (value < 1)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 1;";
}
}
return success;
}
bool Standard_detector_geometry::operator==(const Standard_detector_geometry& rhs) const
{
return
(getNmodules() == rhs.getNmodules())
&&
((!gapXIsSet() && !rhs.gapXIsSet()) || (gapXIsSet() && rhs.gapXIsSet() && getGapX() == rhs.getGapX())) &&
((!gapYIsSet() && !rhs.gapYIsSet()) || (gapYIsSet() && rhs.gapYIsSet() && getGapY() == rhs.getGapY())) &&
((!modulesInRowIsSet() && !rhs.modulesInRowIsSet()) || (modulesInRowIsSet() && rhs.modulesInRowIsSet() && getModulesInRow() == rhs.getModulesInRow()))
;
}
bool Standard_detector_geometry::operator!=(const Standard_detector_geometry& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Standard_detector_geometry& o)
{
j = nlohmann::json::object();
j["nmodules"] = o.m_Nmodules;
if(o.gapXIsSet())
j["gap_x"] = o.m_Gap_x;
if(o.gapYIsSet())
j["gap_y"] = o.m_Gap_y;
if(o.modulesInRowIsSet())
j["modules_in_row"] = o.m_Modules_in_row;
}
void from_json(const nlohmann::json& j, Standard_detector_geometry& o)
{
j.at("nmodules").get_to(o.m_Nmodules);
if(j.find("gap_x") != j.end())
{
j.at("gap_x").get_to(o.m_Gap_x);
o.m_Gap_xIsSet = true;
}
if(j.find("gap_y") != j.end())
{
j.at("gap_y").get_to(o.m_Gap_y);
o.m_Gap_yIsSet = true;
}
if(j.find("modules_in_row") != j.end())
{
j.at("modules_in_row").get_to(o.m_Modules_in_row);
o.m_Modules_in_rowIsSet = true;
}
}
int32_t Standard_detector_geometry::getNmodules() const
{
return m_Nmodules;
}
void Standard_detector_geometry::setNmodules(int32_t const value)
{
m_Nmodules = value;
}
int32_t Standard_detector_geometry::getGapX() const
{
return m_Gap_x;
}
void Standard_detector_geometry::setGapX(int32_t const value)
{
m_Gap_x = value;
m_Gap_xIsSet = true;
}
bool Standard_detector_geometry::gapXIsSet() const
{
return m_Gap_xIsSet;
}
void Standard_detector_geometry::unsetGap_x()
{
m_Gap_xIsSet = false;
}
int32_t Standard_detector_geometry::getGapY() const
{
return m_Gap_y;
}
void Standard_detector_geometry::setGapY(int32_t const value)
{
m_Gap_y = value;
m_Gap_yIsSet = true;
}
bool Standard_detector_geometry::gapYIsSet() const
{
return m_Gap_yIsSet;
}
void Standard_detector_geometry::unsetGap_y()
{
m_Gap_yIsSet = false;
}
int32_t Standard_detector_geometry::getModulesInRow() const
{
return m_Modules_in_row;
}
void Standard_detector_geometry::setModulesInRow(int32_t const value)
{
m_Modules_in_row = value;
m_Modules_in_rowIsSet = true;
}
bool Standard_detector_geometry::modulesInRowIsSet() const
{
return m_Modules_in_rowIsSet;
}
void Standard_detector_geometry::unsetModules_in_row()
{
m_Modules_in_rowIsSet = false;
}
} // namespace org::openapitools::server::model