OrbbecSDK  1.0.0
Pipeline.hpp
浏览该文件的文档.
1 
6 #pragma once
7 
8 #include "Types.hpp"
9 
10 #include <functional>
11 #include <memory>
12 
13 struct PipelineImpl;
14 struct ConfigImpl;
15 
16 namespace ob {
17 class FrameSet;
18 class Frame;
19 class Device;
20 class Config;
21 class StreamProfile;
22 class TestFilter;
23 class StreamProfileList;
24 
25 class OB_EXTENSION_API Pipeline {
26 private:
27  std::unique_ptr< PipelineImpl > impl_;
28 
29 public:
36  Pipeline();
41  Pipeline( std::shared_ptr< Device > device );
42  ~Pipeline();
48  void start( std::shared_ptr< Config > config );
49 
50  using FrameSetCallback = std::function< void( std::shared_ptr< FrameSet > frame ) >;
57  void start( std::shared_ptr< Config > config, FrameSetCallback callback );
62  void stop();
68  std::shared_ptr< Config > getConfig();
75  std::shared_ptr< FrameSet > waitForFrames( uint32_t timeout_ms );
81  std::shared_ptr< Device > getDevice();
88  std::shared_ptr< StreamProfileList > getStreamProfileList( OBSensorType sensorType );
94  std::shared_ptr< StreamProfileList > getAllStreamProfileList();
95 
100  void enableFrameSync();
105  void disableFrameSync();
106 
115  template < typename T > std::shared_ptr< T > createFilter();
116 };
117 
118 class OB_EXTENSION_API Config {
119 private:
120  std::unique_ptr< ConfigImpl > impl_;
121 
122 public:
123  Config();
124  ~Config();
125 
131  void enableStream( std::shared_ptr< StreamProfile > streamProfile );
136  void enableAllStream();
142  void disableStream( OBStreamType streamType );
147  void disableAllStream();
148 
149  friend class Pipeline;
150 };
151 
152 typedef std::function< void( std::shared_ptr< Frame > ) > FilterCallback;
153 
154 class OB_EXTENSION_API Filter {
155 public:
156  virtual ~Filter() = default;
161  virtual void reset();
162 
168  virtual void process( std::shared_ptr< Frame > frame );
169 
175  virtual bool start();
179  virtual void stop();
185  virtual void pushFrame( std::shared_ptr< Frame > frame );
191  virtual void setCallBack( FilterCallback callback );
192 
193 protected:
194  friend class Pipeline;
195  // 只可通过子类构造
196  Filter();
197  std::shared_ptr< FilterImpl > impl_;
198 };
199 } // namespace ob
Definition: Context.hpp:15
提供SDK的结构体、枚举常量定义(依赖libobsensor/h/ObTypes.h)