IDS peak genericC++ v1.17.0
Loading...
Searching...
No Matches
peak::core::BufferGuard Class Reference

Provides scoped access to a GenTL buffer and requeues it on destruction. More...

#include <peak/buffer/peak_buffer_guard.hpp>

Public Member Functions

 BufferGuard (std::shared_ptr< core::Buffer > buffer)
 Creates a buffer guard for the given buffer.
 ~BufferGuard ()
 Requeues the guarded buffer.
 BufferGuard (const BufferGuard &other)=delete
BufferGuard & operator= (const BufferGuard &other)=delete
 BufferGuard (BufferGuard &&other) noexcept=default
BufferGuard & operator= (BufferGuard &&other) noexcept=default
PEAK_COMMON_NO_DISCARD std::shared_ptr< core::Buffer > Buffer () const
 Returns the guarded buffer.
PEAK_COMMON_NO_DISCARD core::Buffer * operator-> () const
 Returns the guarded buffer.

Detailed Description

Provides scoped access to a GenTL buffer and requeues it on destruction.

This class holds a reference to a Buffer while it is being processed. When the guard is destroyed, the buffer is automatically requeued to the data stream.

Constructor & Destructor Documentation

◆ BufferGuard() [1/3]

peak::core::BufferGuard::BufferGuard ( std::shared_ptr< core::Buffer > buffer)
inlineexplicit

Creates a buffer guard for the given buffer.

The buffer is requeued when this guard is destroyed.

Parameters
[in]bufferThe buffer to guard.
Since
1.17
Exceptions
InvalidArgumentExceptionIf the provided buffer is nullptr.

◆ ~BufferGuard()

peak::core::BufferGuard::~BufferGuard ( )
inline

Requeues the guarded buffer.

Since
1.17

◆ BufferGuard() [2/3]

peak::core::BufferGuard::BufferGuard ( const BufferGuard & other)
delete

◆ BufferGuard() [3/3]

peak::core::BufferGuard::BufferGuard ( BufferGuard && other)
defaultnoexcept

Member Function Documentation

◆ Buffer()

std::shared_ptr< core::Buffer > peak::core::BufferGuard::Buffer ( ) const
inline

Returns the guarded buffer.

Returns
Guarded buffer
Since
1.17

◆ operator->()

core::Buffer * peak::core::BufferGuard::operator-> ( ) const
inline

Returns the guarded buffer.

Returns
Guarded buffer
Since
1.17

◆ operator=() [1/2]

BufferGuard & peak::core::BufferGuard::operator= ( BufferGuard && other)
defaultnoexcept

◆ operator=() [2/2]

BufferGuard & peak::core::BufferGuard::operator= ( const BufferGuard & other)
delete

The documentation for this class was generated from the following file: