Public Member Functions | Private Member Functions | Private Attributes | List of all members
rcg::Buffer Class Reference

The buffer class encapsulates a Genicam buffer that is provided by a stream. More...

#include <buffer.h>

Public Member Functions

 Buffer (const std::shared_ptr< const GenTLWrapper > &gentl, Stream *parent)
 Constructs a buffer class as wrapper around a buffer handle. More...
 
void * getBase (std::uint32_t part) const
 Returns the base address of the specified part of the multi-part buffer. More...
 
uint64_t getChunkLayoutID () const
 Returns the chunk layout id, which serves as an indicator that the chunk layout has changed and the application should parse the chunk layout again. More...
 
bool getContainsChunkdata () const
 Returns if the buffer contains chunk data. More...
 
bool getDataLargerThanBuffer () const
 Signals if the memory that was allocated for this buffer is too small. More...
 
size_t getDataSize () const
 Returns the size of data intended to the written to the buffer the last time it has been filled. More...
 
size_t getDeliveredChunkPayloadSize () const
 Returnes the delivered chung payload size. More...
 
size_t getDeliveredImageHeight (std::uint32_t part) const
 Returns the number of lines that are delivered in this buffer. More...
 
std::string getFilename () const
 Returns the filename in case the payload contains a file. More...
 
uint64_t getFrameID () const
 Returns the sequentially incremented number of the frame. More...
 
void * getGlobalBase () const
 Returns the global base address of the buffer memory. More...
 
size_t getGlobalSize () const
 Returns the global size of the buffer. More...
 
void * getHandle () const
 Get internal stream handle. More...
 
size_t getHeight (std::uint32_t part) const
 Returns the height of the image in pixel. More...
 
bool getImagePresent (std::uint32_t part) const
 Returns if a 2D, 3D or confidence image is present in the specified part. More...
 
bool getIsAcquiring () const
 Signals if the buffer is currently being filled with data. More...
 
bool getIsIncomplete () const
 Signals if the buffer is incomplete due to an error. More...
 
bool getIsQueued () const
 Signals if the buffer is associated to the input or output queue. More...
 
bool getNewData () const
 Returns if the buffer contains new data. More...
 
std::uint32_t getNumberOfParts () const
 Returns the number of parts, excluding chunk data. More...
 
size_t getPartDataType (uint32_t part) const
 Returns the data type id of the specified part as defined in PARTDATATYPE_IDS. More...
 
uint64_t getPartSourceID (std::uint32_t part) const
 Returns the source id of the specified part. More...
 
size_t getPayloadType () const
 Returns the payload type according to PAYLOADTYPE_INFO_IDS. More...
 
uint64_t getPixelFormat (std::uint32_t part) const
 Returns the pixel format of the specified part as defined in the PFNC. More...
 
uint64_t getPixelFormatNamespace (std::uint32_t part) const
 Returns the pixel format namespace, which preferably should be PIXELFORMAT_NAMESPACE_PFNC_32BIT. More...
 
size_t getSize (std::uint32_t part) const
 Returns the size of the specified part of the mult-part buffer. More...
 
size_t getSizeFilled () const
 Returns the number of bytes written into the buffer last time it has been filled. More...
 
uint64_t getTimestamp () const
 Returns the timestamp of the buffer. More...
 
uint64_t getTimestampNS () const
 Returns the acquisition timestamp of the data in this buffer in ns. More...
 
std::string getTLType () const
 Returns the type the used transport layer. More...
 
void * getUserPtr () const
 Returns the private data pointer of the GenTL Consumer. More...
 
size_t getWidth (std::uint32_t part) const
 Returns the width of the image in pixel. More...
 
size_t getXOffset (std::uint32_t part) const
 Returns the horizontal offset of the data in the buffer in pixels from the image origin to handle areas of interest. More...
 
size_t getXPadding (std::uint32_t part) const
 Returns horizontal padding of the data in the buffer in bytes. More...
 
size_t getYOffset (std::uint32_t part) const
 Returns the vertical offset of the data in the buffer in lines from the image origin to handle areas of interest. More...
 
size_t getYPadding () const
 Returns vertical padding of the data in the buffer in bytes. More...
 
bool isBigEndian () const
 Returns if the data is given as big or little endian. More...
 
void setHandle (void *handle)
 Set the buffer handle that this object should manage. More...
 
void setNodemap (const std::shared_ptr< GenApi::CNodeMapRef > nodemap, const std::string &tltype)
 Set the device nodemap. More...
 
 ~Buffer ()
 

Private Member Functions

 Buffer (class Buffer &)
 
Bufferoperator= (const Buffer &)
 

Private Attributes

void * buffer
 
std::shared_ptr< GenApi::CChunkAdapterchunkadapter
 
std::shared_ptr< const GenTLWrappergentl
 
bool multipart
 
std::shared_ptr< GenApi::CNodeMapRefnodemap
 
Streamparent
 
size_t payload_type
 

Detailed Description

The buffer class encapsulates a Genicam buffer that is provided by a stream.

A multi-part buffer with one image can be treated like a "normal" buffer.

NOTE: A GenTLException is thrown in case of a severe error.

