Rerun C++ SDK
Loading...
Searching...
No Matches
draw_order.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/build/re_type_definitions/rerun/components/draw_order.def.rs".
3
4#pragma once
5
6#include "../encodings/float32.hpp"
7#include "../result.hpp"
8
9#include <cstdint>
10#include <memory>
11
12namespace rerun::components {
13 /// **Component**: Draw order of 2D elements. Higher values are drawn on top of lower values.
14 ///
15 /// An entity can have only a single draw order component.
16 /// Within an entity draw order is governed by the order of the components.
17 ///
18 /// Draw order for entities with the same draw order is generally undefined.
19 ///
20 /// If no draw order is set, the viewer uses these defaults:
21 /// * -20: `archetypes::DepthImage`, `archetypes::EncodedDepthImage`
22 /// * -15: `archetypes::VideoFrameReference`, `archetypes::VideoStream`
23 /// * -10: `archetypes::Image`, `archetypes::EncodedImage`, `archetypes::GridMap`
24 /// * 0: `archetypes::SegmentationImage`
25 /// * 10: `archetypes::Boxes2D`, `archetypes::Ellipses2D`
26 /// * 20: `archetypes::Arrows2D`, `archetypes::LineStrips2D`
27 /// * 30: `archetypes::Points2D`
28 ///
29 /// For example, to draw an image on top of a segmentation image, give the image a draw order above 0.
30 struct DrawOrder {
32
33 public:
34 DrawOrder() = default;
35
36 DrawOrder(rerun::encodings::Float32 value_) : value(value_) {}
37
38 DrawOrder& operator=(rerun::encodings::Float32 value_) {
39 value = value_;
40 return *this;
41 }
42
43 DrawOrder(float value_) : value(value_) {}
44
45 DrawOrder& operator=(float value_) {
46 value = value_;
47 return *this;
48 }
49
50 /// Cast to the underlying Float32 encoding
51 operator rerun::encodings::Float32() const {
52 return value;
53 }
54 };
55} // namespace rerun::components
56
57namespace rerun {
58 static_assert(sizeof(rerun::encodings::Float32) == sizeof(components::DrawOrder));
59
60 /// \private
61 template <>
62 struct Loggable<components::DrawOrder> {
63 static constexpr std::string_view ComponentType = "rerun.components.DrawOrder";
64
65 /// Returns the arrow data type this type corresponds to.
66 static const std::shared_ptr<arrow::DataType>& arrow_data_type() {
67 return Loggable<rerun::encodings::Float32>::arrow_data_type();
68 }
69
70 /// Serializes an array of `rerun::components::DrawOrder` into an arrow array.
71 static Result<std::shared_ptr<arrow::Array>> to_arrow(
72 const components::DrawOrder* instances, size_t num_instances
73 ) {
74 if (num_instances == 0) {
75 return Loggable<rerun::encodings::Float32>::to_arrow(nullptr, 0);
76 } else if (instances == nullptr) {
77 return rerun::Error(
78 ErrorCode::UnexpectedNullArgument,
79 "Passed array instances is null when num_elements> 0."
80 );
81 } else {
82 return Loggable<rerun::encodings::Float32>::to_arrow(
83 &instances->value,
84 num_instances
85 );
86 }
87 }
88 };
89} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:104
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:93
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
Component: Draw order of 2D elements.
Definition draw_order.hpp:30
Encoding: A single-precision 32-bit IEEE 754 floating point number.
Definition float32.hpp:24