Files
salmanoff/include/user/stimulusBuffer.h
T

63 lines
1.6 KiB
C++
Raw Normal View History

#ifndef _STIMULUS_BUFFER_H
#define _STIMULUS_BUFFER_H
#include <config.h>
#include <vector>
#include <memory>
#include <user/spMcRingBuffer.h>
#include <user/stagingBuffer.h>
#include "stimulusFrame.h"
2025-11-14 23:19:32 -04:00
#include "deviceAttachmentSpec.h"
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,
2025-11-14 23:19:32 -04:00
const std::shared_ptr<device::DeviceAttachmentSpec>
&deviceAttachmentSpec,
int histbuffMs,
const StagingBuffer::IOEngineConstraints& inputEngineConstraints,
const StagingBuffer::IOEngineConstraints& outputEngineConstraints,
size_t nSlotsPerStimFrame)
: parent(parent),
2025-11-14 23:19:32 -04:00
deviceAttachmentSpec(deviceAttachmentSpec),
histbuffMs(histbuffMs),
ringBuffer(
static_cast<size_t>(histbuffMs / CONFIG_STIMBUFF_FRAME_PERIOD_MS),
inputEngineConstraints, outputEngineConstraints,
nSlotsPerStimFrame)
{}
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;
2025-11-14 23:19:32 -04:00
std::shared_ptr<device::DeviceAttachmentSpec> deviceAttachmentSpec;
int histbuffMs;
SpMcRingBuffer ringBuffer;
};
} // namespace stim_buff
} // namespace smo
#endif // _STIMULUS_BUFFER_H