mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-16 08:55:06 +03:00
pipeline: raspberrypi: delayed_controls: Template the ControlRingBuffer class
Convert ControlRingBuffer to a templated class to allow arbitrary ring buffer array types to be defined. Rename ControlRingBuffer to RingBuffer to indicate this. Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: David Plowman <david.plowman@raspberrypi.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
dd0a75401f
commit
c7524b10e0
1 changed files with 7 additions and 6 deletions
|
@ -56,17 +56,18 @@ private:
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr int listSize = 16;
|
static constexpr int listSize = 16;
|
||||||
class ControlRingBuffer : public std::array<Info, listSize>
|
template<typename T>
|
||||||
|
class RingBuffer : public std::array<T, listSize>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Info &operator[](unsigned int index)
|
T &operator[](unsigned int index)
|
||||||
{
|
{
|
||||||
return std::array<Info, listSize>::operator[](index % listSize);
|
return std::array<T, listSize>::operator[](index % listSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Info &operator[](unsigned int index) const
|
const T &operator[](unsigned int index) const
|
||||||
{
|
{
|
||||||
return std::array<Info, listSize>::operator[](index % listSize);
|
return std::array<T, listSize>::operator[](index % listSize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,7 +77,7 @@ private:
|
||||||
|
|
||||||
uint32_t queueCount_;
|
uint32_t queueCount_;
|
||||||
uint32_t writeCount_;
|
uint32_t writeCount_;
|
||||||
std::unordered_map<const ControlId *, ControlRingBuffer> values_;
|
std::unordered_map<const ControlId *, RingBuffer<Info>> values_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace RPi */
|
} /* namespace RPi */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue