233 lines
6.3 KiB
C++
233 lines
6.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.
|
|
*
|
|
* 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 "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
|
|
|