Rerun C++ SDK
Loading...
Searching...
No Matches
dvec2d.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/dvec2d.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 double-precision vector in 2D space.
21 struct DVec2D {
22 std::array<double, 2> xy;
23
24 public: // START of extensions from dvec2d_ext.cpp:
25 /// Construct DVec2D from x/y values.
26 DVec2D(double x, double y) : xy{x, y} {}
27
28 /// Construct DVec2D from x/y double pointer.
29 explicit DVec2D(const double* xy_) : xy{xy_[0], xy_[1]} {}
30
31 double x() const {
32 return xy[0];
33 }
34
35 double y() const {
36 return xy[1];
37 }
38
39 // END of extensions from dvec2d_ext.cpp, start of generated code:
40
41 public:
42 DVec2D() = default;
43
44 DVec2D(std::array<double, 2> xy_) : xy(xy_) {}
45
46 DVec2D& operator=(std::array<double, 2> xy_) {
47 xy = xy_;
48 return *this;
49 }
50 };
51} // namespace rerun::datatypes
52
53namespace rerun {
54 template <typename T>
55 struct Loggable;
56
57 /// \private
58 template <>
59 struct Loggable<datatypes::DVec2D> {
60 static constexpr ComponentDescriptor Descriptor = "rerun.datatypes.DVec2D";
61
62 /// Returns the arrow data type this type corresponds to.
63 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
64
65 /// Serializes an array of `rerun::datatypes::DVec2D` into an arrow array.
66 static Result<std::shared_ptr<arrow::Array>> to_arrow(
67 const datatypes::DVec2D* instances, size_t num_instances
68 );
69
70 /// Fills an arrow array builder with an array of this type.
71 static rerun::Error fill_arrow_array_builder(
72 arrow::FixedSizeListBuilder* builder, const datatypes::DVec2D* elements,
73 size_t num_elements
74 );
75 };
76} // 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 double-precision vector in 2D space.
Definition dvec2d.hpp:21
DVec2D(const double *xy_)
Construct DVec2D from x/y double pointer.
Definition dvec2d.hpp:29
DVec2D(double x, double y)
Construct DVec2D from x/y values.
Definition dvec2d.hpp:26