Files
Jungfraujoch/broker/gen/model/Detector_list_element.cpp
2025-09-08 20:28:59 +02:00

303 lines
8.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.72
* 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 "Detector_list_element.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Detector_list_element::Detector_list_element()
{
m_Id = 0L;
m_Description = "";
m_Serial_number = "";
m_Base_ipv4_addr = "";
m_Udp_interface_count = 0L;
m_Nmodules = 0L;
m_Width = 0L;
m_Height = 0L;
m_Pixel_size_mm = 0.0f;
m_Pixel_size_mmIsSet = false;
m_Readout_time_us = 0L;
m_Min_frame_time_us = 0L;
m_Min_count_time_us = 0L;
m_TypeIsSet = false;
}
void Detector_list_element::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Detector_list_element::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Detector_list_element::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Detector_list_element" : pathPrefix;
/* Id */ {
const int64_t& value = m_Id;
const std::string currentValuePath = _pathPrefix + ".id";
if (value < 0ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0;";
}
}
return success;
}
bool Detector_list_element::operator==(const Detector_list_element& rhs) const
{
return
(getId() == rhs.getId())
&&
(getDescription() == rhs.getDescription())
&&
(getSerialNumber() == rhs.getSerialNumber())
&&
(getBaseIpv4Addr() == rhs.getBaseIpv4Addr())
&&
(getUdpInterfaceCount() == rhs.getUdpInterfaceCount())
&&
(getNmodules() == rhs.getNmodules())
&&
(getWidth() == rhs.getWidth())
&&
(getHeight() == rhs.getHeight())
&&
((!pixelSizeMmIsSet() && !rhs.pixelSizeMmIsSet()) || (pixelSizeMmIsSet() && rhs.pixelSizeMmIsSet() && getPixelSizeMm() == rhs.getPixelSizeMm())) &&
(getReadoutTimeUs() == rhs.getReadoutTimeUs())
&&
(getMinFrameTimeUs() == rhs.getMinFrameTimeUs())
&&
(getMinCountTimeUs() == rhs.getMinCountTimeUs())
&&
((!typeIsSet() && !rhs.typeIsSet()) || (typeIsSet() && rhs.typeIsSet() && getType() == rhs.getType()))
;
}
bool Detector_list_element::operator!=(const Detector_list_element& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Detector_list_element& o)
{
j = nlohmann::json::object();
j["id"] = o.m_Id;
j["description"] = o.m_Description;
j["serial_number"] = o.m_Serial_number;
j["base_ipv4_addr"] = o.m_Base_ipv4_addr;
j["udp_interface_count"] = o.m_Udp_interface_count;
j["nmodules"] = o.m_Nmodules;
j["width"] = o.m_Width;
j["height"] = o.m_Height;
if(o.pixelSizeMmIsSet())
j["pixel_size_mm"] = o.m_Pixel_size_mm;
j["readout_time_us"] = o.m_Readout_time_us;
j["min_frame_time_us"] = o.m_Min_frame_time_us;
j["min_count_time_us"] = o.m_Min_count_time_us;
if(o.typeIsSet())
j["type"] = o.m_Type;
}
void from_json(const nlohmann::json& j, Detector_list_element& o)
{
j.at("id").get_to(o.m_Id);
j.at("description").get_to(o.m_Description);
j.at("serial_number").get_to(o.m_Serial_number);
j.at("base_ipv4_addr").get_to(o.m_Base_ipv4_addr);
j.at("udp_interface_count").get_to(o.m_Udp_interface_count);
j.at("nmodules").get_to(o.m_Nmodules);
j.at("width").get_to(o.m_Width);
j.at("height").get_to(o.m_Height);
if(j.find("pixel_size_mm") != j.end())
{
j.at("pixel_size_mm").get_to(o.m_Pixel_size_mm);
o.m_Pixel_size_mmIsSet = true;
}
j.at("readout_time_us").get_to(o.m_Readout_time_us);
j.at("min_frame_time_us").get_to(o.m_Min_frame_time_us);
j.at("min_count_time_us").get_to(o.m_Min_count_time_us);
if(j.find("type") != j.end())
{
j.at("type").get_to(o.m_Type);
o.m_TypeIsSet = true;
}
}
int64_t Detector_list_element::getId() const
{
return m_Id;
}
void Detector_list_element::setId(int64_t const value)
{
m_Id = value;
}
std::string Detector_list_element::getDescription() const
{
return m_Description;
}
void Detector_list_element::setDescription(std::string const& value)
{
m_Description = value;
}
std::string Detector_list_element::getSerialNumber() const
{
return m_Serial_number;
}
void Detector_list_element::setSerialNumber(std::string const& value)
{
m_Serial_number = value;
}
std::string Detector_list_element::getBaseIpv4Addr() const
{
return m_Base_ipv4_addr;
}
void Detector_list_element::setBaseIpv4Addr(std::string const& value)
{
m_Base_ipv4_addr = value;
}
int64_t Detector_list_element::getUdpInterfaceCount() const
{
return m_Udp_interface_count;
}
void Detector_list_element::setUdpInterfaceCount(int64_t const value)
{
m_Udp_interface_count = value;
}
int64_t Detector_list_element::getNmodules() const
{
return m_Nmodules;
}
void Detector_list_element::setNmodules(int64_t const value)
{
m_Nmodules = value;
}
int64_t Detector_list_element::getWidth() const
{
return m_Width;
}
void Detector_list_element::setWidth(int64_t const value)
{
m_Width = value;
}
int64_t Detector_list_element::getHeight() const
{
return m_Height;
}
void Detector_list_element::setHeight(int64_t const value)
{
m_Height = value;
}
float Detector_list_element::getPixelSizeMm() const
{
return m_Pixel_size_mm;
}
void Detector_list_element::setPixelSizeMm(float const value)
{
m_Pixel_size_mm = value;
m_Pixel_size_mmIsSet = true;
}
bool Detector_list_element::pixelSizeMmIsSet() const
{
return m_Pixel_size_mmIsSet;
}
void Detector_list_element::unsetPixel_size_mm()
{
m_Pixel_size_mmIsSet = false;
}
int64_t Detector_list_element::getReadoutTimeUs() const
{
return m_Readout_time_us;
}
void Detector_list_element::setReadoutTimeUs(int64_t const value)
{
m_Readout_time_us = value;
}
int64_t Detector_list_element::getMinFrameTimeUs() const
{
return m_Min_frame_time_us;
}
void Detector_list_element::setMinFrameTimeUs(int64_t const value)
{
m_Min_frame_time_us = value;
}
int64_t Detector_list_element::getMinCountTimeUs() const
{
return m_Min_count_time_us;
}
void Detector_list_element::setMinCountTimeUs(int64_t const value)
{
m_Min_count_time_us = value;
}
org::openapitools::server::model::Detector_type Detector_list_element::getType() const
{
return m_Type;
}
void Detector_list_element::setType(org::openapitools::server::model::Detector_type const& value)
{
m_Type = value;
m_TypeIsSet = true;
}
bool Detector_list_element::typeIsSet() const
{
return m_TypeIsSet;
}
void Detector_list_element::unsetType()
{
m_TypeIsSet = false;
}
} // namespace org::openapitools::server::model