Rerun C++ SDK
Loading...
Searching...
No Matches
half_sizes2d.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/components/half_sizes2d.fbs".
3
4#pragma once
5
6#include "../datatypes/vec2d.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::components {
20 /// **Component**: Half-sizes (extents) of a 2D box along its local axis, starting at its local origin/center.
21 ///
22 /// The box extends both in negative and positive direction along each axis.
23 /// Negative sizes indicate that the box is flipped along the respective axis, but this has no effect on how it is displayed.
24 struct HalfSizes2D {
26
27 public:
28 // Extensions to generated type defined in 'half_sizes2d_ext.cpp'
29
30 /// Construct HalfSizes2D from x/y values.
31 HalfSizes2D(float x, float y) : xy{x, y} {}
32
33 float x() const {
34 return xy.x();
35 }
36
37 float y() const {
38 return xy.y();
39 }
40
41 public:
42 HalfSizes2D() = default;
43
44 HalfSizes2D(rerun::datatypes::Vec2D xy_) : xy(xy_) {}
45
46 HalfSizes2D& operator=(rerun::datatypes::Vec2D xy_) {
47 xy = xy_;
48 return *this;
49 }
50
51 HalfSizes2D(std::array<float, 2> xy_) : xy(xy_) {}
52
53 HalfSizes2D& operator=(std::array<float, 2> xy_) {
54 xy = xy_;
55 return *this;
56 }
57
58 /// Cast to the underlying Vec2D datatype
59 operator rerun::datatypes::Vec2D() const {
60 return xy;
61 }
62 };
63} // namespace rerun::components
64
65namespace rerun {
66 template <typename T>
67 struct Loggable;
68
69 /// \private
70 template <>
71 struct Loggable<components::HalfSizes2D> {
72 static constexpr const char Name[] = "rerun.components.HalfSizes2D";
73
74 /// Returns the arrow data type this type corresponds to.
75 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
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 components::HalfSizes2D* elements,
80 size_t num_elements
81 );
82
83 /// Serializes an array of `rerun::components::HalfSizes2D` into an arrow array.
84 static Result<std::shared_ptr<arrow::Array>> to_arrow(
85 const components::HalfSizes2D* instances, size_t num_instances
86 );
87 };
88} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:87
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:69
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
Component: Half-sizes (extents) of a 2D box along its local axis, starting at its local origin/center...
Definition half_sizes2d.hpp:24
HalfSizes2D(float x, float y)
Construct HalfSizes2D from x/y values.
Definition half_sizes2d.hpp:31
Datatype: A vector in 2D space.
Definition vec2d.hpp:20