ifm3d
frame.h
1 /*
2  * Copyright 2022-present ifm electronic, gmbh
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 
6 #ifndef IFM3D_FG_FRAME_H
7 #define IFM3D_FG_FRAME_H
8 
9 #include <chrono>
10 #include <cstdint>
11 #include <ifm3d/device/device.h>
12 #include <ifm3d/fg/buffer.h>
13 #include <ifm3d/fg/buffer_id.h>
14 #include <ifm3d/fg/module_frame_grabber.h>
15 #include <memory>
16 #include <vector>
17 
18 namespace ifm3d
19 {
20  using TimePointT = std::chrono::time_point<std::chrono::system_clock,
21  std::chrono::nanoseconds>;
22 
23  using BufferList = std::vector<Buffer>;
24  using BufferDataListMap = std::map<ifm3d::buffer_id, BufferList>;
25 
30  class IFM3D_EXPORT Frame
31  {
32  public:
33  using Ptr = std::shared_ptr<Frame>;
34 
35  Frame(const BufferDataListMap& images,
36  const std::vector<TimePointT>& timestamps,
37  uint64_t frame_count);
38  ~Frame();
39 
40  Frame(const Frame& t);
41  Frame& operator=(const Frame& t);
42 
43  Frame(Frame&& t) noexcept;
44  Frame& operator=(Frame&& t) noexcept;
45 
51  std::vector<TimePointT> TimeStamps();
52 
60  bool HasBuffer(buffer_id id);
61 
70  Buffer& GetBuffer(buffer_id key,
71  std::optional<size_t> index = std::nullopt);
72 
76  size_t GetBufferCount(buffer_id id);
77 
81  uint32_t FrameCount();
82 
89  std::vector<buffer_id> GetBuffers();
90 
91  // NOLINTBEGIN(readability-identifier-naming)
92  decltype(std::declval<std::map<buffer_id, BufferList>>().begin())
93  begin() noexcept;
94  [[nodiscard]] decltype(std::declval<
95  const std::map<buffer_id, BufferList>>()
96  .begin())
97  begin() const noexcept;
98  decltype(std::declval<std::map<buffer_id, BufferList>>().end())
99  end() noexcept;
100  [[nodiscard]] decltype(std::declval<
101  const std::map<buffer_id, BufferList>>()
102  .end())
103  end() const noexcept;
104  // NOLINTEND(readability-identifier-naming)
105 
106  private:
107  class Impl;
108  std::unique_ptr<Impl> _impl;
109  }; // end: class Organizer
110 
111 } // end: namespace ifm3d
112 
113 #endif // IFM3D_FG_FRAME_H
ifm3d::Buffer
The class Buffer represent a STL container to store data from the ifm devices in 2 dimension and supp...
Definition: buffer.h:98
ifm3d::buffer_id
buffer_id
Definition: buffer_id.h:18
ifm3d::Frame
Definition: frame.h:30