Definition at line 118 of file buffer.h.

Constructor & Destructor Documentation

rcg::Buffer::Buffer ( const std::shared_ptr< const GenTLWrapper > &  gentl,
Stream parent 
)

Constructs a buffer class as wrapper around a buffer handle.

Buffers must only be constructed by the stream class.

Definition at line 127 of file buffer.cc.

rcg::Buffer::~Buffer ( )

Definition at line 135 of file buffer.cc.

rcg::Buffer::Buffer ( class Buffer )
private

Member Function Documentation

void * rcg::Buffer::getBase ( std::uint32_t  part) const

Returns the base address of the specified part of the multi-part buffer.

Returns
Base address of the buffer memory part.

Definition at line 231 of file buffer.cc.

uint64_t rcg::Buffer::getChunkLayoutID ( ) const

Returns the chunk layout id, which serves as an indicator that the chunk layout has changed and the application should parse the chunk layout again.

Returns
Chunk layout id.

Definition at line 551 of file buffer.cc.

bool rcg::Buffer::getContainsChunkdata ( ) const

Returns if the buffer contains chunk data.

Returns
True if the buffer contains chunk data.

Definition at line 627 of file buffer.cc.

bool rcg::Buffer::getDataLargerThanBuffer ( ) const

Signals if the memory that was allocated for this buffer is too small.

Returns
True if buffer is too small.

Definition at line 621 of file buffer.cc.

size_t rcg::Buffer::getDataSize ( ) const

Returns the size of data intended to the written to the buffer the last time it has been filled.

If the buffer is incomplete, the number reports the full size of the original data including the lost parts. If the buffer is complete, the number equals getSizeFilled().

Returns
Data size in bytes.

Definition at line 586 of file buffer.cc.

size_t rcg::Buffer::getDeliveredChunkPayloadSize ( ) const

Returnes the delivered chung payload size.

Returns
Chunk payload size.

Definition at line 545 of file buffer.cc.

size_t rcg::Buffer::getDeliveredImageHeight ( std::uint32_t  part) const

Returns the number of lines that are delivered in this buffer.

For areea cameras, this is typically the same as the specified image height. For linescan cameras it can be less.

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
Number of delivered image lines.

Definition at line 526 of file buffer.cc.

std::string rcg::Buffer::getFilename ( ) const

Returns the filename in case the payload contains a file.

Returns
File name.

Definition at line 557 of file buffer.cc.

uint64_t rcg::Buffer::getFrameID ( ) const

Returns the sequentially incremented number of the frame.

The wrap around depends on the used transport layer technology.

Returns
Monotonically increasing frame id.

Definition at line 428 of file buffer.cc.

void * rcg::Buffer::getGlobalBase ( ) const

Returns the global base address of the buffer memory.

Returns
Global base address of the buffer memory.

Definition at line 221 of file buffer.cc.

size_t rcg::Buffer::getGlobalSize ( ) const

Returns the global size of the buffer.

Returns
Global size of the buffer in bytes.

Definition at line 226 of file buffer.cc.

void * rcg::Buffer::getHandle ( ) const

Get internal stream handle.

Returns
Internal handle.

Definition at line 638 of file buffer.cc.

size_t rcg::Buffer::getHeight ( std::uint32_t  part) const

Returns the height of the image in pixel.

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
Height of image.

Definition at line 351 of file buffer.cc.

bool rcg::Buffer::getImagePresent ( std::uint32_t  part) const

Returns if a 2D, 3D or confidence image is present in the specified part.

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
True if image is present.

Definition at line 433 of file buffer.cc.

bool rcg::Buffer::getIsAcquiring ( ) const

Signals if the buffer is currently being filled with data.

Returns
Flag to indicate that the buffer is currently being filled with data.

Definition at line 299 of file buffer.cc.

bool rcg::Buffer::getIsIncomplete ( ) const

Signals if the buffer is incomplete due to an error.

Returns
Flag to indicate that a buffer was filled but an error occurred during that process.

Definition at line 304 of file buffer.cc.

bool rcg::Buffer::getIsQueued ( ) const

Signals if the buffer is associated to the input or output queue.

Returns
Flag to indicate if the buffer is in the input pool or output queue.

Definition at line 294 of file buffer.cc.

bool rcg::Buffer::getNewData ( ) const

Returns if the buffer contains new data.

Returns
Flag to indicate that the buffer contains new data since the last call.

Definition at line 289 of file buffer.cc.

uint32_t rcg::Buffer::getNumberOfParts ( ) const

Returns the number of parts, excluding chunk data.

This is 1 if the buffer is not multipart and the buffer is not chunk only.

Returns
Number of parts.

Definition at line 199 of file buffer.cc.

size_t rcg::Buffer::getPartDataType ( uint32_t  part) const

Returns the data type id of the specified part as defined in PARTDATATYPE_IDS.

If this buffer is not mult-part, then 0 is returned.

Returns
One of PARTDATATYPE_IDS.

Definition at line 320 of file buffer.cc.

uint64_t rcg::Buffer::getPartSourceID ( std::uint32_t  part) const

Returns the source id of the specified part.

