Files
Jungfraujoch/broker/gen/model/Zeromq_settings.cpp
2025-10-28 16:44:04 +01:00

233 lines
7.3 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.95
* 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 "Zeromq_settings.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Zeromq_settings::Zeromq_settings()
{
m_Send_watermark = 100L;
m_Send_watermarkIsSet = false;
m_Send_buffer_size = 0L;
m_Send_buffer_sizeIsSet = false;
m_Image_socketIsSet = false;
m_Writer_notification_socket = "";
m_Writer_notification_socketIsSet = false;
}
void Zeromq_settings::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Zeromq_settings::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Zeromq_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Zeromq_settings" : pathPrefix;
if (sendWatermarkIsSet())
{
const int64_t& value = m_Send_watermark;
const std::string currentValuePath = _pathPrefix + ".sendWatermark";
if (value < 2ll)
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 2;";
}
if (value > 16384ll)
{
success = false;
msg << currentValuePath << ": must be less than or equal to 16384;";
}
}
if (imageSocketIsSet())
{
const std::vector<std::string>& value = m_Image_socket;
const std::string currentValuePath = _pathPrefix + ".imageSocket";
{ // Recursive validation of array elements
const std::string oldValuePath = currentValuePath;
int i = 0;
for (const std::string& value : value)
{
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
i++;
}
}
}
return success;
}
bool Zeromq_settings::operator==(const Zeromq_settings& rhs) const
{
return
((!sendWatermarkIsSet() && !rhs.sendWatermarkIsSet()) || (sendWatermarkIsSet() && rhs.sendWatermarkIsSet() && getSendWatermark() == rhs.getSendWatermark())) &&
((!sendBufferSizeIsSet() && !rhs.sendBufferSizeIsSet()) || (sendBufferSizeIsSet() && rhs.sendBufferSizeIsSet() && getSendBufferSize() == rhs.getSendBufferSize())) &&
((!imageSocketIsSet() && !rhs.imageSocketIsSet()) || (imageSocketIsSet() && rhs.imageSocketIsSet() && getImageSocket() == rhs.getImageSocket())) &&
((!writerNotificationSocketIsSet() && !rhs.writerNotificationSocketIsSet()) || (writerNotificationSocketIsSet() && rhs.writerNotificationSocketIsSet() && getWriterNotificationSocket() == rhs.getWriterNotificationSocket()))
;
}
bool Zeromq_settings::operator!=(const Zeromq_settings& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Zeromq_settings& o)
{
j = nlohmann::json::object();
if(o.sendWatermarkIsSet())
j["send_watermark"] = o.m_Send_watermark;
if(o.sendBufferSizeIsSet())
j["send_buffer_size"] = o.m_Send_buffer_size;
if(o.imageSocketIsSet() || !o.m_Image_socket.empty())
j["image_socket"] = o.m_Image_socket;
if(o.writerNotificationSocketIsSet())
j["writer_notification_socket"] = o.m_Writer_notification_socket;
}
void from_json(const nlohmann::json& j, Zeromq_settings& o)
{
if(j.find("send_watermark") != j.end())
{
j.at("send_watermark").get_to(o.m_Send_watermark);
o.m_Send_watermarkIsSet = true;
}
if(j.find("send_buffer_size") != j.end())
{
j.at("send_buffer_size").get_to(o.m_Send_buffer_size);
o.m_Send_buffer_sizeIsSet = true;
}
if(j.find("image_socket") != j.end())
{
j.at("image_socket").get_to(o.m_Image_socket);
o.m_Image_socketIsSet = true;
}
if(j.find("writer_notification_socket") != j.end())
{
j.at("writer_notification_socket").get_to(o.m_Writer_notification_socket);
o.m_Writer_notification_socketIsSet = true;
}
}
int64_t Zeromq_settings::getSendWatermark() const
{
return m_Send_watermark;
}
void Zeromq_settings::setSendWatermark(int64_t const value)
{
m_Send_watermark = value;
m_Send_watermarkIsSet = true;
}
bool Zeromq_settings::sendWatermarkIsSet() const
{
return m_Send_watermarkIsSet;
}
void Zeromq_settings::unsetSend_watermark()
{
m_Send_watermarkIsSet = false;
}
int64_t Zeromq_settings::getSendBufferSize() const
{
return m_Send_buffer_size;
}
void Zeromq_settings::setSendBufferSize(int64_t const value)
{
m_Send_buffer_size = value;
m_Send_buffer_sizeIsSet = true;
}
bool Zeromq_settings::sendBufferSizeIsSet() const
{
return m_Send_buffer_sizeIsSet;
}
void Zeromq_settings::unsetSend_buffer_size()
{
m_Send_buffer_sizeIsSet = false;
}
std::vector<std::string> Zeromq_settings::getImageSocket() const
{
return m_Image_socket;
}
void Zeromq_settings::setImageSocket(std::vector<std::string> const& value)
{
m_Image_socket = value;
m_Image_socketIsSet = true;
}
bool Zeromq_settings::imageSocketIsSet() const
{
return m_Image_socketIsSet;
}
void Zeromq_settings::unsetImage_socket()
{
m_Image_socketIsSet = false;
}
std::string Zeromq_settings::getWriterNotificationSocket() const
{
return m_Writer_notification_socket;
}
void Zeromq_settings::setWriterNotificationSocket(std::string const& value)
{
m_Writer_notification_socket = value;
m_Writer_notification_socketIsSet = true;
}
bool Zeromq_settings::writerNotificationSocketIsSet() const
{
return m_Writer_notification_socketIsSet;
}
void Zeromq_settings::unsetWriter_notification_socket()
{
m_Writer_notification_socketIsSet = false;
}
} // namespace org::openapitools::server::model