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 <memory>
12 #include <vector>
13 #include <ifm3d/device/device.h>
14 #include <ifm3d/fg/buffer.h>
15 #include <ifm3d/fg/module_frame_grabber.h>
16 #include <ifm3d/fg/buffer_id.h>
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);
44  Frame& operator=(Frame&& t);
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  decltype(std::declval<std::map<buffer_id, BufferList>>().begin())
92  begin() noexcept;
93  decltype(std::declval<const std::map<buffer_id, BufferList>>().begin())
94  begin() const noexcept;
95  decltype(std::declval<std::map<buffer_id, BufferList>>().end())
96  end() noexcept;
97  decltype(std::declval<const std::map<buffer_id, BufferList>>().end()) end()
98  const noexcept;
99 
100  private:
101  class Impl;
102  std::unique_ptr<Impl> pImpl;
103  }; // end: class Organizer
104 
105 } // end: namespace ifm3d
106 
107 #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:99
ifm3d::buffer_id
buffer_id
Definition: buffer_id.h:17
ifm3d::Frame
Definition: frame.h:30