6#include "../result.hpp"
18 class DenseUnionBuilder;
24 enum class Scale3DTag : uint8_t {
40 std::memset(
reinterpret_cast<void*
>(
this), 0,
sizeof(Scale3DData));
45 void swap(Scale3DData& other)
noexcept {
47 char temp[
sizeof(Scale3DData)];
48 void* otherbytes =
reinterpret_cast<void*
>(&other);
49 void* thisbytes =
reinterpret_cast<void*
>(
this);
50 std::memcpy(temp, thisbytes,
sizeof(Scale3DData));
51 std::memcpy(thisbytes, otherbytes,
sizeof(Scale3DData));
52 std::memcpy(otherbytes, temp,
sizeof(Scale3DData));
59 Scale3D() : _tag(detail::Scale3DTag::None) {}
63 const void* otherbytes =
reinterpret_cast<const void*
>(&other._data);
64 void* thisbytes =
reinterpret_cast<void*
>(&this->_data);
65 std::memcpy(thisbytes, otherbytes,
sizeof(detail::Scale3DData));
78 Scale3D& operator=(Scale3D&& other)
noexcept {
83 void swap(Scale3D& other)
noexcept {
84 std::swap(this->_tag, other._tag);
85 this->_data.swap(other._data);
101 self._tag = detail::Scale3DTag::ThreeD;
109 self._tag = detail::Scale3DTag::Uniform;
110 new (&self._data.uniform)
float(std::move(
uniform));
116 if (_tag == detail::Scale3DTag::ThreeD) {
117 return &_data.three_d;
125 if (_tag == detail::Scale3DTag::Uniform) {
126 return &_data.uniform;
133 const detail::Scale3DData& get_union_data()
const {
138 detail::Scale3DTag get_union_tag()
const {
143 detail::Scale3DTag _tag;
144 detail::Scale3DData _data;
149 template <
typename T>
154 struct Loggable<datatypes::Scale3D> {
155 static constexpr const char Name[] =
"rerun.datatypes.Scale3D";
158 static const std::shared_ptr<arrow::DataType>& arrow_datatype();
162 arrow::DenseUnionBuilder* builder,
const datatypes::Scale3D* elements,
167 static Result<std::shared_ptr<arrow::Array>> to_arrow(
168 const datatypes::Scale3D* instances,
size_t num_instances
Status outcome object (success or error) returned for fallible operations.
Definition error.hpp:87
All built-in datatypes. See Types in the Rerun manual.
Definition rerun.hpp:72
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
Datatype: 3D scaling factor, part of a transform representation.
Definition scale3d.hpp:58
const float * get_uniform() const
Return a pointer to uniform if the union is in that state, otherwise nullptr.
Definition scale3d.hpp:124
static Scale3D uniform(float uniform)
Uniform scaling factor along all axis.
Definition scale3d.hpp:107
static Scale3D three_d(rerun::datatypes::Vec3D three_d)
Individual scaling factors for each axis, distorting the original object.
Definition scale3d.hpp:99
Scale3D(rerun::datatypes::Vec3D three_d)
Individual scaling factors for each axis, distorting the original object.
Definition scale3d.hpp:89
Scale3D(const Scale3D &other)
Copy constructor.
Definition scale3d.hpp:62
const rerun::datatypes::Vec3D * get_three_d() const
Return a pointer to three_d if the union is in that state, otherwise nullptr.
Definition scale3d.hpp:115
Scale3D(float uniform)
Uniform scaling factor along all axis.
Definition scale3d.hpp:94
Datatype: A vector in 3D space.
Definition vec3d.hpp:20