Rerun C++ SDK
Loading...
Searching...
No Matches
scalar_axis.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/build/re_type_definitions/rerun/blueprint/archetypes/scalar_axis.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/lock_range_during_zoom.hpp"
8#include "../../collection.hpp"
9#include "../../component_batch.hpp"
10#include "../../component_column.hpp"
11#include "../../components/range1d.hpp"
12#include "../../result.hpp"
13
14#include <cstdint>
15#include <optional>
16#include <utility>
17#include <vector>
18
19namespace rerun::blueprint::archetypes {
20 /// **Archetype**: Configuration for the scalar (Y) axis of a plot.
21 ///
22 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
23 ///
24 struct ScalarAxis {
25 /// The range of the axis.
26 ///
27 /// If unset, the range well be automatically determined based on the queried data.
28 std::optional<ComponentBatch> range;
29
30 /// If enabled, the Y axis range will remain locked to the specified range when zooming.
31 std::optional<ComponentBatch> zoom_lock;
32
33 public:
34 /// The name of the archetype as used in `ComponentDescriptor`s.
35 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.ScalarAxis";
36
37 /// `ComponentDescriptor` for the `range` field.
38 static constexpr auto Descriptor_range = ComponentDescriptor(
40 );
41 /// `ComponentDescriptor` for the `zoom_lock` field.
43 ArchetypeName, "ScalarAxis:zoom_lock",
45 );
46
47 public:
48 ScalarAxis() = default;
49 ScalarAxis(ScalarAxis&& other) = default;
50 ScalarAxis(const ScalarAxis& other) = default;
51 ScalarAxis& operator=(const ScalarAxis& other) = default;
52 ScalarAxis& operator=(ScalarAxis&& other) = default;
53
54 /// Update only some specific fields of a `ScalarAxis`.
56 return ScalarAxis();
57 }
58
59 /// Clear all the fields of a `ScalarAxis`.
61
62 /// The range of the axis.
63 ///
64 /// If unset, the range well be automatically determined based on the queried data.
66 range = ComponentBatch::from_loggable(_range, Descriptor_range).value_or_throw();
67 return std::move(*this);
68 }
69
70 /// If enabled, the Y axis range will remain locked to the specified range when zooming.
73 ) && {
74 zoom_lock =
75 ComponentBatch::from_loggable(_zoom_lock, Descriptor_zoom_lock).value_or_throw();
76 return std::move(*this);
77 }
78
79 /// Partitions the component data into multiple sub-batches.
80 ///
81 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
82 /// instead, via `ComponentBatch::partitioned`.
83 ///
84 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
85 ///
86 /// The specified `lengths` must sum to the total length of the component batch.
88 return detail::partition_batches({&range, &zoom_lock}, lengths_).value_or_throw();
89 }
90
91 /// Partitions the component data into unit-length sub-batches.
92 ///
93 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
94 /// where `n` is automatically guessed.
96 return detail::partition_batches_of_unit_length({&range, &zoom_lock}).value_or_throw();
97 }
98 };
99
100} // namespace rerun::blueprint::archetypes
101
102namespace rerun {
103 /// \private
104 template <typename T>
105 struct AsComponents;
106
107 /// \private
108 template <>
109 struct AsComponents<blueprint::archetypes::ScalarAxis> {
110 /// Serialize all set component batches.
111 static Result<Collection<ComponentBatch>> as_batches(
112 const blueprint::archetypes::ScalarAxis& archetype
113 ) {
114 return detail::collect_batches({&archetype.range, &archetype.zoom_lock});
115 }
116 };
117} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
A class for representing either a usable value, or an error.
Definition result.hpp:14
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:26
static Result< ComponentBatch > from_loggable(const rerun::Collection< T > &components, const ComponentDescriptor &descriptor)
Creates a new component batch from a collection of component instances.
Definition component_batch.hpp:46
A ComponentDescriptor fully describes the semantics of a column of data.
Definition component_descriptor.hpp:16
The Loggable trait is used by all built-in implementation of rerun::AsComponents to serialize a colle...
Definition loggable.hpp:11
Archetype: Configuration for the scalar (Y) axis of a plot.
Definition scalar_axis.hpp:24
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition scalar_axis.hpp:95
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition scalar_axis.hpp:87
ScalarAxis with_range(const rerun::components::Range1D &_range) &&
The range of the axis.
Definition scalar_axis.hpp:65
std::optional< ComponentBatch > zoom_lock
If enabled, the Y axis range will remain locked to the specified range when zooming.
Definition scalar_axis.hpp:31
static constexpr auto Descriptor_zoom_lock
ComponentDescriptor for the zoom_lock field.
Definition scalar_axis.hpp:42
std::optional< ComponentBatch > range
The range of the axis.
Definition scalar_axis.hpp:28
static ScalarAxis clear_fields()
Clear all the fields of a ScalarAxis.
ScalarAxis with_zoom_lock(const rerun::blueprint::components::LockRangeDuringZoom &_zoom_lock) &&
If enabled, the Y axis range will remain locked to the specified range when zooming.
Definition scalar_axis.hpp:71
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition scalar_axis.hpp:35
static constexpr auto Descriptor_range
ComponentDescriptor for the range field.
Definition scalar_axis.hpp:38
static ScalarAxis update_fields()
Update only some specific fields of a ScalarAxis.
Definition scalar_axis.hpp:55
Component: Indicate whether the range should be locked when zooming in on the data.
Definition lock_range_during_zoom.hpp:19
Component: A 1D range, specifying a lower and upper bound.
Definition range1d.hpp:15