Files
Jungfraujoch/broker/gen/model/Broker_status.cpp
2024-12-02 21:17:14 +01:00

140 lines
3.1 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 "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;
}
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()))
;
}
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;
}
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;
}
}
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;
}
} // namespace org::openapitools::server::model