// Copyright (2019-2023) Paul Scherrer Institute #ifndef JUNGFRAUJOCH_ZEROCOPYRETURNVALUE_H #define JUNGFRAUJOCH_ZEROCOPYRETURNVALUE_H #include "ThreadSafeFIFO.h" class ZeroCopyReturnValue { void *ptr; uint32_t handle; ThreadSafeFIFO *fifo; public: ZeroCopyReturnValue(void *in_ptr, ThreadSafeFIFO &in_fifo, uint32_t in_handle) : ptr(in_ptr), fifo(&in_fifo), handle(in_handle) {} void *get_ptr() const { return ptr; } void release() const { fifo->PutBlocking(handle); } }; #endif //JUNGFRAUJOCH_ZEROCOPYRETURNVALUE_H