#ifndef _STIMULUS_BUFFER_H #define _STIMULUS_BUFFER_H #include #include #include #include #include #include #include #include "stimulusFrame.h" #include "deviceAttachmentSpec.h" #define CL_TARGET_OPENCL_VERSION 120 #include namespace smo { namespace stim_buff { // Forward declaration class StimulusProducer; /** * StimulusBuffer manages a collection of stimulus frames and ring buffer. * * This buffer holds the actual frame storage and ring buffer for stimulus * data. It maintains a reference to its parent StimulusProducer. */ class StimulusBuffer { public: explicit StimulusBuffer( StimulusProducer& parent, const std::shared_ptr &deviceAttachmentSpec, int histbuffMs, const StagingBuffer::IOEngineConstraints& inputEngineConstraints, const StagingBuffer::IOEngineConstraints& outputEngineConstraints, const SmoCallbacks& callbacks, cl_mem_flags flags) : parent(parent), deviceAttachmentSpec(deviceAttachmentSpec), histbuffMs(histbuffMs), stagingBuffer( inputEngineConstraints, outputEngineConstraints, static_cast(histbuffMs / CONFIG_STIMBUFF_FRAME_PERIOD_MS)), ringBuffer( static_cast>(stagingBuffer), callbacks, flags) {} virtual ~StimulusBuffer() = default; // Non-copyable, movable StimulusBuffer(const StimulusBuffer&) = delete; StimulusBuffer& operator=(const StimulusBuffer&) = delete; StimulusBuffer(StimulusBuffer&&) = default; StimulusBuffer& operator=(StimulusBuffer&&) = default; public: StimulusProducer& parent; std::shared_ptr deviceAttachmentSpec; int histbuffMs; StagingBuffer stagingBuffer; SpMcRingBuffer ringBuffer; }; } // namespace stim_buff } // namespace smo #endif // _STIMULUS_BUFFER_H