Rerun C++ SDK
Loading...
Searching...
No Matches
pose_rotation_quat.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/components/rotation_quat.fbs".
3
4#pragma once
5
6#include "../datatypes/quaternion.hpp"
7#include "../result.hpp"
8
9#include <cstdint>
10#include <memory>
11
12namespace rerun::components {
13 /// **Component**: A 3D rotation expressed as a quaternion that doesn't propagate in the transform hierarchy.
14 ///
15 /// Note: although the x,y,z,w components of the quaternion will be passed through to the
16 /// datastore as provided, when used in the Viewer, quaternions will always be normalized.
17 /// If normalization fails the rotation is treated as an invalid transform.
20
21 public:
22 PoseRotationQuat() = default;
23
24 PoseRotationQuat(rerun::datatypes::Quaternion quaternion_) : quaternion(quaternion_) {}
25
26 PoseRotationQuat& operator=(rerun::datatypes::Quaternion quaternion_) {
27 quaternion = quaternion_;
28 return *this;
29 }
30
31 /// Cast to the underlying Quaternion datatype
33 return quaternion;
34 }
35 };
36} // namespace rerun::components
37
38namespace rerun {
39 static_assert(sizeof(rerun::datatypes::Quaternion) == sizeof(components::PoseRotationQuat));
40
41 /// \private
42 template <>
43 struct Loggable<components::PoseRotationQuat> {
44 static constexpr std::string_view ComponentType = "rerun.components.PoseRotationQuat";
45
46 /// Returns the arrow data type this type corresponds to.
47 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
48 return Loggable<rerun::datatypes::Quaternion>::arrow_datatype();
49 }
50
51 /// Serializes an array of `rerun::components::PoseRotationQuat` into an arrow array.
52 static Result<std::shared_ptr<arrow::Array>> to_arrow(
53 const components::PoseRotationQuat* instances, size_t num_instances
54 ) {
55 if (num_instances == 0) {
56 return Loggable<rerun::datatypes::Quaternion>::to_arrow(nullptr, 0);
57 } else if (instances == nullptr) {
58 return rerun::Error(
59 ErrorCode::UnexpectedNullArgument,
60 "Passed array instances is null when num_elements> 0."
61 );
62 } else {
63 return Loggable<rerun::datatypes::Quaternion>::to_arrow(
64 &instances->quaternion,
65 num_instances
66 );
67 }
68 }
69 };
70} // namespace rerun
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:99
All built-in components. See Types in the Rerun manual.
Definition rerun.hpp:79
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:23
Component: A 3D rotation expressed as a quaternion that doesn't propagate in the transform hierarchy.
Definition pose_rotation_quat.hpp:18
Datatype: A Quaternion represented by 4 real numbers.
Definition quaternion.hpp:24