140 lines
2.9 KiB
C++
140 lines
2.9 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.40
|
|
* 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 "Grid_plot.h"
|
|
#include "Helpers.h"
|
|
|
|
#include <sstream>
|
|
|
|
namespace org::openapitools::server::model
|
|
{
|
|
|
|
Grid_plot::Grid_plot()
|
|
{
|
|
m_Width = 0L;
|
|
|
|
}
|
|
|
|
void Grid_plot::validate() const
|
|
{
|
|
std::stringstream msg;
|
|
if (!validate(msg))
|
|
{
|
|
throw org::openapitools::server::helpers::ValidationException(msg.str());
|
|
}
|
|
}
|
|
|
|
bool Grid_plot::validate(std::stringstream& msg) const
|
|
{
|
|
return validate(msg, "");
|
|
}
|
|
|
|
bool Grid_plot::validate(std::stringstream& msg, const std::string& pathPrefix) const
|
|
{
|
|
bool success = true;
|
|
const std::string _pathPrefix = pathPrefix.empty() ? "Grid_plot" : pathPrefix;
|
|
|
|
|
|
|
|
/* Data */ {
|
|
const std::vector<float>& value = m_Data;
|
|
const std::string currentValuePath = _pathPrefix + ".data";
|
|
|
|
|
|
{ // Recursive validation of array elements
|
|
const std::string oldValuePath = currentValuePath;
|
|
int i = 0;
|
|
for (const float& value : value)
|
|
{
|
|
const std::string currentValuePath = oldValuePath + "[" + std::to_string(i) + "]";
|
|
|
|
|
|
|
|
i++;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/* Width */ {
|
|
const int64_t& value = m_Width;
|
|
const std::string currentValuePath = _pathPrefix + ".width";
|
|
|
|
|
|
if (value < 1ll)
|
|
{
|
|
success = false;
|
|
msg << currentValuePath << ": must be greater than or equal to 1;";
|
|
}
|
|
|
|
}
|
|
|
|
return success;
|
|
}
|
|
|
|
bool Grid_plot::operator==(const Grid_plot& rhs) const
|
|
{
|
|
return
|
|
|
|
|
|
(getData() == rhs.getData())
|
|
&&
|
|
|
|
(getWidth() == rhs.getWidth())
|
|
|
|
|
|
;
|
|
}
|
|
|
|
bool Grid_plot::operator!=(const Grid_plot& rhs) const
|
|
{
|
|
return !(*this == rhs);
|
|
}
|
|
|
|
void to_json(nlohmann::json& j, const Grid_plot& o)
|
|
{
|
|
j = nlohmann::json::object();
|
|
j["data"] = o.m_Data;
|
|
j["width"] = o.m_Width;
|
|
|
|
}
|
|
|
|
void from_json(const nlohmann::json& j, Grid_plot& o)
|
|
{
|
|
j.at("data").get_to(o.m_Data);
|
|
j.at("width").get_to(o.m_Width);
|
|
|
|
}
|
|
|
|
std::vector<float> Grid_plot::getData() const
|
|
{
|
|
return m_Data;
|
|
}
|
|
void Grid_plot::setData(std::vector<float> const value)
|
|
{
|
|
m_Data = value;
|
|
}
|
|
int64_t Grid_plot::getWidth() const
|
|
{
|
|
return m_Width;
|
|
}
|
|
void Grid_plot::setWidth(int64_t const value)
|
|
{
|
|
m_Width = value;
|
|
}
|
|
|
|
|
|
} // namespace org::openapitools::server::model
|
|
|