bag_view.h
Go to the documentation of this file.
1 // Filtering view on (multiple) bag files
2 // Author: Max Schwarz <max.schwarz@ais.uni-bonn.de>
3 
4 #ifndef ROSBAG_FANCY_BAG_VIEW_H
5 #define ROSBAG_FANCY_BAG_VIEW_H
6 
7 #include "bag_reader.h"
8 
9 namespace rosbag_fancy
10 {
11 
12 class BagView
13 {
14 public:
15  class Iterator;
16 
18  {
19  public:
20  const BagReader::Message* msg = {};
21  unsigned int bagIndex = 0;
22  };
23 
24  class Iterator
25  {
26  public:
27  using iterator_category = std::input_iterator_tag;
29  using reference = const MultiBagMessage&;
30  using pointer = const MultiBagMessage*;
31 
32  Iterator() {}
33  ~Iterator();
34 
35  Iterator(const Iterator&) = default;
36  Iterator& operator=(const Iterator&) = default;
37 
39  pointer operator->() { return &(**this); }
40 
41  Iterator& operator++();
42  Iterator operator++(int) { Iterator tmp = *this; ++(*this); return tmp; }
43 
44  friend bool operator== (const Iterator& a, const Iterator& b);
45  friend bool operator!= (const Iterator& a, const Iterator& b);
46 
47  private:
48  friend class BagView;
49 
50  explicit Iterator(const BagView* view);
51  Iterator(const BagView* view, const ros::Time& time);
52 
53  class Private;
54  std::shared_ptr<Private> m_d;
55  };
56 
57  BagView();
58  ~BagView();
59 
60  BagView(const BagView&) = delete;
61  BagView& operator=(const BagView&) = delete;
62 
63  void addBag(BagReader* reader);
64  void addBag(BagReader* reader, const std::function<bool(const BagReader::Connection&)>& connectionPredicate);
65 
66  ros::Time startTime() const;
67  ros::Time endTime() const;
68 
69  Iterator begin() const;
70  Iterator end() const;
71  Iterator findTime(const ros::Time& time) const;
72 
73 private:
74  friend class Iterator::Private;
75  class Private;
76  std::unique_ptr<Private> m_d;
77 };
78 
79 }
80 
81 #endif
std::unique_ptr< Private > m_d
Definition: bag_view.h:75
bool operator!=(const BagView::Iterator &a, const BagView::Iterator &b)
Definition: bag_view.cpp:209
Iterator begin() const
Definition: bag_view.cpp:242
bool operator==(const BagView::Iterator &a, const BagView::Iterator &b)
Definition: bag_view.cpp:203
ros::Time endTime() const
Definition: bag_view.cpp:237
BagView & operator=(const BagView &)=delete
Iterator end() const
Definition: bag_view.cpp:247
const BagReader::Message * msg
Definition: bag_view.h:20
std::shared_ptr< Private > m_d
Definition: bag_view.h:53
void addBag(BagReader *reader)
Definition: bag_view.cpp:227
ros::Time startTime() const
Definition: bag_view.cpp:232
TF2SIMD_FORCE_INLINE Vector3 operator*(const Matrix3x3 &m, const Vector3 &v)
std::input_iterator_tag iterator_category
Definition: bag_view.h:27
Iterator findTime(const ros::Time &time) const
Definition: bag_view.cpp:252


rosbag_fancy
Author(s):
autogenerated on Fri Dec 9 2022 04:00:08