mirror of
https://github.com/paulscherrerinstitute/sf_daq_buffer.git
synced 2026-04-22 02:14:34 +02:00
352aefef26
In tests you don't want it to consume all your ram.
36 lines
832 B
C++
36 lines
832 B
C++
#ifndef SF_DAQ_BUFFER_RAMBUFFER_HPP
|
|
#define SF_DAQ_BUFFER_RAMBUFFER_HPP
|
|
|
|
#include <string>
|
|
#include "formats.hpp"
|
|
|
|
class RamBuffer {
|
|
const std::string detector_name_;
|
|
const int n_modules_;
|
|
const int module_n_;
|
|
const int n_slots_;
|
|
|
|
const size_t meta_size_;
|
|
const size_t image_size_;
|
|
const size_t buffer_size_;
|
|
|
|
int shm_fd_;
|
|
void* buffer_;
|
|
|
|
ModuleFrame* meta_buffer_;
|
|
char* image_buffer_;
|
|
|
|
public:
|
|
RamBuffer(const std::string& detector_name,
|
|
const int n_modules,
|
|
const int module_n=0,
|
|
const int n_slots=RAM_BUFFER_N_SLOTS);
|
|
~RamBuffer();
|
|
|
|
void write_frame(const ModuleFrame *src_meta, const char *src_data) const;
|
|
char* read_image(const uint64_t pulse_id, ImageMetadata &image_meta) const;
|
|
};
|
|
|
|
|
|
#endif //SF_DAQ_BUFFER_RAMBUFFER_HPP
|