| OrbbecSDK 1.5.7 OrbbecSDK: Software-Development-Kit for Orbbec 3D-Sensor devices

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

StreamProfile.hpp
Go to the documentation of this file.
1
10 #pragma once
11
12 #include "Types.hpp"
13
14 #include <iostream>
15 #include <memory>
16
17 struct StreamProfileImpl;
18 struct StreamProfileListImpl;
19
20 namespace ob {
21
22 class VideoStreamProfile;
23 class GyroStreamProfile;
24 class AccelStreamProfile;
25 class Config;
26
27 class OB_EXTENSION_API StreamProfile : public std::enable_shared_from_this<StreamProfile> {
28 protected:
29 std::unique_ptr<StreamProfileImpl> impl_;
30
31 public:
32 StreamProfile(std::unique_ptr<StreamProfileImpl> impl);
33 StreamProfile(StreamProfile &streamProfile);
34 ~StreamProfile() noexcept;
35
47 OBFormat format() const;
59 OBStreamType type() const;
60
74 template <typename T> bool is();
75
89 template <typename T> std::shared_ptr<T> as() {
90 if(!is<T>())
91 throw "unsupported operation, object's type is not require type";
92
93 return std::static_pointer_cast<T>(std::const_pointer_cast<StreamProfile>(shared_from_this()));
94 }
95
96 friend class Sensor;
97 friend class Config;
98 friend class Pipeline;
99 };
100
101 class OB_EXTENSION_API VideoStreamProfile : public StreamProfile {
102 public:
103 VideoStreamProfile(StreamProfile &profile);
104 ~VideoStreamProfile() noexcept;
105
117 uint32_t fps() const;
129 uint32_t width() const;
141 uint32_t height() const;
142 };
143
144 class OB_EXTENSION_API AccelStreamProfile : public StreamProfile {
145 public:
146 AccelStreamProfile(StreamProfile &profile);
147 ~AccelStreamProfile() noexcept;
148
160 OBAccelFullScaleRange fullScaleRange() const;
161
173 OBAccelSampleRate sampleRate() const;
174 };
175
176 class OB_EXTENSION_API GyroStreamProfile : public StreamProfile {
177 public:
178 GyroStreamProfile(StreamProfile &profile);
179 ~GyroStreamProfile() noexcept;
180
192 OBGyroFullScaleRange fullScaleRange() const;
193
205 OBGyroSampleRate sampleRate() const;
206 };
207
208 template <typename T> bool StreamProfile::is() {
209 switch(this->type()) {
210 case OB_STREAM_VIDEO:
211 case OB_STREAM_IR:
212 case OB_STREAM_IR_LEFT:
213 case OB_STREAM_IR_RIGHT:
214 case OB_STREAM_COLOR:
215 case OB_STREAM_DEPTH:
216 return typeid(T) == typeid(VideoStreamProfile);
217 case OB_STREAM_ACCEL:
218 return typeid(T) == typeid(AccelStreamProfile);
219 case OB_STREAM_GYRO:
220 return typeid(T) == typeid(GyroStreamProfile);
221 default:
222 break;
223 }
224 return false;
225 }
226
227 class OB_EXTENSION_API StreamProfileList {
228 protected:
229 std::unique_ptr<StreamProfileListImpl> impl_;
230
231 public:
232 StreamProfileList(std::unique_ptr<StreamProfileListImpl> impl);
233 ~StreamProfileList() noexcept;
234
246 uint32_t count() const;
247
261 const std::shared_ptr<StreamProfile> getProfile(uint32_t index);
262
283 const std::shared_ptr<VideoStreamProfile> getVideoStreamProfile(int width = 0, int height = 0, OBFormat format = OB_FORMAT_UNKNOWN, int fps = 0);
284 };
285
286 } // namespace ob
OBFormat
OBFormat
Enumeration value describing the pixel format.
Definition: ObTypes.h:221
OBAccelSampleRate
enum OBGyroSampleRate OBAccelSampleRate
OB_STREAM_IR_RIGHT
Definition: ObTypes.h:188
ob::Config
Definition: Pipeline.hpp:286
OB_STREAM_DEPTH
Definition: ObTypes.h:184
OB_STREAM_VIDEO
Definition: ObTypes.h:180
ob::AccelStreamProfile
Definition: StreamProfile.hpp:144
OBAccelFullScaleRange
OBAccelFullScaleRange
Accelerometer range enumeration.
Definition: ObTypes.h:596
ob
Definition: Context.hpp:20
ob::StreamProfile
Definition: StreamProfile.hpp:27
ob::StreamProfileList::impl_
std::unique_ptr< StreamProfileListImpl > impl_
Definition: StreamProfile.hpp:229
ob::Sensor
Definition: Sensor.hpp:40
OB_FORMAT_UNKNOWN
Definition: ObTypes.h:252
Types.hpp
Provide SDK structure and enumeration constant definition (depending on libobsensor/h/ObTypes.h)
OBGyroFullScaleRange
OBGyroFullScaleRange
Enumeration of gyroscope ranges.
Definition: ObTypes.h:577
OB_STREAM_GYRO
Definition: ObTypes.h:186
OB_STREAM_ACCEL
Definition: ObTypes.h:185
OB_STREAM_IR
Definition: ObTypes.h:182
ob::StreamProfile::is
bool is()
Check if frame object is compatible with the given type.
Definition: StreamProfile.hpp:208
OBStreamType
OBStreamType
Enumeration value describing the type of data stream.
Definition: ObTypes.h:178
OB_STREAM_COLOR
Definition: ObTypes.h:183
ob::Pipeline
Definition: Pipeline.hpp:32
OB_STREAM_IR_LEFT
Definition: ObTypes.h:187
ob::VideoStreamProfile
Definition: StreamProfile.hpp:101
ob::StreamProfileList
Definition: StreamProfile.hpp:227
ob::StreamProfile::impl_
std::unique_ptr< StreamProfileImpl > impl_
Definition: StreamProfile.hpp:29
OBGyroSampleRate
OBGyroSampleRate
Enumeration of IMU sample rate values ​​(gyroscope or accelerometer)
Definition: ObTypes.h:551
OB_EXTENSION_API
#define OB_EXTENSION_API
Definition: ObTypes.h:25
ob::GyroStreamProfile
Definition: StreamProfile.hpp:176