50 maxsize=std::max(static_cast<size_t>(1), _maxsize);
55 list.push_back(image);
65 list.push_back(std::shared_ptr<const Image>(
new Image(buffer, part)));
77 while (i <
list.size())
79 if (
list[i]->getTimestampNS() <= timestamp)
81 list.erase(
list.begin()+
static_cast<int>(i));
96 ret=
list[0]->getTimestampNS();
104 for (
size_t i=0; i<
list.size(); i++)
106 if (
list[i]->getTimestampNS() == timestamp)
112 return std::shared_ptr<const Image>();
118 inline uint64_t absDiff(uint64_t a, uint64_t b)
130 std::shared_ptr<const Image>
ImageList::find(uint64_t timestamp, uint64_t tolerance)
const 137 uint64_t min_ad=absDiff(
list[0]->getTimestampNS(), timestamp);
139 for (
size_t i=1; i<
list.size(); i++)
141 uint64_t ad=absDiff(
list[i]->getTimestampNS(), timestamp);
150 if (min_ad < tolerance)
157 return find(timestamp);
161 return std::shared_ptr<const Image>();
The image class encapsulates image information.
uint64_t getOldestTime() const
Get oldest timestamp of the list.
void removeOld(uint64_t timestamp)
Removes all images that have a timestamp that is older or equal than the given timestamp.
The buffer class encapsulates a Genicam buffer that is provided by a stream.
void add(const std::shared_ptr< const Image > &image)
Adds the given image to the internal list.
std::vector< std::shared_ptr< const Image > > list
std::shared_ptr< const Image > find(uint64_t timestamp) const
Returns the image that has the given timestamp.
ImageList(size_t maxsize=25)
Create an image list.