CVB++ 15.0
detail_ring_buffer_image.hpp
1#pragma once
2
3#include "../../global.hpp"
4
5#include "../ring_buffer_image.hpp"
6#include "../ring_buffer.hpp"
7
8namespace Cvb
9{
10
11 CVB_BEGIN_INLINE_NS
12
13 namespace Driver
14 {
15
17 {
18 try
19 {
20
21 if (parent_->LockMode() == RingBufferLockMode::On)
22 {
23 CExports::cvbbool_t isLocked = false;
24 CExports::RBIsLocked(ParentDevice()->Handle(), static_cast<CExports::cvbval_t>(bufferIndex_), isLocked);
25 if (isLocked)
26 CExports::RBUnlock(ParentDevice()->Handle(), static_cast<CExports::cvbval_t>(bufferIndex_));
27 }
28 }
29 catch (...)
30 {
31 // eat it
32 }
33 }
34
36 {
37 return parent_->Parent();
38 }
39
41 {
42 if (parent_->LockMode() == RingBufferLockMode::On)
43 {
44 CExports::cvbbool_t isLocked = false;
45 CExports::RBIsLocked(ParentDevice()->Handle(), static_cast<CExports::cvbval_t>(bufferIndex_), isLocked);
46 if (isLocked)
47 CExports::RBUnlock(ParentDevice()->Handle(), static_cast<CExports::cvbval_t>(bufferIndex_));
48 }
49 }
50
51 } // namespace Driver
52
53 CVB_END_INLINE_NS
54
55} // namespace Cvb
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
virtual ~RingBufferImage()
Destructor of ring buffer unlocks the buffer if it is locked.
Definition detail_ring_buffer_image.hpp:16
void * Handle() const noexcept
Classic API image handle.
Definition decl_image.hpp:237
Namespace for driver or device related operations.
Definition decl_composite.hpp:28
@ On
Definition driver.hpp:416
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