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 "../../indicator_component.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 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 static constexpr const char IndicatorComponentName[] =
35 "rerun.blueprint.components.ScalarAxisIndicator";
36
37 /// Indicator component, used to identify the archetype when converting to a list of components.
39 /// The name of the archetype as used in `ComponentDescriptor`s.
40 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.ScalarAxis";
41
42 /// `ComponentDescriptor` for the `range` field.
43 static constexpr auto Descriptor_range = ComponentDescriptor(
45 );
46 /// `ComponentDescriptor` for the `zoom_lock` field.
48 ArchetypeName, "zoom_lock",
50 );
51
52 public:
53 ScalarAxis() = default;
54 ScalarAxis(ScalarAxis&& other) = default;
55 ScalarAxis(const ScalarAxis& other) = default;
56 ScalarAxis& operator=(const ScalarAxis& other) = default;
57 ScalarAxis& operator=(ScalarAxis&& other) = default;
58
59 /// Update only some specific fields of a `ScalarAxis`.
61 return ScalarAxis();
62 }
63
64 /// Clear all the fields of a `ScalarAxis`.
66
67 /// The range of the axis.
68 ///
69 /// If unset, the range well be automatically determined based on the queried data.
71 range = ComponentBatch::from_loggable(_range, Descriptor_range).value_or_throw();
72 return std::move(*this);
73 }
74
75 /// If enabled, the Y axis range will remain locked to the specified range when zooming.
78 ) && {
79 zoom_lock =
80 ComponentBatch::from_loggable(_zoom_lock, Descriptor_zoom_lock).value_or_throw();
81 return std::move(*this);
82 }
83
84 /// Partitions the component data into multiple sub-batches.
85 ///
86 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
87 /// instead, via `ComponentBatch::partitioned`.
88 ///
89 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
90 ///
91 /// The specified `lengths` must sum to the total length of the component batch.
93
94 /// Partitions the component data into unit-length sub-batches.
95 ///
96 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
97 /// where `n` is automatically guessed.
99 };
100
101} // namespace rerun::blueprint::archetypes
102
103namespace rerun {
104 /// \private
105 template <typename T>
106 struct AsComponents;
107
108 /// \private
109 template <>
110 struct AsComponents<blueprint::archetypes::ScalarAxis> {
111 /// Serialize all set component batches.
112 static Result<Collection<ComponentBatch>> as_batches(
113 const blueprint::archetypes::ScalarAxis& archetype
114 );
115 };
116} // 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=rerun::Loggable< T >::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:14
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 axis of a plot.
Definition scalar_axis.hpp:24
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:70
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:47
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:76
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition scalar_axis.hpp:40
static constexpr auto Descriptor_range
ComponentDescriptor for the range field.
Definition scalar_axis.hpp:43
static ScalarAxis update_fields()
Update only some specific fields of a ScalarAxis.
Definition scalar_axis.hpp:60
Component: Indicate whether the range should be locked when zooming in on the data.
Definition lock_range_during_zoom.hpp:20
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:32
Component: A 1D range, specifying a lower and upper bound.
Definition range1d.hpp:16