Rerun C++ SDK
Loading...
Searching...
No Matches
vector3d.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/vector3d.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 vector in 3D space.
21 struct Vector3D {
23
24 public:
25 // Extensions to generated type defined in 'vector3d_ext.cpp'
26
27 /// Construct Vector3D from x/y/z values.
28 Vector3D(float x, float y, float z) : vector{x, y, z} {}
29
30 /// Construct Vec3D from x/y/z float pointer.
31 explicit Vector3D(const float* xyz) : vector{xyz[0], xyz[1], xyz[2]} {}
32
33 float x() const {
34 return vector.x();
35 }
36
37 float y() const {
38 return vector.y();
39 }
40
41 float z() const {
42 return vector.z();
43 }
44
45 public:
46 Vector3D() = default;
47
48 Vector3D(rerun::datatypes::Vec3D vector_) : vector(vector_) {}
49
50 Vector3D& operator=(rerun::datatypes::Vec3D vector_) {
51 vector = vector_;
52 return *this;
53 }
54
55 Vector3D(std::array<float, 3> xyz_) : vector(xyz_) {}
56
57 Vector3D& operator=(std::array<float, 3> xyz_) {
58 vector = xyz_;
59 return *this;
60 }
61
62 /// Cast to the underlying Vec3D datatype
63 operator rerun::datatypes::Vec3D() const {
64 return vector;
65 }
66 };
67} // namespace rerun::components
68
69namespace rerun {
70 template <typename T>
71 struct Loggable;
72
73 /// \private
74 template <>
75 struct Loggable<components::Vector3D> {
76 static constexpr const char Name[] = "rerun.components.Vector3D";
77
78 /// Returns the arrow data type this type corresponds to.
79 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
80
81 /// Fills an arrow array builder with an array of this type.
82 static rerun::Error fill_arrow_array_builder(
83 arrow::FixedSizeListBuilder* builder, const components::Vector3D* elements,
84 size_t num_elements
85 );
86
87 /// Serializes an array of `rerun::components::Vector3D` into an arrow array.
88 static Result<std::shared_ptr<arrow::Array>> to_arrow(
89 const components::Vector3D* instances, size_t num_instances
90 );
91 };
92} // 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 vector in 3D space.
Definition vector3d.hpp:21
Vector3D(const float *xyz)
Construct Vec3D from x/y/z float pointer.
Definition vector3d.hpp:31
Vector3D(float x, float y, float z)
Construct Vector3D from x/y/z values.
Definition vector3d.hpp:28
Datatype: A vector in 3D space.
Definition vec3d.hpp:20