CVB++ 15.0
decl_ring_buffer.hpp
1#pragma once
2
3#include "../../global.hpp"
4
5#include "../driver.hpp"
6
7namespace Cvb
8{
9
10 CVB_BEGIN_INLINE_NS
11
12 namespace Driver
13 {
14
16
17 class RingBuffer : public std::enable_shared_from_this<RingBuffer>
18 {
19 public:
20 explicit RingBuffer(const DevicePtr &parent)
21 : parent_(parent)
22 {
23 std::vector<Internal::AsyncRef<RingBufferImage>>(static_cast<std::size_t>(Count())).swap(bufferImages_);
24 }
25
27
31 DevicePtr Parent() const noexcept
32 {
33 return parent_;
34 }
35
37
42 RingBufferImagePtr At(int bufferIndex) const;
43
45
49 int Count() const noexcept;
50
52
56 RingBufferLockMode LockMode() const noexcept;
57
59
63 void SetLockMode(RingBufferLockMode ringBufferLockMode);
64
66
78 void ChangeCount(int numBuffers, DeviceUpdateMode mode);
79
80 private:
81 DevicePtr parent_;
82
83 mutable std::vector<Internal::AsyncRef<RingBufferImage>> bufferImages_;
84 };
85
86 } // namespace Driver
87
88 using Driver::RingBuffer;
89
90 CVB_END_INLINE_NS
91
92} // namespace Cvb
Ring buffer operations on a device.
Definition decl_ring_buffer.hpp:18
void ChangeCount(int numBuffers, DeviceUpdateMode mode)
Changes the number of buffers in this ring buffer.
Definition detail_ring_buffer.hpp:60
RingBufferLockMode LockMode() const noexcept
Gets the current lock mode.
Definition detail_ring_buffer.hpp:40
int Count() const noexcept
Number of buffers in the ring buffer.
Definition detail_ring_buffer.hpp:31
void SetLockMode(RingBufferLockMode ringBufferLockMode)
Sets the current lock mode.
Definition detail_ring_buffer.hpp:48
DevicePtr Parent() const noexcept
Gets the parent device of this ring buffer.
Definition decl_ring_buffer.hpp:31
RingBufferImagePtr At(int bufferIndex) const
Access to a single ring buffer image specified by its buffer index.
Definition detail_ring_buffer.hpp:19
Stream image that is returned, when the ring buffer interface is available on a device.
Definition decl_ring_buffer_image.hpp:24
Namespace for driver or device related operations.
Definition decl_composite.hpp:28
RingBufferLockMode
Lock mode options for the ring buffer.
Definition driver.hpp:400
std::shared_ptr< RingBufferImage > RingBufferImagePtr
Convenience shared pointer for RingBufferImage.
Definition driver.hpp:89
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
std::shared_ptr< Device > DevicePtr
Convenience shared pointer for Device.
Definition global.hpp:98
DeviceUpdateMode
Defines how to treat the optional device image, when the device itself is updated.
Definition global.hpp:252