Rerun C++ SDK
Loading...
Searching...
No Matches
vec4d.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/store/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: // START of extensions from vec4d_ext.cpp:
24 /// Construct Vec4D from x/y/z/w values.
25 Vec4D(float x, float y, float z, float w) : xyzw{x, y, z, w} {}
26
27 /// Construct Vec4D from x/y/z/w float pointer.
28 explicit Vec4D(const float* xyzw_) : xyzw{xyzw_[0], xyzw_[1], xyzw_[2], xyzw_[3]} {}
29
30 float x() const {
31 return xyzw[0];
32 }
33
34 float y() const {
35 return xyzw[1];
36 }
37
38 float z() const {
39 return xyzw[2];
40 }
41
42 float w() const {
43 return xyzw[3];
44 }
45
46 // END of extensions from vec4d_ext.cpp, start of generated code:
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:95
All built-in datatypes. See Types in the Rerun manual.
Definition rerun.hpp:82
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
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:28
Vec4D(float x, float y, float z, float w)
Construct Vec4D from x/y/z/w values.
Definition vec4d.hpp:25