Files
Jungfraujoch/broker/gen/model/Broker_status.cpp
2025-06-22 13:15:10 +02:00

256 lines
6.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.
*
* The version of the OpenAPI document: 1.0.0-rc.51
* 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 "Broker_status.h"
#include "Helpers.h"
#include <sstream>
namespace org::openapitools::server::model
{
Broker_status::Broker_status()
{
m_State = "";
m_Progress = 0.0f;
m_ProgressIsSet = false;
m_Message = "";
m_MessageIsSet = false;
m_Message_severity = "error";
m_Message_severityIsSet = false;
m_Gpu_count = 0;
m_Gpu_countIsSet = false;
m_Ml_resolution_estimation = false;
m_Ml_resolution_estimationIsSet = false;
}
void Broker_status::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool Broker_status::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool Broker_status::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "Broker_status" : pathPrefix;
if (progressIsSet())
{
const float& value = m_Progress;
const std::string currentValuePath = _pathPrefix + ".progress";
if (value < static_cast<float>(0.0))
{
success = false;
msg << currentValuePath << ": must be greater than or equal to 0.0;";
}
if (value > static_cast<float>(1.0))
{
success = false;
msg << currentValuePath << ": must be less than or equal to 1.0;";
}
}
return success;
}
bool Broker_status::operator==(const Broker_status& rhs) const
{
return
(getState() == rhs.getState())
&&
((!progressIsSet() && !rhs.progressIsSet()) || (progressIsSet() && rhs.progressIsSet() && getProgress() == rhs.getProgress())) &&
((!messageIsSet() && !rhs.messageIsSet()) || (messageIsSet() && rhs.messageIsSet() && getMessage() == rhs.getMessage())) &&
((!messageSeverityIsSet() && !rhs.messageSeverityIsSet()) || (messageSeverityIsSet() && rhs.messageSeverityIsSet() && getMessageSeverity() == rhs.getMessageSeverity())) &&
((!gpuCountIsSet() && !rhs.gpuCountIsSet()) || (gpuCountIsSet() && rhs.gpuCountIsSet() && getGpuCount() == rhs.getGpuCount())) &&
((!mlResolutionEstimationIsSet() && !rhs.mlResolutionEstimationIsSet()) || (mlResolutionEstimationIsSet() && rhs.mlResolutionEstimationIsSet() && isMlResolutionEstimation() == rhs.isMlResolutionEstimation()))
;
}
bool Broker_status::operator!=(const Broker_status& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const Broker_status& o)
{
j = nlohmann::json::object();
j["state"] = o.m_State;
if(o.progressIsSet())
j["progress"] = o.m_Progress;
if(o.messageIsSet())
j["message"] = o.m_Message;
if(o.messageSeverityIsSet())
j["message_severity"] = o.m_Message_severity;
if(o.gpuCountIsSet())
j["gpu_count"] = o.m_Gpu_count;
if(o.mlResolutionEstimationIsSet())
j["ml_resolution_estimation"] = o.m_Ml_resolution_estimation;
}
void from_json(const nlohmann::json& j, Broker_status& o)
{
j.at("state").get_to(o.m_State);
if(j.find("progress") != j.end())
{
j.at("progress").get_to(o.m_Progress);
o.m_ProgressIsSet = true;
}
if(j.find("message") != j.end())
{
j.at("message").get_to(o.m_Message);
o.m_MessageIsSet = true;
}
if(j.find("message_severity") != j.end())
{
j.at("message_severity").get_to(o.m_Message_severity);
o.m_Message_severityIsSet = true;
}
if(j.find("gpu_count") != j.end())
{
j.at("gpu_count").get_to(o.m_Gpu_count);
o.m_Gpu_countIsSet = true;
}
if(j.find("ml_resolution_estimation") != j.end())
{
j.at("ml_resolution_estimation").get_to(o.m_Ml_resolution_estimation);
o.m_Ml_resolution_estimationIsSet = true;
}
}
std::string Broker_status::getState() const
{
return m_State;
}
void Broker_status::setState(std::string const& value)
{
m_State = value;
}
float Broker_status::getProgress() const
{
return m_Progress;
}
void Broker_status::setProgress(float const value)
{
m_Progress = value;
m_ProgressIsSet = true;
}
bool Broker_status::progressIsSet() const
{
return m_ProgressIsSet;
}
void Broker_status::unsetProgress()
{
m_ProgressIsSet = false;
}
std::string Broker_status::getMessage() const
{
return m_Message;
}
void Broker_status::setMessage(std::string const& value)
{
m_Message = value;
m_MessageIsSet = true;
}
bool Broker_status::messageIsSet() const
{
return m_MessageIsSet;
}
void Broker_status::unsetMessage()
{
m_MessageIsSet = false;
}
std::string Broker_status::getMessageSeverity() const
{
return m_Message_severity;
}
void Broker_status::setMessageSeverity(std::string const& value)
{
m_Message_severity = value;
m_Message_severityIsSet = true;
}
bool Broker_status::messageSeverityIsSet() const
{
return m_Message_severityIsSet;
}
void Broker_status::unsetMessage_severity()
{
m_Message_severityIsSet = false;
}
int32_t Broker_status::getGpuCount() const
{
return m_Gpu_count;
}
void Broker_status::setGpuCount(int32_t const value)
{
m_Gpu_count = value;
m_Gpu_countIsSet = true;
}
bool Broker_status::gpuCountIsSet() const
{
return m_Gpu_countIsSet;
}
void Broker_status::unsetGpu_count()
{
m_Gpu_countIsSet = false;
}
bool Broker_status::isMlResolutionEstimation() const
{
return m_Ml_resolution_estimation;
}
void Broker_status::setMlResolutionEstimation(bool const value)
{
m_Ml_resolution_estimation = value;
m_Ml_resolution_estimationIsSet = true;
}
bool Broker_status::mlResolutionEstimationIsSet() const
{
return m_Ml_resolution_estimationIsSet;
}
void Broker_status::unsetMl_resolution_estimation()
{
m_Ml_resolution_estimationIsSet = false;
}
} // namespace org::openapitools::server::model