Rerun C++ SDK
Loading...
Searching...
No Matches
depth_meter.hpp
1// DO NOT EDIT! This file was auto-generated by crates/build/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/store/re_types/definitions/rerun/components/depth_meter.fbs".
3
4#pragma once
5
6#include "../component_descriptor.hpp"
7#include "../datatypes/float32.hpp"
8#include "../result.hpp"
9
10#include <cstdint>
11#include <memory>
12
13namespace rerun::components {
14 /// **Component**: The world->depth map scaling factor.
15 ///
16 /// This measures how many depth map units are in a world unit.
17 /// For instance, if a depth map uses millimeters and the world uses meters,
18 /// this value would be `1000`.
19 ///
20 /// Note that the only effect on 2D views is the physical depth values shown when hovering the image.
21 /// In 3D views on the other hand, this affects where the points of the point cloud are placed.
22 struct DepthMeter {
24
25 public:
26 DepthMeter() = default;
27
28 DepthMeter(rerun::datatypes::Float32 value_) : value(value_) {}
29
30 DepthMeter& operator=(rerun::datatypes::Float32 value_) {
31 value = value_;
32 return *this;
33 }
34
35 DepthMeter(float value_) : value(value_) {}
36
37 DepthMeter& operator=(float value_) {
38 value = value_;
39 return *this;
40 }
41
42 /// Cast to the underlying Float32 datatype
43 operator rerun::datatypes::Float32() const {
44 return value;
45 }
46 };
47} // namespace rerun::components
48
49namespace rerun {
50 static_assert(sizeof(rerun::datatypes::Float32) == sizeof(components::DepthMeter));
51
52 /// \private
53 template <>
54 struct Loggable<components::DepthMeter> {
55 static constexpr ComponentDescriptor Descriptor = "rerun.components.DepthMeter";
56
57 /// Returns the arrow data type this type corresponds to.
58 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
59 return Loggable<rerun::datatypes::Float32>::arrow_datatype();
60 }
61
62 /// Serializes an array of `rerun::components::DepthMeter` into an arrow array.
63 static Result<std::shared_ptr<arrow::Array>> to_arrow(
64 const components::DepthMeter* instances, size_t num_instances
65 ) {
66 if (num_instances == 0) {
67 return Loggable<rerun::datatypes::Float32>::to_arrow(nullptr, 0);
68 } else if (instances == nullptr) {
69 return rerun::Error(
70 ErrorCode::UnexpectedNullArgument,
71 "Passed array instances is null when num_elements> 0."
72 );
73 } else {
74 return Loggable<rerun::datatypes::Float32>::to_arrow(
75 &instances->value,
76 num_instances
77 );
78 }
79 }
80 };
81} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:95
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:80
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Component: The world->depth map scaling factor.
Definition depth_meter.hpp:22
Datatype: A single-precision 32-bit IEEE 754 floating point number.
Definition float32.hpp:25