CVB++ 15.0
decl_ring_buffer_image.hpp
1#pragma once
2
3#include "../../global.hpp"
4
5#include "../stream_image.hpp"
6
7#include "decl_stream.hpp"
8
9namespace Cvb
10{
11
12 CVB_BEGIN_INLINE_NS
13
14 namespace Driver
15 {
16
18
23 class RingBufferImage : public StreamImage
24 {
25 friend class Image;
26
27 public:
28 RingBufferImage(const RingBufferImage &other) = delete;
29 RingBufferImage &operator=(const RingBufferImage &other) = delete;
30 RingBufferImage(RingBufferImage &&other) = delete;
31 RingBufferImage &operator=(RingBufferImage &&other) = delete;
32
34
38 virtual ~RingBufferImage();
39
41
45 int BufferIndex() const noexcept
46 {
47 return bufferIndex_;
48 }
49
51
55 DevicePtr ParentDevice() const noexcept;
56
58
63 void Unlock();
64
65 double RawTimestamp() const noexcept override
66 {
67 double rawTimestamp = std::numeric_limits<double>::quiet_NaN();
68 CExports::RBGetRingBufferInfo(ParentDevice()->Handle(), bufferIndex_, CExports::RINGBUFFER_INFO_TIMESTAMP,
69 rawTimestamp);
70 return rawTimestamp;
71 }
72
73 protected:
74 RingBufferImage(HandleGuard<Image> &&guard, int bufferIndex,
75 const std::shared_ptr<const RingBuffer> &parent) noexcept
76 : StreamImage(std::move(guard))
77 , bufferIndex_(bufferIndex)
78 , parent_(parent)
79 {
80 }
81
82 private:
83 int bufferIndex_;
84
86 };
87
88 } // namespace Driver
89
91
92 CVB_END_INLINE_NS
93
94} // namespace Cvb
Stream image that is returned, when the ring buffer interface is available on a device.
Definition decl_ring_buffer_image.hpp:24
int BufferIndex() const noexcept
Gets the index of this buffer in the parent device's ring buffer.
Definition decl_ring_buffer_image.hpp:45
DevicePtr ParentDevice() const noexcept
Gets the parent device for this image.
Definition detail_ring_buffer_image.hpp:35
void Unlock()
Unlocks the ring buffer.
Definition detail_ring_buffer_image.hpp:40
double RawTimestamp() const noexcept override
Gets the raw timestamp as reported by the driver.
Definition decl_ring_buffer_image.hpp:65
virtual ~RingBufferImage()
Destructor of ring buffer unlocks the buffer if it is locked.
Definition detail_ring_buffer_image.hpp:16
Base class of all stream related images.
Definition stream_image.hpp:32
void * Handle() const noexcept
Classic API image handle.
Definition decl_image.hpp:237
T move(T... args)
Namespace for driver or device related operations.
Definition decl_composite.hpp:28
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
T quiet_NaN(T... args)