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