IDS peak genericC++ v1.12.0
Loading...
Searching...
No Matches
peak::core::Buffer Class Reference

Represents a GenTL buffer module. More...

#include <peak/buffer/peak_buffer.hpp>

Inheritance diagram for peak::core::Buffer:
peak::core::EventSupportingModule peak::core::Module

Public Member Functions

 Buffer ()=delete
 
 ~Buffer () override=default
 
 Buffer (const Buffer &other)=delete
 
Buffer & operator= (const Buffer &other)=delete
 
 Buffer (Buffer &&other)=delete
 
Buffer & operator= (Buffer &&other)=delete
 
ImageView ToImageView ()
 Create an ImageView object from this buffer.
 
std::vector< std::shared_ptr< BufferChunk > > Chunks ()
 Returns the buffer's chunks if it contains chunks.
 
std::vector< std::shared_ptr< BufferPart > > Parts ()
 Returns all buffer parts for multipart buffers.
 
std::shared_ptr< DataStream > ParentDataStream () const
 Returns the parent data stream.
 
Info Commands

Information based on GenTL BUFFER_INFO_CMD.

RawInformation Info (int32_t infoCommand) const
 Delivers information based on the given GenTL info command.
 
std::string TLType () const
 Returns the TL (transport layer) type.
 
void * BasePtr () const
 Returns the base pointer.
 
size_t Size () const
 Returns the size of the buffer in bytes.
 
void * UserPtr () const
 Returns the pointer to custom user data attached to the buffer.
 
BufferPayloadType PayloadType () const
 Returns the payload type.
 
uint64_t PixelFormat () const
 Returns the pixel format of the data.
 
peak::core::PixelFormatNamespace PixelFormatNamespace () const
 Returns the pixel format namespace, to allow interpretation of the PixelFormat().
 
Endianness PixelEndianness () const
 Returns the pixel endianness.
 
size_t ExpectedDataSize () const
 Returns the expected data size.
 
size_t DeliveredDataSize () const
 Returns the delivered data size.
 
uint64_t FrameID () const
 Returns the identifier of the current frame.
 
size_t ImageOffset () const
 Returns the offset of the image data from the beginning of the delivered buffer in bytes.
 
size_t DeliveredImageHeight () const
 Returns the delivered image height.
 
size_t DeliveredChunkPayloadSize () const
 Returns the delivered chunk payload size.
 
uint64_t ChunkLayoutID () const
 Returns the chunk layout ID.
 
std::string FileName () const
 Retrieves the file name.
 
size_t Width () const
 Returns the width.
 
size_t Height () const
 Returns the height.
 
size_t XOffset () const
 Returns the x offset of the data in the buffer in number of pixels from the image origin to handle areas of interest.
 
size_t YOffset () const
 Returns the y offset of the data in the buffer in number of lines from the image origin to handle areas of interest.
 
size_t XPadding () const
 Returns the x padding of the data in the buffer in number of bytes.
 
size_t YPadding () const
 Returns the y padding of the data in the buffer in number of bytes.
 
uint64_t Timestamp_ticks () const
 Returns the timestamp.
 
uint64_t Timestamp_ns () const
 Returns the timestamp associated with when the image was recorded.
 
bool IsQueued () const
 Checks whether the buffer is queued or not.
 
bool IsAcquiring () const
 Checks whether the buffer is currently being filled.
 
bool IsIncomplete () const
 Checks whether the buffer is incomplete or not.
 
bool HasNewData () const
 Checks whether the buffer has new data since the last delivery.
 
bool HasImage () const
 Checks whether the buffer contains image data.
 
bool HasChunks () const
 Checks whether the buffer contains chunks.
 
bool HasParts () const
 Checks whether the buffer contains parts.
 
- Public Member Functions inherited from peak::core::EventSupportingModule
 EventSupportingModule ()=default
 
 ~EventSupportingModule () override=default
 
 EventSupportingModule (const EventSupportingModule &other)=delete
 
EventSupportingModule & operator= (const EventSupportingModule &other)=delete
 
 EventSupportingModule (EventSupportingModule &&other)=delete
 
EventSupportingModule & operator= (EventSupportingModule &&other)=delete
 
std::unique_ptr< EventController > EnableEvents (EventType type)
 Enables events of the given event type.
 
- Public Member Functions inherited from peak::core::Module
 Module ()=default
 
virtual ~Module ()=default
 
 Module (const Module &other)=delete
 
Module & operator= (const Module &other)=delete
 
 Module (Module &&other)=delete
 
Module & operator= (Module &&other)=delete
 
std::vector< std::shared_ptr< NodeMap > > NodeMaps () const
 Returns the module's node maps.
 
std::shared_ptr< class Port > Port () const
 Returns the module's port.
 

Friends

class DataStream
 

Detailed Description

