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

An object of this class manages a limited number of images. More...

#include <imagelist.h>

Public Member Functions

void add (const std::shared_ptr< const Image > &image)
 Adds the given image to the internal list. More...
 
void add (const Buffer *buffer, uint32_t part)
 Creates an image from the given buffer and adds it to the internal list. More...
 
std::shared_ptr< const Imagefind (uint64_t timestamp) const
 Returns the image that has the given timestamp. More...
 
std::shared_ptr< const Imagefind (uint64_t timestamp, uint64_t tolerance) const
 Returns the oldest image that has a timestamp within the tolerance of the given timestamp. More...
 
uint64_t getOldestTime () const
 Get oldest timestamp of the list. More...
 
 ImageList (size_t maxsize=25)
 Create an image list. More...
 
void removeOld (uint64_t timestamp)
 Removes all images that have a timestamp that is older or equal than the given timestamp. More...
 

Private Attributes

std::vector< std::shared_ptr< const Image > > list
 
size_t maxsize
 

Detailed Description

An object of this class manages a limited number of images.

It is intended as a helper class for time synchronization of different images that can be associated by timestamp.

Definition at line 53 of file imagelist.h.

Constructor & Destructor Documentation

rcg::ImageList::ImageList ( size_t  maxsize = 25)

Create an image list.

Parameters
maxsizeMaximum number of elements that the list can hold. The default is 25, which is 1s at 25 Hz.

Definition at line 48 of file imagelist.cc.

Member Function Documentation

void rcg::ImageList::add ( const std::shared_ptr< const Image > &  image)

Adds the given image to the internal list.

If the maximum number of elements is exceeded, then the oldes image will be dropped.

Parameters
imageImage to be added.

Definition at line 53 of file imagelist.cc.

void rcg::ImageList::add ( const Buffer buffer,
uint32_t  part 
)

Creates an image from the given buffer and adds it to the internal list.

If the maximum number of elements is exceeded, then the oldes image will be dropped.

Parameters
bufferBuffer from which an image will be created.
partPart number from which the image should be created.

Definition at line 63 of file imagelist.cc.

std::shared_ptr< const Image > rcg::ImageList::find ( uint64_t  timestamp) const

Returns the image that has the given timestamp.

If the image cannot be found, then a nullptr is returned.

Parameters
timestampTimestamp.
Returns
Pointer to image or 0.

Definition at line 102 of file imagelist.cc.

std::shared_ptr< const Image > rcg::ImageList::find ( uint64_t  timestamp,
uint64_t  tolerance 
) const

Returns the oldest image that has a timestamp within the tolerance of the given timestamp.

If the tolerance is <= 0, then the behaviour is the same as for find(timestamp). If the image cannot be found, then a nullptr is returned.

Parameters
timestampTimestamp.
toleranceMaximum tolarance added or subtracted to the timestamp.
Returns
Pointer to image or 0.

Definition at line 115 of file imagelist.cc.

uint64_t rcg::ImageList::getOldestTime ( ) const

Get oldest timestamp of the list.

Returns
Oldest timestamp available or 0 if list is empty.

Definition at line 90 of file imagelist.cc.

void rcg::ImageList::removeOld ( uint64_t  timestamp)

Removes all images that have a timestamp that is older or equal than the given timestamp.

Parameters
timestampTimestamp.

Definition at line 73 of file imagelist.cc.

Member Data Documentation

std::vector<std::shared_ptr<const Image> > rcg::ImageList::list
private

Definition at line 130 of file imagelist.h.

size_t rcg::ImageList::maxsize
private

Definition at line 129 of file imagelist.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