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