/** * 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 "Dataset_settings.h" #include "Helpers.h" #include namespace org::openapitools::server::model { Dataset_settings::Dataset_settings() { m_Images_per_trigger = 1L; m_Images_per_triggerIsSet = false; m_Ntrigger = 1L; m_NtriggerIsSet = false; m_Summation = 1L; m_SummationIsSet = false; m_Beam_x_pxl = 0.0f; m_Beam_y_pxl = 0.0f; m_Detector_distance_mm = 0.0f; m_Photon_energy_keV = 0.0f; m_File_prefix = ""; m_File_prefixIsSet = false; m_Images_per_file = 1000L; m_Images_per_fileIsSet = false; m_Space_group_number = 0L; m_Space_group_numberIsSet = false; m_Sample_name = ""; m_Fpga_output = "auto"; m_Fpga_outputIsSet = false; m_Compression = "bslz4"; m_CompressionIsSet = false; m_Total_flux = 0.0f; m_Total_fluxIsSet = false; m_Transmission = 0.0f; m_TransmissionIsSet = false; m_OmegaIsSet = false; m_Header_appendix = ""; m_Header_appendixIsSet = false; m_Image_appendix = ""; m_Image_appendixIsSet = false; m_Photon_energy_multiplier = 1.0f; m_Photon_energy_multiplierIsSet = false; m_Data_reduction_factor_serialmx = 1.0f; m_Data_reduction_factor_serialmxIsSet = false; m_Unit_cellIsSet = false; } void Dataset_settings::validate() const { std::stringstream msg; if (!validate(msg)) { throw org::openapitools::server::helpers::ValidationException(msg.str()); } } bool Dataset_settings::validate(std::stringstream& msg) const { return validate(msg, ""); } bool Dataset_settings::validate(std::stringstream& msg, const std::string& pathPrefix) const { bool success = true; const std::string _pathPrefix = pathPrefix.empty() ? "Dataset_settings" : pathPrefix; if (imagesPerTriggerIsSet()) { const int64_t& value = m_Images_per_trigger; const std::string currentValuePath = _pathPrefix + ".imagesPerTrigger"; if (value < 1ll) { success = false; msg << currentValuePath << ": must be greater than or equal to 1;"; } } if (ntriggerIsSet()) { const int64_t& value = m_Ntrigger; const std::string currentValuePath = _pathPrefix + ".ntrigger"; if (value < 1ll) { success = false; msg << currentValuePath << ": must be greater than or equal to 1;"; } } if (summationIsSet()) { const int64_t& value = m_Summation; const std::string currentValuePath = _pathPrefix + ".summation"; if (value < 1ll) { success = false; msg << currentValuePath << ": must be greater than or equal to 1;"; } if (value > 256ll) { success = false; msg << currentValuePath << ": must be less than or equal to 256;"; } } /* Detector_distance_mm */ { const float& value = m_Detector_distance_mm; const std::string currentValuePath = _pathPrefix + ".detectorDistanceMm"; if (value < static_cast(0)) { success = false; msg << currentValuePath << ": must be greater than or equal to 0;"; } } /* Photon_energy_keV */ { const float& value = m_Photon_energy_keV; const std::string currentValuePath = _pathPrefix + ".photonEnergyKeV"; if (value < static_cast(0)) { success = false; msg << currentValuePath << ": must be greater than or equal to 0;"; } } if (imagesPerFileIsSet()) { const int64_t& value = m_Images_per_file; const std::string currentValuePath = _pathPrefix + ".imagesPerFile"; if (value < 0ll) { success = false; msg << currentValuePath << ": must be greater than or equal to 0;"; } } if (spaceGroupNumberIsSet()) { const int64_t& value = m_Space_group_number; const std::string currentValuePath = _pathPrefix + ".spaceGroupNumber"; if (value < 0ll) { success = false; msg << currentValuePath << ": must be greater than or equal to 0;"; } if (value > 194ll) { success = false; msg << currentValuePath << ": must be less than or equal to 194;"; } } if (transmissionIsSet()) { const float& value = m_Transmission; const std::string currentValuePath = _pathPrefix + ".transmission"; if (value < static_cast(0.0)) { success = false; msg << currentValuePath << ": must be greater than or equal to 0.0;"; } if (value > static_cast(1.0)) { success = false; msg << currentValuePath << ": must be less than or equal to 1.0;"; } } if (photonEnergyMultiplierIsSet()) { const float& value = m_Photon_energy_multiplier; const std::string currentValuePath = _pathPrefix + ".photonEnergyMultiplier"; if (value < static_cast(0.015625)) { success = false; msg << currentValuePath << ": must be greater than or equal to 0.015625;"; } if (value > static_cast(4.0)) { success = false; msg << currentValuePath << ": must be less than or equal to 4.0;"; } } if (dataReductionFactorSerialmxIsSet()) { const float& value = m_Data_reduction_factor_serialmx; const std::string currentValuePath = _pathPrefix + ".dataReductionFactorSerialmx"; if (value < static_cast(0.0)) { success = false; msg << currentValuePath << ": must be greater than or equal to 0.0;"; } if (value > static_cast(1.0)) { success = false; msg << currentValuePath << ": must be less than or equal to 1.0;"; } } return success; } bool Dataset_settings::operator==(const Dataset_settings& rhs) const { return ((!imagesPerTriggerIsSet() && !rhs.imagesPerTriggerIsSet()) || (imagesPerTriggerIsSet() && rhs.imagesPerTriggerIsSet() && getImagesPerTrigger() == rhs.getImagesPerTrigger())) && ((!ntriggerIsSet() && !rhs.ntriggerIsSet()) || (ntriggerIsSet() && rhs.ntriggerIsSet() && getNtrigger() == rhs.getNtrigger())) && ((!summationIsSet() && !rhs.summationIsSet()) || (summationIsSet() && rhs.summationIsSet() && getSummation() == rhs.getSummation())) && (getBeamXPxl() == rhs.getBeamXPxl()) && (getBeamYPxl() == rhs.getBeamYPxl()) && (getDetectorDistanceMm() == rhs.getDetectorDistanceMm()) && (getPhotonEnergyKeV() == rhs.getPhotonEnergyKeV()) && ((!filePrefixIsSet() && !rhs.filePrefixIsSet()) || (filePrefixIsSet() && rhs.filePrefixIsSet() && getFilePrefix() == rhs.getFilePrefix())) && ((!imagesPerFileIsSet() && !rhs.imagesPerFileIsSet()) || (imagesPerFileIsSet() && rhs.imagesPerFileIsSet() && getImagesPerFile() == rhs.getImagesPerFile())) && ((!spaceGroupNumberIsSet() && !rhs.spaceGroupNumberIsSet()) || (spaceGroupNumberIsSet() && rhs.spaceGroupNumberIsSet() && getSpaceGroupNumber() == rhs.getSpaceGroupNumber())) && (getSampleName() == rhs.getSampleName()) && ((!fpgaOutputIsSet() && !rhs.fpgaOutputIsSet()) || (fpgaOutputIsSet() && rhs.fpgaOutputIsSet() && getFpgaOutput() == rhs.getFpgaOutput())) && ((!compressionIsSet() && !rhs.compressionIsSet()) || (compressionIsSet() && rhs.compressionIsSet() && getCompression() == rhs.getCompression())) && ((!totalFluxIsSet() && !rhs.totalFluxIsSet()) || (totalFluxIsSet() && rhs.totalFluxIsSet() && getTotalFlux() == rhs.getTotalFlux())) && ((!transmissionIsSet() && !rhs.transmissionIsSet()) || (transmissionIsSet() && rhs.transmissionIsSet() && getTransmission() == rhs.getTransmission())) && ((!omegaIsSet() && !rhs.omegaIsSet()) || (omegaIsSet() && rhs.omegaIsSet() && getOmega() == rhs.getOmega())) && ((!headerAppendixIsSet() && !rhs.headerAppendixIsSet()) || (headerAppendixIsSet() && rhs.headerAppendixIsSet() && getHeaderAppendix() == rhs.getHeaderAppendix())) && ((!imageAppendixIsSet() && !rhs.imageAppendixIsSet()) || (imageAppendixIsSet() && rhs.imageAppendixIsSet() && getImageAppendix() == rhs.getImageAppendix())) && ((!photonEnergyMultiplierIsSet() && !rhs.photonEnergyMultiplierIsSet()) || (photonEnergyMultiplierIsSet() && rhs.photonEnergyMultiplierIsSet() && getPhotonEnergyMultiplier() == rhs.getPhotonEnergyMultiplier())) && ((!dataReductionFactorSerialmxIsSet() && !rhs.dataReductionFactorSerialmxIsSet()) || (dataReductionFactorSerialmxIsSet() && rhs.dataReductionFactorSerialmxIsSet() && getDataReductionFactorSerialmx() == rhs.getDataReductionFactorSerialmx())) && ((!unitCellIsSet() && !rhs.unitCellIsSet()) || (unitCellIsSet() && rhs.unitCellIsSet() && getUnitCell() == rhs.getUnitCell())) ; } bool Dataset_settings::operator!=(const Dataset_settings& rhs) const { return !(*this == rhs); } void to_json(nlohmann::json& j, const Dataset_settings& o) { j = nlohmann::json(); if(o.imagesPerTriggerIsSet()) j["images_per_trigger"] = o.m_Images_per_trigger; if(o.ntriggerIsSet()) j["ntrigger"] = o.m_Ntrigger; if(o.summationIsSet()) j["summation"] = o.m_Summation; j["beam_x_pxl"] = o.m_Beam_x_pxl; j["beam_y_pxl"] = o.m_Beam_y_pxl; j["detector_distance_mm"] = o.m_Detector_distance_mm; j["photon_energy_keV"] = o.m_Photon_energy_keV; if(o.filePrefixIsSet()) j["file_prefix"] = o.m_File_prefix; if(o.imagesPerFileIsSet()) j["images_per_file"] = o.m_Images_per_file; if(o.spaceGroupNumberIsSet()) j["space_group_number"] = o.m_Space_group_number; j["sample_name"] = o.m_Sample_name; if(o.fpgaOutputIsSet()) j["fpga_output"] = o.m_Fpga_output; if(o.compressionIsSet()) j["compression"] = o.m_Compression; if(o.totalFluxIsSet()) j["total_flux"] = o.m_Total_flux; if(o.transmissionIsSet()) j["transmission"] = o.m_Transmission; if(o.omegaIsSet()) j["omega"] = o.m_Omega; if(o.headerAppendixIsSet()) j["header_appendix"] = o.m_Header_appendix; if(o.imageAppendixIsSet()) j["image_appendix"] = o.m_Image_appendix; if(o.photonEnergyMultiplierIsSet()) j["photon_energy_multiplier"] = o.m_Photon_energy_multiplier; if(o.dataReductionFactorSerialmxIsSet()) j["data_reduction_factor_serialmx"] = o.m_Data_reduction_factor_serialmx; if(o.unitCellIsSet()) j["unit_cell"] = o.m_Unit_cell; } void from_json(const nlohmann::json& j, Dataset_settings& o) { if(j.find("images_per_trigger") != j.end()) { j.at("images_per_trigger").get_to(o.m_Images_per_trigger); o.m_Images_per_triggerIsSet = true; } if(j.find("ntrigger") != j.end()) { j.at("ntrigger").get_to(o.m_Ntrigger); o.m_NtriggerIsSet = true; } if(j.find("summation") != j.end()) { j.at("summation").get_to(o.m_Summation); o.m_SummationIsSet = true; } j.at("beam_x_pxl").get_to(o.m_Beam_x_pxl); j.at("beam_y_pxl").get_to(o.m_Beam_y_pxl); j.at("detector_distance_mm").get_to(o.m_Detector_distance_mm); j.at("photon_energy_keV").get_to(o.m_Photon_energy_keV); if(j.find("file_prefix") != j.end()) { j.at("file_prefix").get_to(o.m_File_prefix); o.m_File_prefixIsSet = true; } if(j.find("images_per_file") != j.end()) { j.at("images_per_file").get_to(o.m_Images_per_file); o.m_Images_per_fileIsSet = true; } if(j.find("space_group_number") != j.end()) { j.at("space_group_number").get_to(o.m_Space_group_number); o.m_Space_group_numberIsSet = true; } j.at("sample_name").get_to(o.m_Sample_name); if(j.find("fpga_output") != j.end()) { j.at("fpga_output").get_to(o.m_Fpga_output); o.m_Fpga_outputIsSet = true; } if(j.find("compression") != j.end()) { j.at("compression").get_to(o.m_Compression); o.m_CompressionIsSet = true; } if(j.find("total_flux") != j.end()) { j.at("total_flux").get_to(o.m_Total_flux); o.m_Total_fluxIsSet = true; } if(j.find("transmission") != j.end()) { j.at("transmission").get_to(o.m_Transmission); o.m_TransmissionIsSet = true; } if(j.find("omega") != j.end()) { j.at("omega").get_to(o.m_Omega); o.m_OmegaIsSet = true; } if(j.find("header_appendix") != j.end()) { j.at("header_appendix").get_to(o.m_Header_appendix); o.m_Header_appendixIsSet = true; } if(j.find("image_appendix") != j.end()) { j.at("image_appendix").get_to(o.m_Image_appendix); o.m_Image_appendixIsSet = true; } if(j.find("photon_energy_multiplier") != j.end()) { j.at("photon_energy_multiplier").get_to(o.m_Photon_energy_multiplier); o.m_Photon_energy_multiplierIsSet = true; } if(j.find("data_reduction_factor_serialmx") != j.end()) { j.at("data_reduction_factor_serialmx").get_to(o.m_Data_reduction_factor_serialmx); o.m_Data_reduction_factor_serialmxIsSet = true; } if(j.find("unit_cell") != j.end()) { j.at("unit_cell").get_to(o.m_Unit_cell); o.m_Unit_cellIsSet = true; } } int64_t Dataset_settings::getImagesPerTrigger() const { return m_Images_per_trigger; } void Dataset_settings::setImagesPerTrigger(int64_t const value) { m_Images_per_trigger = value; m_Images_per_triggerIsSet = true; } bool Dataset_settings::imagesPerTriggerIsSet() const { return m_Images_per_triggerIsSet; } void Dataset_settings::unsetImages_per_trigger() { m_Images_per_triggerIsSet = false; } int64_t Dataset_settings::getNtrigger() const { return m_Ntrigger; } void Dataset_settings::setNtrigger(int64_t const value) { m_Ntrigger = value; m_NtriggerIsSet = true; } bool Dataset_settings::ntriggerIsSet() const { return m_NtriggerIsSet; } void Dataset_settings::unsetNtrigger() { m_NtriggerIsSet = false; } int64_t Dataset_settings::getSummation() const { return m_Summation; } void Dataset_settings::setSummation(int64_t const value) { m_Summation = value; m_SummationIsSet = true; } bool Dataset_settings::summationIsSet() const { return m_SummationIsSet; } void Dataset_settings::unsetSummation() { m_SummationIsSet = false; } float Dataset_settings::getBeamXPxl() const { return m_Beam_x_pxl; } void Dataset_settings::setBeamXPxl(float const value) { m_Beam_x_pxl = value; } float Dataset_settings::getBeamYPxl() const { return m_Beam_y_pxl; } void Dataset_settings::setBeamYPxl(float const value) { m_Beam_y_pxl = value; } float Dataset_settings::getDetectorDistanceMm() const { return m_Detector_distance_mm; } void Dataset_settings::setDetectorDistanceMm(float const value) { m_Detector_distance_mm = value; } float Dataset_settings::getPhotonEnergyKeV() const { return m_Photon_energy_keV; } void Dataset_settings::setPhotonEnergyKeV(float const value) { m_Photon_energy_keV = value; } std::string Dataset_settings::getFilePrefix() const { return m_File_prefix; } void Dataset_settings::setFilePrefix(std::string const& value) { m_File_prefix = value; m_File_prefixIsSet = true; } bool Dataset_settings::filePrefixIsSet() const { return m_File_prefixIsSet; } void Dataset_settings::unsetFile_prefix() { m_File_prefixIsSet = false; } int64_t Dataset_settings::getImagesPerFile() const { return m_Images_per_file; } void Dataset_settings::setImagesPerFile(int64_t const value) { m_Images_per_file = value; m_Images_per_fileIsSet = true; } bool Dataset_settings::imagesPerFileIsSet() const { return m_Images_per_fileIsSet; } void Dataset_settings::unsetImages_per_file() { m_Images_per_fileIsSet = false; } int64_t Dataset_settings::getSpaceGroupNumber() const { return m_Space_group_number; } void Dataset_settings::setSpaceGroupNumber(int64_t const value) { m_Space_group_number = value; m_Space_group_numberIsSet = true; } bool Dataset_settings::spaceGroupNumberIsSet() const { return m_Space_group_numberIsSet; } void Dataset_settings::unsetSpace_group_number() { m_Space_group_numberIsSet = false; } std::string Dataset_settings::getSampleName() const { return m_Sample_name; } void Dataset_settings::setSampleName(std::string const& value) { m_Sample_name = value; } std::string Dataset_settings::getFpgaOutput() const { return m_Fpga_output; } void Dataset_settings::setFpgaOutput(std::string const& value) { m_Fpga_output = value; m_Fpga_outputIsSet = true; } bool Dataset_settings::fpgaOutputIsSet() const { return m_Fpga_outputIsSet; } void Dataset_settings::unsetFpga_output() { m_Fpga_outputIsSet = false; } std::string Dataset_settings::getCompression() const { return m_Compression; } void Dataset_settings::setCompression(std::string const& value) { m_Compression = value; m_CompressionIsSet = true; } bool Dataset_settings::compressionIsSet() const { return m_CompressionIsSet; } void Dataset_settings::unsetCompression() { m_CompressionIsSet = false; } float Dataset_settings::getTotalFlux() const { return m_Total_flux; } void Dataset_settings::setTotalFlux(float const value) { m_Total_flux = value; m_Total_fluxIsSet = true; } bool Dataset_settings::totalFluxIsSet() const { return m_Total_fluxIsSet; } void Dataset_settings::unsetTotal_flux() { m_Total_fluxIsSet = false; } float Dataset_settings::getTransmission() const { return m_Transmission; } void Dataset_settings::setTransmission(float const value) { m_Transmission = value; m_TransmissionIsSet = true; } bool Dataset_settings::transmissionIsSet() const { return m_TransmissionIsSet; } void Dataset_settings::unsetTransmission() { m_TransmissionIsSet = false; } org::openapitools::server::model::Rotation_axis Dataset_settings::getOmega() const { return m_Omega; } void Dataset_settings::setOmega(org::openapitools::server::model::Rotation_axis const& value) { m_Omega = value; m_OmegaIsSet = true; } bool Dataset_settings::omegaIsSet() const { return m_OmegaIsSet; } void Dataset_settings::unsetOmega() { m_OmegaIsSet = false; } std::string Dataset_settings::getHeaderAppendix() const { return m_Header_appendix; } void Dataset_settings::setHeaderAppendix(std::string const& value) { m_Header_appendix = value; m_Header_appendixIsSet = true; } bool Dataset_settings::headerAppendixIsSet() const { return m_Header_appendixIsSet; } void Dataset_settings::unsetHeader_appendix() { m_Header_appendixIsSet = false; } std::string Dataset_settings::getImageAppendix() const { return m_Image_appendix; } void Dataset_settings::setImageAppendix(std::string const& value) { m_Image_appendix = value; m_Image_appendixIsSet = true; } bool Dataset_settings::imageAppendixIsSet() const { return m_Image_appendixIsSet; } void Dataset_settings::unsetImage_appendix() { m_Image_appendixIsSet = false; } float Dataset_settings::getPhotonEnergyMultiplier() const { return m_Photon_energy_multiplier; } void Dataset_settings::setPhotonEnergyMultiplier(float const value) { m_Photon_energy_multiplier = value; m_Photon_energy_multiplierIsSet = true; } bool Dataset_settings::photonEnergyMultiplierIsSet() const { return m_Photon_energy_multiplierIsSet; } void Dataset_settings::unsetPhoton_energy_multiplier() { m_Photon_energy_multiplierIsSet = false; } float Dataset_settings::getDataReductionFactorSerialmx() const { return m_Data_reduction_factor_serialmx; } void Dataset_settings::setDataReductionFactorSerialmx(float const value) { m_Data_reduction_factor_serialmx = value; m_Data_reduction_factor_serialmxIsSet = true; } bool Dataset_settings::dataReductionFactorSerialmxIsSet() const { return m_Data_reduction_factor_serialmxIsSet; } void Dataset_settings::unsetData_reduction_factor_serialmx() { m_Data_reduction_factor_serialmxIsSet = false; } org::openapitools::server::model::Dataset_settings_unit_cell Dataset_settings::getUnitCell() const { return m_Unit_cell; } void Dataset_settings::setUnitCell(org::openapitools::server::model::Dataset_settings_unit_cell const& value) { m_Unit_cell = value; m_Unit_cellIsSet = true; } bool Dataset_settings::unitCellIsSet() const { return m_Unit_cellIsSet; } void Dataset_settings::unsetUnit_cell() { m_Unit_cellIsSet = false; } } // namespace org::openapitools::server::model