Represents a GenTL buffer module.

This class allows to query information about a GenTL buffer module and to enumerate its chunks or parts.

Constructor & Destructor Documentation

◆ Buffer() [1/3]

peak::core::Buffer::Buffer ( )
delete

◆ ~Buffer()

peak::core::Buffer::~Buffer ( )
overridedefault

◆ Buffer() [2/3]

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

◆ Buffer() [3/3]

peak::core::Buffer::Buffer ( Buffer && other)
delete

Member Function Documentation

◆ BasePtr()

void * peak::core::Buffer::BasePtr ( ) const
inline

Returns the base pointer.

Returns
Base pointer
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ ChunkLayoutID()

uint64_t peak::core::Buffer::ChunkLayoutID ( ) const
inline

Returns the chunk layout ID.

Returns
Chunk layout ID
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Chunks()

std::vector< std::shared_ptr< BufferChunk > > peak::core::Buffer::Chunks ( )
inline

Returns the buffer's chunks if it contains chunks.

Check if the buffer has chunks with HasChunks().

Returns
Buffer chunks
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ DeliveredChunkPayloadSize()

size_t peak::core::Buffer::DeliveredChunkPayloadSize ( ) const
inline

Returns the delivered chunk payload size.

Returns
Delivered chunk payload size
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ DeliveredDataSize()

size_t peak::core::Buffer::DeliveredDataSize ( ) const
inline

Returns the delivered data size.

Returns
Delivered data size
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ DeliveredImageHeight()

size_t peak::core::Buffer::DeliveredImageHeight ( ) const
inline

Returns the delivered image height.

Returns
Delivered image height
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ ExpectedDataSize()

size_t peak::core::Buffer::ExpectedDataSize ( ) const
inline

Returns the expected data size.

Returns
Expected data size
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ FileName()

std::string peak::core::Buffer::FileName ( ) const
inline

Retrieves the file name.

Returns the file name if the payload contains a file. For example, in GigE Vision, this corresponds to information provided in the image stream data leader. Implementations for other technologies should provide similar functionality as appropriate.

As this is based on GigE Vision, the file name is UTF-8 encoded, consistent with the GigE Vision specification.

Returns
A UTF-8 encoded file name as a string.
Since
1.0
Exceptions
InternalErrorExceptionIf an internal error occurs.

◆ FrameID()

uint64_t peak::core::Buffer::FrameID ( ) const
inline

Returns the identifier of the current frame.

The frame ID is a sequentially incremented value that increases by one from one frame to the next. It serves as a means to detect missing or out-of-order frames in a stream. Once the maximum value supported by the device and transport layer is reached, the frame ID wraps back to zero. The exact wrap-around point is not fixed and depends on both the device and the transport layer in use.

Returns
A 64-bit unsigned integer representing the frame ID.
Since
1.0
Exceptions
InternalErrorExceptionIf an internal error occurs.

◆ HasChunks()

bool peak::core::Buffer::HasChunks ( ) const
inline

Checks whether the buffer contains chunks.

If HasChunks() is true, check the BufferChunks using Chunks().

Returns
True, if the buffer has chunks.
False otherwise.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ HasImage()

bool peak::core::Buffer::HasImage ( ) const
inline

Checks whether the buffer contains image data.

Returns
True, if the buffer contains an image.
False otherwise.

See GenTL BUFFER_INFO_IMAGEPRESENT.

Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ HasNewData()

bool peak::core::Buffer::HasNewData ( ) const
inline

Checks whether the buffer has new data since the last delivery.

Returns
True when the buffer has new data since the last delivery.
False otherwise.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ HasParts()

bool peak::core::Buffer::HasParts ( ) const
inline

Checks whether the buffer contains parts.

If HasParts() is true, check the BufferParts using Parts().

Returns
True, if the buffer has parts.
False otherwise.
Since
1.8
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Height()

size_t peak::core::Buffer::Height ( ) const
inline

Returns the height.

Returns
Height
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ ImageOffset()

size_t peak::core::Buffer::ImageOffset ( ) const
inline

Returns the offset of the image data from the beginning of the delivered buffer in bytes.

Returns
Image offset in bytes
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Info()

RawInformation peak::core::Buffer::Info ( int32_t infoCommand) const
inline

Delivers information based on the given GenTL info command.

Parameters
[in]infoCommandThe GenTL info command.

This function can be used to query information going beyond the predefined info functions, based on the GenTL info commands of the corresponding module.

Example (error handling is omitted):

auto info = object->Info(GenTL::XX_INFO_XX);
// Cast depending on the delivered data type
if (info.dataType == GenTL::INFO_DATATYPE_UINT64)
{
uint64_t uint64Var = *reinterpret_cast<const uint64_t*>(info.data.data());
// Do something with the information
}
else if (infoDataTypeVar == GenTL::INFO_DATATYPE_INT64)
{
...
}
...
Returns
Raw information according to the passed info command
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ IsAcquiring()

