1800 lines
60 KiB
C++
1800 lines
60 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 "DefaultApi.h"
|
|
#include "Helpers.h"
|
|
|
|
namespace org::openapitools::server::api
|
|
{
|
|
|
|
using namespace org::openapitools::server::helpers;
|
|
using namespace org::openapitools::server::model;
|
|
|
|
const std::string DefaultApi::base = "";
|
|
|
|
DefaultApi::DefaultApi(const std::shared_ptr<Pistache::Rest::Router>& rtr)
|
|
: ApiBase(rtr)
|
|
{
|
|
}
|
|
|
|
void DefaultApi::init() {
|
|
setupRoutes();
|
|
}
|
|
|
|
void DefaultApi::setupRoutes() {
|
|
using namespace Pistache::Rest;
|
|
|
|
Routes::Post(*router, base + "/cancel", Routes::bind(&DefaultApi::cancel_post_handler, this));
|
|
Routes::Get(*router, base + "/config/azim_int", Routes::bind(&DefaultApi::config_azim_int_get_handler, this));
|
|
Routes::Put(*router, base + "/config/azim_int", Routes::bind(&DefaultApi::config_azim_int_put_handler, this));
|
|
Routes::Get(*router, base + "/config/detector", Routes::bind(&DefaultApi::config_detector_get_handler, this));
|
|
Routes::Put(*router, base + "/config/detector", Routes::bind(&DefaultApi::config_detector_put_handler, this));
|
|
Routes::Post(*router, base + "/config/image_format/conversion", Routes::bind(&DefaultApi::config_image_format_conversion_post_handler, this));
|
|
Routes::Get(*router, base + "/config/image_format", Routes::bind(&DefaultApi::config_image_format_get_handler, this));
|
|
Routes::Put(*router, base + "/config/image_format", Routes::bind(&DefaultApi::config_image_format_put_handler, this));
|
|
Routes::Post(*router, base + "/config/image_format/raw", Routes::bind(&DefaultApi::config_image_format_raw_post_handler, this));
|
|
Routes::Get(*router, base + "/config/instrument", Routes::bind(&DefaultApi::config_instrument_get_handler, this));
|
|
Routes::Put(*router, base + "/config/instrument", Routes::bind(&DefaultApi::config_instrument_put_handler, this));
|
|
Routes::Put(*router, base + "/config/internal_generator_image", Routes::bind(&DefaultApi::config_internal_generator_image_put_handler, this));
|
|
Routes::Put(*router, base + "/config/internal_generator_image.tiff", Routes::bind(&DefaultApi::config_internal_generator_image_tiff_put_handler, this));
|
|
Routes::Get(*router, base + "/config/mask", Routes::bind(&DefaultApi::config_mask_get_handler, this));
|
|
Routes::Get(*router, base + "/config/mask.tiff", Routes::bind(&DefaultApi::config_mask_tiff_get_handler, this));
|
|
Routes::Get(*router, base + "/config/select_detector", Routes::bind(&DefaultApi::config_select_detector_get_handler, this));
|
|
Routes::Put(*router, base + "/config/select_detector", Routes::bind(&DefaultApi::config_select_detector_put_handler, this));
|
|
Routes::Get(*router, base + "/config/spot_finding", Routes::bind(&DefaultApi::config_spot_finding_get_handler, this));
|
|
Routes::Put(*router, base + "/config/spot_finding", Routes::bind(&DefaultApi::config_spot_finding_put_handler, this));
|
|
Routes::Get(*router, base + "/config/user_mask", Routes::bind(&DefaultApi::config_user_mask_get_handler, this));
|
|
Routes::Put(*router, base + "/config/user_mask", Routes::bind(&DefaultApi::config_user_mask_put_handler, this));
|
|
Routes::Get(*router, base + "/config/user_mask.tiff", Routes::bind(&DefaultApi::config_user_mask_tiff_get_handler, this));
|
|
Routes::Put(*router, base + "/config/user_mask.tiff", Routes::bind(&DefaultApi::config_user_mask_tiff_put_handler, this));
|
|
Routes::Get(*router, base + "/config/zeromq_metadata", Routes::bind(&DefaultApi::config_zeromq_metadata_get_handler, this));
|
|
Routes::Put(*router, base + "/config/zeromq_metadata", Routes::bind(&DefaultApi::config_zeromq_metadata_put_handler, this));
|
|
Routes::Get(*router, base + "/config/zeromq_preview", Routes::bind(&DefaultApi::config_zeromq_preview_get_handler, this));
|
|
Routes::Put(*router, base + "/config/zeromq_preview", Routes::bind(&DefaultApi::config_zeromq_preview_put_handler, this));
|
|
Routes::Post(*router, base + "/deactivate", Routes::bind(&DefaultApi::deactivate_post_handler, this));
|
|
Routes::Get(*router, base + "/detector/status", Routes::bind(&DefaultApi::detector_status_get_handler, this));
|
|
Routes::Get(*router, base + "/fpga_status", Routes::bind(&DefaultApi::fpga_status_get_handler, this));
|
|
Routes::Post(*router, base + "/initialize", Routes::bind(&DefaultApi::initialize_post_handler, this));
|
|
Routes::Post(*router, base + "/pedestal", Routes::bind(&DefaultApi::pedestal_post_handler, this));
|
|
Routes::Get(*router, base + "/plot/azim_int", Routes::bind(&DefaultApi::plot_azim_int_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/bkg_estimate", Routes::bind(&DefaultApi::plot_bkg_estimate_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/error_pixel", Routes::bind(&DefaultApi::plot_error_pixel_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/image_collection_efficiency", Routes::bind(&DefaultApi::plot_image_collection_efficiency_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/indexing_rate", Routes::bind(&DefaultApi::plot_indexing_rate_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/indexing_unit_cell_angle", Routes::bind(&DefaultApi::plot_indexing_unit_cell_angle_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/indexing_unit_cell", Routes::bind(&DefaultApi::plot_indexing_unit_cell_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/receiver_delay", Routes::bind(&DefaultApi::plot_receiver_delay_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/receiver_free_send_buffers", Routes::bind(&DefaultApi::plot_receiver_free_send_buffers_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/roi_max_count", Routes::bind(&DefaultApi::plot_roi_max_count_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/roi_sum", Routes::bind(&DefaultApi::plot_roi_sum_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/roi_valid_pixels", Routes::bind(&DefaultApi::plot_roi_valid_pixels_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/spot_count", Routes::bind(&DefaultApi::plot_spot_count_get_handler, this));
|
|
Routes::Get(*router, base + "/plot/strong_pixel", Routes::bind(&DefaultApi::plot_strong_pixel_get_handler, this));
|
|
Routes::Get(*router, base + "/preview/calibration.tiff", Routes::bind(&DefaultApi::preview_calibration_tiff_get_handler, this));
|
|
Routes::Get(*router, base + "/preview/image.jpeg", Routes::bind(&DefaultApi::preview_image_jpeg_get_handler, this));
|
|
Routes::Post(*router, base + "/preview/image.jpeg", Routes::bind(&DefaultApi::preview_image_jpeg_post_handler, this));
|
|
Routes::Get(*router, base + "/preview/image.tiff", Routes::bind(&DefaultApi::preview_image_tiff_get_handler, this));
|
|
Routes::Get(*router, base + "/preview/pedestal.tiff", Routes::bind(&DefaultApi::preview_pedestal_tiff_get_handler, this));
|
|
Routes::Get(*router, base + "/roi/box", Routes::bind(&DefaultApi::roi_box_get_handler, this));
|
|
Routes::Put(*router, base + "/roi/box", Routes::bind(&DefaultApi::roi_box_put_handler, this));
|
|
Routes::Get(*router, base + "/roi/circle", Routes::bind(&DefaultApi::roi_circle_get_handler, this));
|
|
Routes::Put(*router, base + "/roi/circle", Routes::bind(&DefaultApi::roi_circle_put_handler, this));
|
|
Routes::Post(*router, base + "/start", Routes::bind(&DefaultApi::start_post_handler, this));
|
|
Routes::Get(*router, base + "/statistics/calibration", Routes::bind(&DefaultApi::statistics_calibration_get_handler, this));
|
|
Routes::Get(*router, base + "/statistics/data_collection", Routes::bind(&DefaultApi::statistics_data_collection_get_handler, this));
|
|
Routes::Get(*router, base + "/statistics", Routes::bind(&DefaultApi::statistics_get_handler, this));
|
|
Routes::Get(*router, base + "/status", Routes::bind(&DefaultApi::status_get_handler, this));
|
|
Routes::Post(*router, base + "/trigger", Routes::bind(&DefaultApi::trigger_post_handler, this));
|
|
Routes::Get(*router, base + "/version", Routes::bind(&DefaultApi::version_get_handler, this));
|
|
Routes::Post(*router, base + "/wait_till_done", Routes::bind(&DefaultApi::wait_till_done_post_handler, this));
|
|
Routes::Get(*router, base + "/xfel/event_code", Routes::bind(&DefaultApi::xfel_event_code_get_handler, this));
|
|
Routes::Get(*router, base + "/xfel/pulse_id", Routes::bind(&DefaultApi::xfel_pulse_id_get_handler, this));
|
|
|
|
// Default handler, called when a route is not found
|
|
router->addCustomHandler(Routes::bind(&DefaultApi::default_api_default_handler, this));
|
|
}
|
|
|
|
void DefaultApi::handleParsingException(const std::exception& ex, Pistache::Http::ResponseWriter &response) const noexcept
|
|
{
|
|
std::pair<Pistache::Http::Code, std::string> codeAndError = handleParsingException(ex);
|
|
response.send(codeAndError.first, codeAndError.second);
|
|
}
|
|
|
|
std::pair<Pistache::Http::Code, std::string> DefaultApi::handleParsingException(const std::exception& ex) const noexcept
|
|
{
|
|
try {
|
|
throw;
|
|
} catch (nlohmann::detail::exception &e) {
|
|
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
|
|
} catch (org::openapitools::server::helpers::ValidationException &e) {
|
|
return std::make_pair(Pistache::Http::Code::Bad_Request, e.what());
|
|
} catch (std::exception &e) {
|
|
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
}
|
|
|
|
void DefaultApi::handleOperationException(const std::exception& ex, Pistache::Http::ResponseWriter &response) const noexcept
|
|
{
|
|
std::pair<Pistache::Http::Code, std::string> codeAndError = handleOperationException(ex);
|
|
response.send(codeAndError.first, codeAndError.second);
|
|
}
|
|
|
|
std::pair<Pistache::Http::Code, std::string> DefaultApi::handleOperationException(const std::exception& ex) const noexcept
|
|
{
|
|
return std::make_pair(Pistache::Http::Code::Internal_Server_Error, ex.what());
|
|
}
|
|
|
|
void DefaultApi::cancel_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->cancel_post(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_azim_int_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_azim_int_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_azim_int_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Azim_int_settings azimIntSettings;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(azimIntSettings);
|
|
azimIntSettings.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->config_azim_int_put(azimIntSettings, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_detector_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_detector_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_detector_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Detector_settings detectorSettings;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(detectorSettings);
|
|
detectorSettings.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->config_detector_put(detectorSettings, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_image_format_conversion_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_image_format_conversion_post(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_image_format_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_image_format_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_image_format_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Image_format_settings imageFormatSettings;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(imageFormatSettings);
|
|
imageFormatSettings.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->config_image_format_put(imageFormatSettings, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_image_format_raw_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_image_format_raw_post(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_instrument_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_instrument_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_instrument_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Instrument_metadata instrumentMetadata;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(instrumentMetadata);
|
|
instrumentMetadata.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->config_instrument_put(instrumentMetadata, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_internal_generator_image_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
try {
|
|
this->config_internal_generator_image_put(request, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_internal_generator_image_tiff_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
try {
|
|
this->config_internal_generator_image_tiff_put(request, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_mask_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_mask_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_mask_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_mask_tiff_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_select_detector_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_select_detector_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_select_detector_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Detector_selection detectorSelection;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(detectorSelection);
|
|
detectorSelection.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->config_select_detector_put(detectorSelection, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_spot_finding_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_spot_finding_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_spot_finding_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Spot_finding_settings spotFindingSettings;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(spotFindingSettings);
|
|
spotFindingSettings.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->config_spot_finding_put(spotFindingSettings, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_user_mask_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_user_mask_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_user_mask_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
try {
|
|
this->config_user_mask_put(request, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_user_mask_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_user_mask_tiff_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_user_mask_tiff_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
try {
|
|
this->config_user_mask_tiff_put(request, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_zeromq_metadata_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_zeromq_metadata_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_zeromq_metadata_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Zeromq_metadata_settings zeromqMetadataSettings;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(zeromqMetadataSettings);
|
|
zeromqMetadataSettings.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->config_zeromq_metadata_put(zeromqMetadataSettings, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_zeromq_preview_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->config_zeromq_preview_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::config_zeromq_preview_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Zeromq_preview_settings zeromqPreviewSettings;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(zeromqPreviewSettings);
|
|
zeromqPreviewSettings.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->config_zeromq_preview_put(zeromqPreviewSettings, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::deactivate_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->deactivate_post(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::detector_status_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->detector_status_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::fpga_status_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->fpga_status_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::initialize_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->initialize_post(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::pedestal_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->pedestal_post(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_azim_int_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_azim_int_get(compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_bkg_estimate_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_bkg_estimate_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_error_pixel_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_error_pixel_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_image_collection_efficiency_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_image_collection_efficiency_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_indexing_rate_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_indexing_rate_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_indexing_unit_cell_angle_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_indexing_unit_cell_angle_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_indexing_unit_cell_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_indexing_unit_cell_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_receiver_delay_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_receiver_delay_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_receiver_free_send_buffers_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_receiver_free_send_buffers_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_roi_max_count_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_roi_max_count_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_roi_sum_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_roi_sum_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_roi_valid_pixels_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_roi_valid_pixels_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_spot_count_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_spot_count_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::plot_strong_pixel_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto binningQuery = request.query().get("binning");
|
|
std::optional<int32_t> binning;
|
|
if(binningQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(binningQuery.value(), valueQuery_instance)){
|
|
binning = valueQuery_instance;
|
|
}
|
|
}
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->plot_strong_pixel_get(binning, compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::preview_calibration_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->preview_calibration_tiff_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::preview_image_jpeg_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->preview_image_jpeg_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::preview_image_jpeg_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Preview_settings previewSettings;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(previewSettings);
|
|
previewSettings.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->preview_image_jpeg_post(previewSettings, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::preview_image_tiff_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->preview_image_tiff_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::preview_pedestal_tiff_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto gainLevelQuery = request.query().get("gain_level");
|
|
std::optional<int32_t> gainLevel;
|
|
if(gainLevelQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(gainLevelQuery.value(), valueQuery_instance)){
|
|
gainLevel = valueQuery_instance;
|
|
}
|
|
}
|
|
auto scQuery = request.query().get("sc");
|
|
std::optional<int32_t> sc;
|
|
if(scQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(scQuery.value(), valueQuery_instance)){
|
|
sc = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->preview_pedestal_tiff_get(gainLevel, sc, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::roi_box_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->roi_box_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::roi_box_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Roi_box_list roiBoxList;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(roiBoxList);
|
|
roiBoxList.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->roi_box_put(roiBoxList, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::roi_circle_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->roi_circle_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::roi_circle_put_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Roi_circle_list roiCircleList;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(roiCircleList);
|
|
roiCircleList.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->roi_circle_put(roiCircleList, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::start_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the body param
|
|
|
|
Dataset_settings datasetSettings;
|
|
|
|
try {
|
|
nlohmann::json::parse(request.body()).get_to(datasetSettings);
|
|
datasetSettings.validate();
|
|
} catch (std::exception &e) {
|
|
this->handleParsingException(e, response);
|
|
return;
|
|
}
|
|
|
|
try {
|
|
this->start_post(datasetSettings, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::statistics_calibration_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->statistics_calibration_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::statistics_data_collection_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->statistics_data_collection_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::statistics_get_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto compressionQuery = request.query().get("compression");
|
|
std::optional<bool> compression;
|
|
if(compressionQuery.has_value()){
|
|
bool valueQuery_instance;
|
|
if(fromStringValue(compressionQuery.value(), valueQuery_instance)){
|
|
compression = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->statistics_get(compression, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::status_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->status_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::trigger_post_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->trigger_post(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::version_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->version_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::wait_till_done_post_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
// Getting the query params
|
|
auto timeoutQuery = request.query().get("timeout");
|
|
std::optional<int32_t> timeout;
|
|
if(timeoutQuery.has_value()){
|
|
int32_t valueQuery_instance;
|
|
if(fromStringValue(timeoutQuery.value(), valueQuery_instance)){
|
|
timeout = valueQuery_instance;
|
|
}
|
|
}
|
|
|
|
try {
|
|
this->wait_till_done_post(timeout, response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::xfel_event_code_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->xfel_event_code_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
void DefaultApi::xfel_pulse_id_get_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
try {
|
|
|
|
|
|
try {
|
|
this->xfel_pulse_id_get(response);
|
|
} catch (Pistache::Http::HttpError &e) {
|
|
response.send(static_cast<Pistache::Http::Code>(e.code()), e.what());
|
|
return;
|
|
} catch (std::exception &e) {
|
|
this->handleOperationException(e, response);
|
|
return;
|
|
}
|
|
|
|
} catch (std::exception &e) {
|
|
response.send(Pistache::Http::Code::Internal_Server_Error, e.what());
|
|
}
|
|
|
|
}
|
|
|
|
void DefaultApi::default_api_default_handler(const Pistache::Rest::Request &, Pistache::Http::ResponseWriter response) {
|
|
response.send(Pistache::Http::Code::Not_Found, "The requested method does not exist");
|
|
}
|
|
|
|
} // namespace org::openapitools::server::api
|
|
|