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