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/store/re_types/definitions/rerun/blueprint/archetypes/scalar_axis.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/lock_range_during_zoom.hpp"
7#include "../../collection.hpp"
8#include "../../component_batch.hpp"
9#include "../../component_column.hpp"
10#include "../../components/range1d.hpp"
11#include "../../result.hpp"
12
13#include <cstdint>
14#include <optional>
15#include <utility>
16#include <vector>
17
18namespace rerun::blueprint::archetypes {
19 /// **Archetype**: Configuration for the scalar (Y) axis of a plot.
20 ///
21 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
22 ///
23 struct ScalarAxis {
24 /// The range of the axis.
25 ///
26 /// If unset, the range well be automatically determined based on the queried data.
27 std::optional<ComponentBatch> range;
28
29 /// If enabled, the Y axis range will remain locked to the specified range when zooming.
30 std::optional<ComponentBatch> zoom_lock;
31
32 public:
33 /// The name of the archetype as used in `ComponentDescriptor`s.
34 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.ScalarAxis";
35
36 /// `ComponentDescriptor` for the `range` field.
37 static constexpr auto Descriptor_range = ComponentDescriptor(
39 );
40 /// `ComponentDescriptor` for the `zoom_lock` field.
42 ArchetypeName, "ScalarAxis:zoom_lock",
44 );
45
46 public:
47 ScalarAxis() = default;
48 ScalarAxis(ScalarAxis&& other) = default;
49 ScalarAxis(const ScalarAxis& other) = default;
50 ScalarAxis& operator=(const ScalarAxis& other) = default;
51 ScalarAxis& operator=(ScalarAxis&& other) = default;
52
53 /// Update only some specific fields of a `ScalarAxis`.
55 return ScalarAxis();
56 }
57
58 /// Clear all the fields of a `ScalarAxis`.
60
61 /// The range of the axis.
62 ///
63 /// If unset, the range well be automatically determined based on the queried data.
65 range = ComponentBatch::from_loggable(_range, Descriptor_range).value_or_throw();
66 return std::move(*this);
67 }
68
69 /// If enabled, the Y axis range will remain locked to the specified range when zooming.
72 ) && {
73 zoom_lock =
74 ComponentBatch::from_loggable(_zoom_lock, Descriptor_zoom_lock).value_or_throw();
75 return std::move(*this);
76 }
77
78 /// Partitions the component data into multiple sub-batches.
79 ///
80 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
81 /// instead, via `ComponentBatch::partitioned`.
82 ///
83 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
84 ///
85 /// The specified `lengths` must sum to the total length of the component batch.
87
88 /// Partitions the component data into unit-length sub-batches.
89 ///
90 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
91 /// where `n` is automatically guessed.
93 };
94
95} // namespace rerun::blueprint::archetypes
96
97namespace rerun {
98 /// \private
99 template <typename T>
100 struct AsComponents;
101
102 /// \private
103 template <>
104 struct AsComponents<blueprint::archetypes::ScalarAxis> {
105 /// Serialize all set component batches.
106 static Result<Collection<ComponentBatch>> as_batches(
107 const blueprint::archetypes::ScalarAxis& archetype
108 );
109 };
110} // 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:23
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:23
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
ScalarAxis with_range(const rerun::components::Range1D &_range) &&
The range of the axis.
Definition scalar_axis.hpp:64
std::optional< ComponentBatch > zoom_lock
If enabled, the Y axis range will remain locked to the specified range when zooming.
Definition scalar_axis.hpp:30
static constexpr auto Descriptor_zoom_lock
ComponentDescriptor for the zoom_lock field.
Definition scalar_axis.hpp:41
std::optional< ComponentBatch > range
The range of the axis.
Definition scalar_axis.hpp:27
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:70
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition scalar_axis.hpp:34
static constexpr auto Descriptor_range
ComponentDescriptor for the range field.
Definition scalar_axis.hpp:37
static ScalarAxis update_fields()
Update only some specific fields of a ScalarAxis.
Definition scalar_axis.hpp:54
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