Skip to content

Commit c7524b1

Browse files
naushirpinchartl
authored andcommitted
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 <[email protected]> Reviewed-by: David Plowman <[email protected]> Signed-off-by: Laurent Pinchart <[email protected]>
1 parent dd0a754 commit c7524b1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/libcamera/pipeline/raspberrypi/delayed_controls.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ class DelayedControls
5656
};
5757

5858
static constexpr int listSize = 16;
59-
class ControlRingBuffer : public std::array<Info, listSize>
59+
template<typename T>
60+
class RingBuffer : public std::array<T, listSize>
6061
{
6162
public:
62-
Info &operator[](unsigned int index)
63+
T &operator[](unsigned int index)
6364
{
64-
return std::array<Info, listSize>::operator[](index % listSize);
65+
return std::array<T, listSize>::operator[](index % listSize);
6566
}
6667

67-
const Info &operator[](unsigned int index) const
68+
const T &operator[](unsigned int index) const
6869
{
69-
return std::array<Info, listSize>::operator[](index % listSize);
70+
return std::array<T, listSize>::operator[](index % listSize);
7071
}
7172
};
7273

@@ -76,7 +77,7 @@ class DelayedControls
7677

7778
uint32_t queueCount_;
7879
uint32_t writeCount_;
79-
std::unordered_map<const ControlId *, ControlRingBuffer> values_;
80+
std::unordered_map<const ControlId *, RingBuffer<Info>> values_;
8081
};
8182

8283
} /* namespace RPi */

0 commit comments

Comments
 (0)