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 "../result.hpp"
7
8#include <cstdint>
9#include <memory>
10
11namespace arrow {
12 /// \private
13 template <typename T>
14 class NumericBuilder;
15
16 class Array;
17 class DataType;
18 class FloatType;
19 using FloatBuilder = NumericBuilder<FloatType>;
20} // namespace arrow
21
22namespace rerun::datatypes {
23 /// **Datatype**: Angle in radians.
24 struct Angle {
25 /// Angle in radians. One turn is equal to 2π (or τ) radians.
27
28 public: // START of extensions from angle_ext.cpp:
29 /// New angle in radians.
30 static Angle radians(float radians_) {
31 Angle angle;
32 angle.angle_radians = radians_;
33 return angle;
34 }
35
36 /// New angle in degrees.
37 ///
38 /// Converts to radians to store the angle.
39 static Angle degrees(float degrees_) {
40 Angle angle;
41 // 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.
42 angle.angle_radians = degrees_ * (3.14159265358979323846264338327950288f / 180.f);
43 return angle;
44 }
45
46 // END of extensions from angle_ext.cpp, start of generated code:
47
48 public:
49 Angle() = default;
50 };
51} // namespace rerun::datatypes
52
53namespace rerun {
54 template <typename T>
55 struct Loggable;
56
57 /// \private
58 template <>
59 struct Loggable<datatypes::Angle> {
60 static constexpr const char Name[] = "rerun.datatypes.Angle";
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::Angle` into an arrow array.
66 static Result<std::shared_ptr<arrow::Array>> to_arrow(
67 const datatypes::Angle* 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::FloatBuilder* builder, const datatypes::Angle* elements, size_t num_elements
73 );
74 };
75} // 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:82
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:22
Datatype: Angle in radians.
Definition angle.hpp:24
static Angle degrees(float degrees_)
New angle in degrees.
Definition angle.hpp:39
float angle_radians
Angle in radians. One turn is equal to 2π (or τ) radians.
Definition angle.hpp:26
static Angle radians(float radians_)
New angle in radians.
Definition angle.hpp:30