JFJochFrameSerializer: Single header for all the messages

This commit is contained in:
2023-07-06 10:44:01 +02:00
parent 3774105006
commit 9e92e230ba
12 changed files with 66 additions and 99 deletions
+1 -2
View File
@@ -15,8 +15,7 @@
#include "UnitCell.h"
#include "Coord.h"
#include "Definitions.h"
#include "../frame_serialize/StartMessage.h"
#include "../frame_serialize/EndMessage.h"
#include "../frame_serialize/CBORMessages.h"
#include "DetectorSetup.h"
#include "ROIFilter.h"
+1 -2
View File
@@ -10,8 +10,7 @@
#include "DiffractionExperiment.h"
#include "DiffractionSpot.h"
#include "../frame_serialize/JFJochFrameSerializer.h"
#include "../frame_serialize/StartMessage.h"
#include "../frame_serialize/EndMessage.h"
#include "../frame_serialize/CBORMessages.h"
#include "ZeroCopyReturnValue.h"
void PrepareCBORImage(DataMessage& message,
+1 -1
View File
@@ -9,7 +9,7 @@
#include "ZMQWrappers.h"
#include "DiffractionExperiment.h"
#include "../jungfrau/JFCalibration.h"
#include "../frame_serialize/ImageMessage.h"
#include "../frame_serialize/CBORMessages.h"
class ZMQPreviewPublisher {
ZMQSocket socket;
@@ -1,15 +1,52 @@
// Copyright (2019-2022) Paul Scherrer Institute
// Copyright (2019-2023) Paul Scherrer Institute
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef JUNGFRAUJOCH_STARTMESSAGE_H
#define JUNGFRAUJOCH_STARTMESSAGE_H
#ifndef JUNGFRAUJOCH_CBORMESSAGES_H
#define JUNGFRAUJOCH_CBORMESSAGES_H
#include <string>
#include <cstdint>
#include <map>
#include <vector>
#include "../compression/CompressionAlgorithmEnum.h"
#include "ImageMessage.h"
#include "../common/SpotToSave.h"
struct CBORImage {
const uint8_t *data;
size_t size; // Including compression
size_t xpixel;
size_t ypixel;
size_t pixel_depth_bytes;
bool pixel_is_signed;
bool pixel_is_float = false;
CompressionAlgorithm algorithm;
std::string channel;
};
struct DataMessage {
int64_t number = INT64_MIN;
CBORImage image;
std::vector<SpotToSave> spots;
std::vector<float> rad_int_profile;
uint64_t indexing_result; // 0 - not tried, 1 - tried and failed, 2 - tried and success
std::vector<float> indexing_lattice;
uint64_t bunch_id;
uint32_t jf_info;
float receiver_available_send_buffers;
int64_t receiver_aq_dev_delay;
uint64_t timestamp;
uint32_t timestamp_base;
uint32_t storage_cell;
uint32_t exptime;
uint32_t exptime_base;
std::string series_unique_id;
uint64_t series_id;
};
struct GoniometerAxis {
float increment;
@@ -99,4 +136,19 @@ struct StartMessage {
}
};
#endif //JUNGFRAUJOCH_STARTMESSAGE_H
struct EndMessage {
uint64_t number_of_images;
uint64_t max_receiver_delay;
float efficiency;
bool write_master_file;
std::string end_date;
std::string series_unique_id;
uint64_t series_id;
std::map<std::string, std::vector<float>> rad_int_result;
};
#endif //JUNGFRAUJOCH_CBORMESSAGES_H
+1 -2
View File
@@ -1,7 +1,6 @@
ADD_LIBRARY(FrameSerialize STATIC
JFJochFrameSerializer.cpp JFJochFrameSerializer.h
JFJochFrameDeserializer.cpp JFJochFrameDeserializer.h
ImageMessage.h
tinycbor/src/cborparser_dup_string.c
tinycbor/src/cborencoder.c
tinycbor/src/cborencoder_close_container_checked.c
@@ -11,4 +10,4 @@ ADD_LIBRARY(FrameSerialize STATIC
tinycbor/src/cborpretty.c
tinycbor/src/cborerrorstrings.c
tinycbor/src/cbor.h
tinycbor/src/tinycbor-version.h CborErr.h StartMessage.h EndMessage.h CborUtil.h)
tinycbor/src/tinycbor-version.h CborErr.h CborUtil.h CBORMessages.h)
-25
View File
@@ -1,25 +0,0 @@
// Copyright (2019-2022) Paul Scherrer Institute
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef JUNGFRAUJOCH_ENDMESSAGE_H
#define JUNGFRAUJOCH_ENDMESSAGE_H
#include <map>
#include <vector>
struct EndMessage {
uint64_t number_of_images;
uint64_t max_receiver_delay;
float efficiency;
bool write_master_file;
std::string end_date;
std::string series_unique_id;
uint64_t series_id;
std::map<std::string, std::vector<float>> rad_int_result;
};
#endif //JUNGFRAUJOCH_ENDMESSAGE_H
-51
View File
@@ -1,51 +0,0 @@
// Copyright (2019-2022) Paul Scherrer Institute
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef JUNGFRAUJOCH_IMAGEMESSAGE_H
#define JUNGFRAUJOCH_IMAGEMESSAGE_H
#include <string>
#include <cstdint>
#include <map>
#include <vector>
#include "../compression/CompressionAlgorithmEnum.h"
#include "../common/SpotToSave.h"
struct CBORImage {
const uint8_t *data;
size_t size; // Including compression
size_t xpixel;
size_t ypixel;
size_t pixel_depth_bytes;
bool pixel_is_signed;
bool pixel_is_float = false;
CompressionAlgorithm algorithm;
std::string channel;
};
struct DataMessage {
int64_t number = INT64_MIN;
CBORImage image;
std::vector<SpotToSave> spots;
std::vector<float> rad_int_profile;
uint64_t indexing_result; // 0 - not tried, 1 - tried and failed, 2 - tried and success
std::vector<float> indexing_lattice;
uint64_t bunch_id;
uint32_t jf_info;
float receiver_available_send_buffers;
int64_t receiver_aq_dev_delay;
uint64_t timestamp;
uint32_t timestamp_base;
uint32_t storage_cell;
uint32_t exptime;
uint32_t exptime_base;
std::string series_unique_id;
uint64_t series_id;
};
#endif //JUNGFRAUJOCH_IMAGEMESSAGE_H
+1 -3
View File
@@ -11,9 +11,7 @@
#include "../common/SpotToSave.h"
#include "tinycbor/src/cbor.h"
#include "EndMessage.h"
#include "StartMessage.h"
#include "ImageMessage.h"
#include "CBORMessages.h"
#include <mutex>
class JFJochFrameDeserializer {
+1 -3
View File
@@ -8,9 +8,7 @@
#include <cstdint>
#include <cstddef>
#include "../common/SpotToSave.h"
#include "StartMessage.h"
#include "EndMessage.h"
#include "ImageMessage.h"
#include "CBORMessages.h"
class JFJochFrameSerializer {
uint8_t *buffer = nullptr;
+1 -1
View File
@@ -10,7 +10,7 @@
#include "HDF5Objects.h"
#include "../common/SpotToSave.h"
#include "../frame_serialize/ImageMessage.h"
#include "../frame_serialize/CBORMessages.h"
struct HDF5DataFileStatistics {
std::string filename;
+1 -2
View File
@@ -4,8 +4,7 @@
#ifndef JUNGFRAUJOCH_HDF5NXMX_H
#define JUNGFRAUJOCH_HDF5NXMX_H
#include "../frame_serialize/StartMessage.h"
#include "../frame_serialize/EndMessage.h"
#include "../frame_serialize/CBORMessages.h"
#include "HDF5Objects.h"
+1 -2
View File
@@ -7,8 +7,7 @@
#include <numeric>
#include "HDF5DataFile.h"
#include "../frame_serialize/StartMessage.h"
#include "../frame_serialize/ImageMessage.h"
#include "../frame_serialize/CBORMessages.h"
class HDF5Writer {
std::vector<std::unique_ptr<HDF5DataFile> > files;