imagelist.h
Go to the documentation of this file.
1 /*
2  * This file is part of the rc_genicam_camera package.
3  *
4  * Copyright (c) 2019 Roboception GmbH
5  * All rights reserved
6  *
7  * Author: Heiko Hirschmueller
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of the copyright holder nor the names of its contributors
20  * may be used to endorse or promote products derived from this software without
21  * specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
27  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33  * POSSIBILITY OF SUCH DAMAGE.
34  */
35 
36 #ifndef RC_GENICAM_CAMERA_IMAGELIST
37 #define RC_GENICAM_CAMERA_IMAGELIST
38 
39 #include <ros/ros.h>
40 #include <sensor_msgs/Image.h>
41 
42 namespace rcgccam
43 {
44 class ImageList
45 {
46 public:
50  ImageList();
51 
58  void setSize(size_t maxsize);
59 
65  void setTolerance(uint64_t tolerance);
66 
74  sensor_msgs::ImagePtr add(const sensor_msgs::ImagePtr& image);
75 
83  int removeOld(const ros::Time& timestamp);
84 
94  sensor_msgs::ImagePtr find(const ros::Time& timestamp) const;
95 
96 private:
97  size_t maxsize_;
98  uint64_t tolerance_;
99  std::vector<sensor_msgs::ImagePtr> list_;
100 };
101 
102 } // namespace rcgccam
103 
104 #endif
rcgccam::ImageList::maxsize_
size_t maxsize_
Definition: imagelist.h:97
rcgccam::ImageList::removeOld
int removeOld(const ros::Time &timestamp)
Remove all images that have a timestamp that is older or equal than the given timestamp.
Definition: imagelist.cc:72
ros.h
rcgccam::ImageList::find
sensor_msgs::ImagePtr find(const ros::Time &timestamp) const
Returns the oldest image that has a timestamp within the tolerance of the given timestamp.
Definition: imagelist.cc:93
rcgccam::ImageList::add
sensor_msgs::ImagePtr add(const sensor_msgs::ImagePtr &image)
Adds the given image to the internal list.
Definition: imagelist.cc:57
rcgccam::ImageList::list_
std::vector< sensor_msgs::ImagePtr > list_
Definition: imagelist.h:99
rcgccam
Definition: camerainfolist.cc:40
rcgccam::ImageList::ImageList
ImageList()
Create an image list.
Definition: imagelist.cc:42
rcgccam::ImageList
Definition: imagelist.h:44
ros::Time
rcgccam::ImageList::setSize
void setSize(size_t maxsize)
Set maximum size of the list.
Definition: imagelist.cc:47
rcgccam::ImageList::setTolerance
void setTolerance(uint64_t tolerance)
Set tolerance for finding corresponding timestamps.
Definition: imagelist.cc:52
rcgccam::ImageList::tolerance_
uint64_t tolerance_
Definition: imagelist.h:98


rc_genicam_camera
Author(s): Heiko Hirschmueller
autogenerated on Wed Mar 2 2022 00:49:18