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 "../component_descriptor.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::datatypes {
20 /// **Datatype**: A vector in 4D space.
21 struct Vec4D {
22 std::array<float, 4> xyzw;
23
24 public: // START of extensions from vec4d_ext.cpp:
25 /// Construct Vec4D from x/y/z/w values.
26 Vec4D(float x, float y, float z, float w) : xyzw{x, y, z, w} {}
27
28 /// Construct Vec4D from x/y/z/w float pointer.
29 explicit Vec4D(const float* xyzw_) : xyzw{xyzw_[0], xyzw_[1], xyzw_[2], xyzw_[3]} {}
30
31 float x() const {
32 return xyzw[0];
33 }
34
35 float y() const {
36 return xyzw[1];
37 }
38
39 float z() const {
40 return xyzw[2];
41 }
42
43 float w() const {
44 return xyzw[3];
45 }
46
47 // END of extensions from vec4d_ext.cpp, start of generated code:
48
49 public:
50 Vec4D() = default;
51
52 Vec4D(std::array<float, 4> xyzw_) : xyzw(xyzw_) {}
53
54 Vec4D& operator=(std::array<float, 4> xyzw_) {
55 xyzw = xyzw_;
56 return *this;
57 }
58 };
59} // namespace rerun::datatypes
60
61namespace rerun {
62 template <typename T>
63 struct Loggable;
64
65 /// \private
66 template <>
67 struct Loggable<datatypes::Vec4D> {
68 static constexpr ComponentDescriptor Descriptor = "rerun.datatypes.Vec4D";
69
70 /// Returns the arrow data type this type corresponds to.
71 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
72
73 /// Serializes an array of `rerun::datatypes::Vec4D` into an arrow array.
74 static Result<std::shared_ptr<arrow::Array>> to_arrow(
75 const datatypes::Vec4D* instances, size_t num_instances
76 );
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 datatypes::Vec4D* elements,
81 size_t num_elements
82 );
83 };
84} // 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:83
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Datatype: A vector in 4D space.
Definition vec4d.hpp:21
Vec4D(const float *xyzw_)
Construct Vec4D from x/y/z/w float pointer.
Definition vec4d.hpp:29
Vec4D(float x, float y, float z, float w)
Construct Vec4D from x/y/z/w values.
Definition vec4d.hpp:26