Rerun C++ SDK
Loading...
Searching...
No Matches
position3d.hpp
1// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/re_types/definitions/rerun/components/position3d.fbs".
3
4#pragma once
5
6#include "../datatypes/vec3d.hpp"
7#include "../result.hpp"
8
9#include <array>
10#include <cstdint>
11#include <memory>
12
13namespace arrow {
14 class Array;
15 class DataType;
16 class FixedSizeListBuilder;
17} // namespace arrow
18
19namespace rerun::components {
20 /// **Component**: A position in 3D space.
21 struct Position3D {
23
24 public:
25 // Extensions to generated type defined in 'position3d_ext.cpp'
26
27 /// Construct Position3D from x/y/z values.
28 Position3D(float x, float y, float z) : xyz{x, y, z} {}
29
30 float x() const {
31 return xyz.x();
32 }
33
34 float y() const {
35 return xyz.y();
36 }
37
38 float z() const {
39 return xyz.z();
40 }
41
42 public:
43 Position3D() = default;
44
45 Position3D(rerun::datatypes::Vec3D xyz_) : xyz(xyz_) {}
46
47 Position3D& operator=(rerun::datatypes::Vec3D xyz_) {
48 xyz = xyz_;
49 return *this;
50 }
51
52 Position3D(std::array<float, 3> xyz_) : xyz(xyz_) {}
53
54 Position3D& operator=(std::array<float, 3> xyz_) {
55 xyz = xyz_;
56 return *this;
57 }
58
59 /// Cast to the underlying Vec3D datatype
60 operator rerun::datatypes::Vec3D() const {
61 return xyz;
62 }
63 };
64} // namespace rerun::components
65
66namespace rerun {
67 template <typename T>
68 struct Loggable;
69
70 /// \private
71 template <>
72 struct Loggable<components::Position3D> {
73 static constexpr const char Name[] = "rerun.components.Position3D";
74
75 /// Returns the arrow data type this type corresponds to.
76 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
77
78 /// Fills an arrow array builder with an array of this type.
79 static rerun::Error fill_arrow_array_builder(
80 arrow::FixedSizeListBuilder* builder, const components::Position3D* elements,
81 size_t num_elements
82 );
83
84 /// Serializes an array of `rerun::components::Position3D` into an arrow array.
85 static Result<std::shared_ptr<arrow::Array>> to_arrow(
86 const components::Position3D* instances, size_t num_instances
87 );
88 };
89} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:87
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:69
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
Component: A position in 3D space.
Definition position3d.hpp:21
Position3D(float x, float y, float z)
Construct Position3D from x/y/z values.
Definition position3d.hpp:28
Datatype: A vector in 3D space.
Definition vec3d.hpp:20