Rerun C++ SDK
Loading...
Searching...
No Matches
value_range.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/value_range.fbs".
3
4#pragma once
5
6#include "../datatypes/range1d.hpp"
7#include "../result.hpp"
8
9#include <array>
10#include <cstdint>
11#include <memory>
12
13namespace rerun::components {
14 /// **Component**: Range of expected or valid values, specifying a lower and upper bound.
15 ///
16 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
17 ///
18 struct ValueRange {
20
21 public:
22 ValueRange() = default;
23
24 ValueRange(rerun::datatypes::Range1D range_) : range(range_) {}
25
26 ValueRange& operator=(rerun::datatypes::Range1D range_) {
27 range = range_;
28 return *this;
29 }
30
31 ValueRange(std::array<double, 2> range_) : range(range_) {}
32
33 ValueRange& operator=(std::array<double, 2> range_) {
34 range = range_;
35 return *this;
36 }
37
38 /// Cast to the underlying Range1D datatype
39 operator rerun::datatypes::Range1D() const {
40 return range;
41 }
42 };
43} // namespace rerun::components
44
45namespace rerun {
46 static_assert(sizeof(rerun::datatypes::Range1D) == sizeof(components::ValueRange));
47
48 /// \private
49 template <>
50 struct Loggable<components::ValueRange> {
51 static constexpr std::string_view ComponentType = "rerun.components.ValueRange";
52
53 /// Returns the arrow data type this type corresponds to.
54 static const std::shared_ptr<arrow::DataType>& arrow_datatype() {
55 return Loggable<rerun::datatypes::Range1D>::arrow_datatype();
56 }
57
58 /// Serializes an array of `rerun::components::ValueRange` into an arrow array.
59 static Result<std::shared_ptr<arrow::Array>> to_arrow(
60 const components::ValueRange* instances, size_t num_instances
61 ) {
62 if (num_instances == 0) {
63 return Loggable<rerun::datatypes::Range1D>::to_arrow(nullptr, 0);
64 } else if (instances == nullptr) {
65 return rerun::Error(
66 ErrorCode::UnexpectedNullArgument,
67 "Passed array instances is null when num_elements> 0."
68 );
69 } else {
70 return Loggable<rerun::datatypes::Range1D>::to_arrow(
71 &instances->range,
72 num_instances
73 );
74 }
75 }
76 };
77} // 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: Range of expected or valid values, specifying a lower and upper bound.
Definition value_range.hpp:18
Datatype: A 1D range, specifying a lower and upper bound.
Definition range1d.hpp:20