Images with the same source id are supposed to belong pixelwise together.

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
Source id of part or 0 if the buffer is not multi-part.

Definition at line 513 of file buffer.cc.

size_t rcg::Buffer::getPayloadType ( ) const

Returns the payload type according to PAYLOADTYPE_INFO_IDS.

Returns
One of PAYLOADTYPE_INFO_IDS.

Definition at line 474 of file buffer.cc.

uint64_t rcg::Buffer::getPixelFormat ( std::uint32_t  part) const

Returns the pixel format of the specified part as defined in the PFNC.

The pixel formats are defined in pixel_formats.h and PFNC.h if getPixelFormatNamespace() returns PIXELFORMAT_NAMESPACE_PFNC_32BIT.

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
Pixel format id.

Definition at line 480 of file buffer.cc.

uint64_t rcg::Buffer::getPixelFormatNamespace ( std::uint32_t  part) const

Returns the pixel format namespace, which preferably should be PIXELFORMAT_NAMESPACE_PFNC_32BIT.

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
One of PIXELFORMAT_NAMESPACE_IDS.

Definition at line 499 of file buffer.cc.

size_t rcg::Buffer::getSize ( std::uint32_t  part) const

Returns the size of the specified part of the mult-part buffer.

Returns
Size of the buffer part in bytes.

Definition at line 254 of file buffer.cc.

size_t rcg::Buffer::getSizeFilled ( ) const

Returns the number of bytes written into the buffer last time it has been filled.

This value is reset to 0 when the buffer is placed into the Input Buffer Pool.

Returns
Fill size of buffer since last call.

Definition at line 314 of file buffer.cc.

uint64_t rcg::Buffer::getTimestamp ( ) const

Returns the timestamp of the buffer.

Returns
Timestamp the buffer was acquired.

Definition at line 278 of file buffer.cc.

uint64_t rcg::Buffer::getTimestampNS ( ) const

Returns the acquisition timestamp of the data in this buffer in ns.

Returns
Timestamp in ns.

Definition at line 591 of file buffer.cc.

std::string rcg::Buffer::getTLType ( ) const

Returns the type the used transport layer.

Returns
Transport layer type.

Definition at line 309 of file buffer.cc.

void * rcg::Buffer::getUserPtr ( ) const

Returns the private data pointer of the GenTL Consumer.

Returns
Private data pointer of the GenTL Consumer.

Definition at line 273 of file buffer.cc.

size_t rcg::Buffer::getWidth ( std::uint32_t  part) const

Returns the width of the image in pixel.

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
Width of image.

Definition at line 333 of file buffer.cc.

size_t rcg::Buffer::getXOffset ( std::uint32_t  part) const

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

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
Horizontal offset of image.

Definition at line 369 of file buffer.cc.

size_t rcg::Buffer::getXPadding ( std::uint32_t  part) const

Returns horizontal padding of the data in the buffer in bytes.

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
Horizontal padding of image.

Definition at line 405 of file buffer.cc.

size_t rcg::Buffer::getYOffset ( std::uint32_t  part) const

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

Parameters
partPart index, which is ignored if the buffer is not multi-part.
Returns
Vertical offset of image.

Definition at line 387 of file buffer.cc.

size_t rcg::Buffer::getYPadding ( ) const

Returns vertical padding of the data in the buffer in bytes.

Returns
Vertical padding of image.

Definition at line 418 of file buffer.cc.

bool rcg::Buffer::isBigEndian ( ) const

Returns if the data is given as big or little endian.

Returns
True for big endian and false for little endian.

Definition at line 562 of file buffer.cc.

Buffer& rcg::Buffer::operator= ( const Buffer )
private
void rcg::Buffer::setHandle ( void *  handle)

Set the buffer handle that this object should manage.

The handle is used until a new handle is set.

Parameters
handleBuffer handle that replaces a possibly existing handle.

Definition at line 168 of file buffer.cc.

void rcg::Buffer::setNodemap ( const std::shared_ptr< GenApi::CNodeMapRef nodemap,
const std::string &  tltype 
)

Set the device nodemap.

If chunks are enabled (i.e. ChunkModeActive is true), the the buffer is automatically attached every time when setHandle() is called in Stream::grab(). This means that chunk values of the last grabbed buffer can be directly accessed through the nodemap.

Definition at line 143 of file buffer.cc.

Member Data Documentation

void* rcg::Buffer::buffer
private

Definition at line 475 of file buffer.h.

std::shared_ptr<GenApi::CChunkAdapter> rcg::Buffer::chunkadapter
private

Definition at line 480 of file buffer.h.

std::shared_ptr<const GenTLWrapper> rcg::Buffer::gentl
private

Definition at line 474 of file buffer.h.

bool rcg::Buffer::multipart
private

Definition at line 477 of file buffer.h.

std::shared_ptr<GenApi::CNodeMapRef> rcg::Buffer::nodemap
private

Definition at line 479 of file buffer.h.

Stream* rcg::Buffer::parent
private

Definition at line 473 of file buffer.h.

size_t rcg::Buffer::payload_type
private

Definition at line 476 of file buffer.h.


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


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Mar 17 2021 02:48:42