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