bool peak::core::Buffer::IsAcquiring ( ) const
inline

Checks whether the buffer is currently being filled.

Returns
True, while the buffer is being filled.
False otherwise.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ IsIncomplete()

bool peak::core::Buffer::IsIncomplete ( ) const
inline

Checks whether the buffer is incomplete or not.

Incomplete buffers can happen when an error occurred while the buffer was being filled.

Returns
True if the buffer couldn't be filled completely.
False if the buffer is complete.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ IsQueued()

bool peak::core::Buffer::IsQueued ( ) const
inline

Checks whether the buffer is queued or not.

Returns
True, while the buffer is in the input pool, is currently being filled or is in the output buffer queue.
False otherwise.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ operator=() [1/2]

Buffer & peak::core::Buffer::operator= ( Buffer && other)
delete

◆ operator=() [2/2]

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

◆ ParentDataStream()

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

Returns the parent data stream.

Returns
Parent data stream
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Parts()

std::vector< std::shared_ptr< BufferPart > > peak::core::Buffer::Parts ( )
inline

Returns all buffer parts for multipart buffers.

Returns
Buffer parts
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ PayloadType()

BufferPayloadType peak::core::Buffer::PayloadType ( ) const
inline

Returns the payload type.

Returns
Payload type
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ PixelEndianness()

Endianness peak::core::Buffer::PixelEndianness ( ) const
inline

Returns the pixel endianness.

Returns
Pixel endianness
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ PixelFormat()

uint64_t peak::core::Buffer::PixelFormat ( ) const
inline

Returns the pixel format of the data.

The interpretation of the pixel format depends on the namespace the pixel format belongs to. This can be inquired using PixelFormatNamespace().

Returns
Pixel format
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ PixelFormatNamespace()

peak::core::PixelFormatNamespace peak::core::Buffer::PixelFormatNamespace ( ) const
inline

Returns the pixel format namespace, to allow interpretation of the PixelFormat().

Returns
Pixel format namespace
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Size()

size_t peak::core::Buffer::Size ( ) const
inline

Returns the size of the buffer in bytes.

Returns
Buffer size in bytes
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Timestamp_ns()

uint64_t peak::core::Buffer::Timestamp_ns ( ) const
inline

Returns the timestamp associated with when the image was recorded.

The timestamp is expressed in nanoseconds and is relative to a reference point (t = 0) defined by the transport layer and the device. This reference point is not known to the caller. The timestamp does not represent an absolute wall-clock time, but instead the elapsed time since that reference. The difference between timestamps of consecutive images indicates the time interval between their recordings.

Depending on the transport layer, timestamp information might not be provided.

Returns
Timestamp in nanoseconds, relative to an unknown reference point.
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Timestamp_ticks()

uint64_t peak::core::Buffer::Timestamp_ticks ( ) const
inline

Returns the timestamp.

Returns
Timestamp in ticks
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ TLType()

std::string peak::core::Buffer::TLType ( ) const
inline

Returns the TL (transport layer) type.

Returns
TL type
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ ToImageView()

ImageView peak::core::Buffer::ToImageView ( )
inline

Create an ImageView object from this buffer.

Returns
ImageView object, implementing peak::common::IImageView
Since
1.12

◆ UserPtr()

void * peak::core::Buffer::UserPtr ( ) const
inline

Returns the pointer to custom user data attached to the buffer.

Pointer to user data provided at buffer announcement using DataStream::AnnounceBuffer() / DataStream::AllocAndAnnounceBuffer(). This pointer can be used to identify or to attach custom user data to the buffer.

Returns
User pointer
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ Width()

size_t peak::core::Buffer::Width ( ) const
inline

Returns the width.

Returns
Width
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ XOffset()

size_t peak::core::Buffer::XOffset ( ) const
inline

Returns the x offset of the data in the buffer in number of pixels from the image origin to handle areas of interest.

Returns
X offset in number of pixels
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ XPadding()

size_t peak::core::Buffer::XPadding ( ) const
inline

Returns the x padding of the data in the buffer in number of bytes.

Returns
X padding in bytes
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ YOffset()

size_t peak::core::Buffer::YOffset ( ) const
inline

Returns the y offset of the data in the buffer in number of lines from the image origin to handle areas of interest.

Returns
Y offset in number of lines
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

◆ YPadding()

size_t peak::core::Buffer::YPadding ( ) const
inline

Returns the y padding of the data in the buffer in number of bytes.

Returns
Y padding in bytes
Since
1.0
Exceptions
InternalErrorExceptionAn internal error has occurred.

Friends And Related Symbol Documentation

◆ DataStream

friend class DataStream
friend

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