Class ImageList
Defined in File imagelist.h
Class Documentation
-
class ImageList
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.
Public Functions
-
ImageList(size_t maxsize = 25)
Create an image list.
- Parameters:
maxsize – Maximum number of elements that the list can hold. The default is 25, which is 1s at 25 Hz.
Adds the given image to the internal list. If the maximum number of elements is exceeded, then the oldes image will be dropped.
- Parameters:
image – Image to be added.
-
void 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:
buffer – Buffer from which an image will be created.
part – Part number from which the image should be created.
-
void removeOld(uint64_t timestamp)
Removes all images that have a timestamp that is older or equal than the given timestamp.
- Parameters:
timestamp – Timestamp.
-
uint64_t getOldestTime() const
Get oldest timestamp of the list.
- Returns:
Oldest timestamp available or 0 if list is empty.
-
std::shared_ptr<const Image> 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:
timestamp – Timestamp.
- Returns:
Pointer to image or 0.
-
std::shared_ptr<const Image> 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:
timestamp – Timestamp.
tolerance – Maximum tolarance added or subtracted to the timestamp.
- Returns:
Pointer to image or 0.
-
ImageList(size_t maxsize = 25)