188 lines
4.1 KiB
C++
188 lines
4.1 KiB
C++
/**
|
|
* Jungfraujoch
|
|
* Jungfraujoch Broker Web API
|
|
*
|
|
* The version of the OpenAPI document: 1.0.1
|
|
*
|
|
*
|
|
* 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_Indexing_rate = 0.0f;
|
|
m_Indexing_rateIsSet = 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;";
|
|
}
|
|
|
|
}
|
|
|
|
if (indexingRateIsSet())
|
|
{
|
|
const float& value = m_Indexing_rate;
|
|
const std::string currentValuePath = _pathPrefix + ".indexingRate";
|
|
|
|
|
|
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())) &&
|
|
|
|
|
|
((!indexingRateIsSet() && !rhs.indexingRateIsSet()) || (indexingRateIsSet() && rhs.indexingRateIsSet() && getIndexingRate() == rhs.getIndexingRate()))
|
|
|
|
;
|
|
}
|
|
|
|
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();
|
|
j["state"] = o.m_State;
|
|
if(o.progressIsSet())
|
|
j["progress"] = o.m_Progress;
|
|
if(o.indexingRateIsSet())
|
|
j["indexing_rate"] = o.m_Indexing_rate;
|
|
|
|
}
|
|
|
|
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("indexing_rate") != j.end())
|
|
{
|
|
j.at("indexing_rate").get_to(o.m_Indexing_rate);
|
|
o.m_Indexing_rateIsSet = 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;
|
|
}
|
|
float Broker_status::getIndexingRate() const
|
|
{
|
|
return m_Indexing_rate;
|
|
}
|
|
void Broker_status::setIndexingRate(float const value)
|
|
{
|
|
m_Indexing_rate = value;
|
|
m_Indexing_rateIsSet = true;
|
|
}
|
|
bool Broker_status::indexingRateIsSet() const
|
|
{
|
|
return m_Indexing_rateIsSet;
|
|
}
|
|
void Broker_status::unsetIndexing_rate()
|
|
{
|
|
m_Indexing_rateIsSet = false;
|
|
}
|
|
|
|
|
|
} // namespace org::openapitools::server::model
|
|
|