Rerun C++ SDK
Loading...
Searching...
No Matches
angle.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/angle.fbs".
3
4#pragma once
5
6#include "../component_descriptor.hpp"
7#include "../result.hpp"
8
9#include <cstdint>
10#include <memory>
11
12namespace arrow {
13 /// \private
14 template <typename T>
15 class NumericBuilder;
16
17 class Array;
18 class DataType;
19 class FloatType;
20 using FloatBuilder = NumericBuilder<FloatType>;
21} // namespace arrow
22
23namespace rerun::datatypes {
24 /// **Datatype**: Angle in radians.
25 struct Angle {
26 /// Angle in radians. One turn is equal to 2π (or τ) radians.
28
29 public: // START of extensions from angle_ext.cpp:
30 /// New angle in radians.
31 static Angle radians(float radians_) {
32 Angle angle;
33 angle.angle_radians = radians_;
34 return angle;
35 }
36
37 /// New angle in degrees.
38 ///
39 /// Converts to radians to store the angle.
40 static Angle degrees(float degrees_) {
41 Angle angle;
42 // Can't use math constants here: `M_PI` doesn't work on all platforms out of the box and std::numbers::pi is C++20.
43 angle.angle_radians = degrees_ * (3.14159265358979323846264338327950288f / 180.f);
44 return angle;
45 }
46
47 // END of extensions from angle_ext.cpp, start of generated code:
48
49 public:
50 Angle() = default;
51 };
52} // namespace rerun::datatypes
53
54namespace rerun {
55 template <typename T>
56 struct Loggable;
57
58 /// \private
59 template <>
60 struct Loggable<datatypes::Angle> {
61 static constexpr ComponentDescriptor Descriptor = "rerun.datatypes.Angle";
62
63 /// Returns the arrow data type this type corresponds to.
64 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
65
66 /// Serializes an array of `rerun::datatypes::Angle` into an arrow array.
67 static Result<std::shared_ptr<arrow::Array>> to_arrow(
68 const datatypes::Angle* instances, size_t num_instances
69 );
70
71 /// Fills an arrow array builder with an array of this type.
72 static rerun::Error fill_arrow_array_builder(
73 arrow::FloatBuilder* builder, const datatypes::Angle* elements, 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: Angle in radians.
Definition angle.hpp:25
static Angle degrees(float degrees_)
New angle in degrees.
Definition angle.hpp:40
float angle_radians
Angle in radians. One turn is equal to 2π (or τ) radians.
Definition angle.hpp:27
static Angle radians(float radians_)
New angle in radians.
Definition angle.hpp:31