v1.0.0-rc.69

This commit is contained in:
2025-08-17 21:21:20 +02:00
parent f98402043b
commit fa95858008
181 changed files with 948 additions and 506 deletions
+25 -8
View File
@@ -10,11 +10,15 @@
#include "../broker/gen/model/Plots.h"
void JFJochHttpReader::Close() {
std::unique_lock ul(http_mutex);
addr = "";
SetStartMessage({});
}
uint64_t JFJochHttpReader::GetNumberOfImages() const {
std::unique_lock ul(http_mutex);
if (addr.empty())
return 0;
@@ -35,6 +39,8 @@ uint64_t JFJochHttpReader::GetNumberOfImages() const {
}
void JFJochHttpReader::UpdateDataset() {
std::unique_lock ul(http_mutex);
httplib::Client cli_cmd(addr);
auto res = cli_cmd.Get("/image_buffer/start.cbor");
@@ -90,7 +96,7 @@ void JFJochHttpReader::UpdateDataset() {
dataset->bkg_estimate = GetPlot("bkg_estimate");
dataset->spot_count = GetPlot("spot_count");
dataset->indexing_result = GetPlot("indexing_rate");
dataset->mosaicity = GetPlot("mosaicity");
SetStartMessage(dataset);
} catch (std::exception &e) {
Close();
@@ -106,9 +112,14 @@ void JFJochHttpReader::ReadURL(const std::string &url) {
UpdateDataset();
}
std::shared_ptr<JFJochReaderImage> JFJochHttpReader::LoadImageInternal(int64_t image_number) {
bool JFJochHttpReader::LoadImage_i(const JFJochReaderDataset &dataset,
DataMessage &message,
std::vector<uint8_t> &buffer,
int64_t image_number) {
std::unique_lock ul(http_mutex);
if (addr.empty())
return {};
return false;
httplib::Client cli_cmd(addr);
@@ -118,21 +129,27 @@ std::shared_ptr<JFJochReaderImage> JFJochHttpReader::LoadImageInternal(int64_t i
auto res = cli_cmd.Get("/image_buffer/image.cbor?id=" + std::to_string(image_number));
if (!res || res->status != httplib::StatusCode::OK_200)
return {};
return false;
try {
auto msg = CBORStream2Deserialize(res->body);
buffer.resize(res->body.size());
memcpy(buffer.data(), res->body.data(), res->body.size());
auto msg = CBORStream2Deserialize(buffer);
if (msg->msg_type != CBORImageType::IMAGE)
return {};
return false;
return std::make_shared<JFJochReaderImage>(*msg->data_message, GetStartMessage());
message = *msg->data_message;
return true;
} catch (std::exception &e) {
return {};
return false;
}
}
std::vector<float> JFJochHttpReader::GetPlot(const std::string &plot_type, float fill_value) const {
std::unique_lock ul(http_mutex);
if (addr.empty())
return {};