Files
Jungfraujoch/broker/gen/model/File_writer_format.cpp
2025-07-05 18:52:42 +02:00

135 lines
3.5 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.60
* 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 "File_writer_format.h"
#include "Helpers.h"
#include <stdexcept>
#include <sstream>
namespace org::openapitools::server::model
{
File_writer_format::File_writer_format()
{
}
void File_writer_format::validate() const
{
std::stringstream msg;
if (!validate(msg))
{
throw org::openapitools::server::helpers::ValidationException(msg.str());
}
}
bool File_writer_format::validate(std::stringstream& msg) const
{
return validate(msg, "");
}
bool File_writer_format::validate(std::stringstream& msg, const std::string& pathPrefix) const
{
bool success = true;
const std::string _pathPrefix = pathPrefix.empty() ? "File_writer_format" : pathPrefix;
if (m_value == File_writer_format::eFile_writer_format::INVALID_VALUE_OPENAPI_GENERATED)
{
success = false;
msg << _pathPrefix << ": has no value;";
}
return success;
}
bool File_writer_format::operator==(const File_writer_format& rhs) const
{
return
getValue() == rhs.getValue()
;
}
bool File_writer_format::operator!=(const File_writer_format& rhs) const
{
return !(*this == rhs);
}
void to_json(nlohmann::json& j, const File_writer_format& o)
{
j = nlohmann::json::object();
switch (o.getValue())
{
case File_writer_format::eFile_writer_format::INVALID_VALUE_OPENAPI_GENERATED:
j = "INVALID_VALUE_OPENAPI_GENERATED";
break;
case File_writer_format::eFile_writer_format::NONE:
j = "None";
break;
case File_writer_format::eFile_writer_format::NXMXLEGACY:
j = "NXmxLegacy";
break;
case File_writer_format::eFile_writer_format::NXMXVDS:
j = "NXmxVDS";
break;
case File_writer_format::eFile_writer_format::CBF:
j = "CBF";
break;
case File_writer_format::eFile_writer_format::TIFF:
j = "TIFF";
break;
}
}
void from_json(const nlohmann::json& j, File_writer_format& o)
{
auto s = j.get<std::string>();
if (s == "None") {
o.setValue(File_writer_format::eFile_writer_format::NONE);
}
else if (s == "NXmxLegacy") {
o.setValue(File_writer_format::eFile_writer_format::NXMXLEGACY);
}
else if (s == "NXmxVDS") {
o.setValue(File_writer_format::eFile_writer_format::NXMXVDS);
}
else if (s == "CBF") {
o.setValue(File_writer_format::eFile_writer_format::CBF);
}
else if (s == "TIFF") {
o.setValue(File_writer_format::eFile_writer_format::TIFF);
} else {
std::stringstream ss;
ss << "Unexpected value " << s << " in json"
<< " cannot be converted to enum of type"
<< " File_writer_format::eFile_writer_format";
throw std::invalid_argument(ss.str());
}
}
File_writer_format::eFile_writer_format File_writer_format::getValue() const
{
return m_value;
}
void File_writer_format::setValue(File_writer_format::eFile_writer_format value)
{
m_value = value;
}
} // namespace org::openapitools::server::model