Rerun C++ SDK
Loading...
Searching...
No Matches
time_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_sdk_types/definitions/rerun/blueprint/archetypes/time_axis.fbs".
3
4#pragma once
5
6#include "../../blueprint/components/link_axis.hpp"
7#include "../../blueprint/components/lock_range_during_zoom.hpp"
8#include "../../blueprint/components/time_range.hpp"
9#include "../../collection.hpp"
10#include "../../component_batch.hpp"
11#include "../../component_column.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 time (X) 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 TimeAxis {
25 /// How should the horizontal/X/time axis be linked across multiple plots?
26 ///
27 /// Linking with global will ignore `view_range`.
28 std::optional<ComponentBatch> link;
29
30 /// The view range of the horizontal/X/time axis.
31 std::optional<ComponentBatch> view_range;
32
33 /// If enabled, the X axis range will remain locked to the specified range when zooming.
34 std::optional<ComponentBatch> zoom_lock;
35
36 public:
37 /// The name of the archetype as used in `ComponentDescriptor`s.
38 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.TimeAxis";
39
40 /// `ComponentDescriptor` for the `link` field.
41 static constexpr auto Descriptor_link = ComponentDescriptor(
42 ArchetypeName, "TimeAxis:link",
44 );
45 /// `ComponentDescriptor` for the `view_range` field.
47 ArchetypeName, "TimeAxis:view_range",
49 );
50 /// `ComponentDescriptor` for the `zoom_lock` field.
52 ArchetypeName, "TimeAxis:zoom_lock",
54 );
55
56 public:
57 TimeAxis() = default;
58 TimeAxis(TimeAxis&& other) = default;
59 TimeAxis(const TimeAxis& other) = default;
60 TimeAxis& operator=(const TimeAxis& other) = default;
61 TimeAxis& operator=(TimeAxis&& other) = default;
62
63 /// Update only some specific fields of a `TimeAxis`.
65 return TimeAxis();
66 }
67
68 /// Clear all the fields of a `TimeAxis`.
70
71 /// How should the horizontal/X/time axis be linked across multiple plots?
72 ///
73 /// Linking with global will ignore `view_range`.
74 TimeAxis with_link(const rerun::blueprint::components::LinkAxis& _link) && {
75 link = ComponentBatch::from_loggable(_link, Descriptor_link).value_or_throw();
76 return std::move(*this);
77 }
78
79 /// The view range of the horizontal/X/time axis.
82 ComponentBatch::from_loggable(_view_range, Descriptor_view_range).value_or_throw();
83 return std::move(*this);
84 }
85
86 /// If enabled, the X axis range will remain locked to the specified range when zooming.
88 ) && {
89 zoom_lock =
90 ComponentBatch::from_loggable(_zoom_lock, Descriptor_zoom_lock).value_or_throw();
91 return std::move(*this);
92 }
93
94 /// Partitions the component data into multiple sub-batches.
95 ///
96 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
97 /// instead, via `ComponentBatch::partitioned`.
98 ///
99 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
100 ///
101 /// The specified `lengths` must sum to the total length of the component batch.
103
104 /// Partitions the component data into unit-length sub-batches.
105 ///
106 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
107 /// where `n` is automatically guessed.
109 };
110
111} // namespace rerun::blueprint::archetypes
112
113namespace rerun {
114 /// \private
115 template <typename T>
116 struct AsComponents;
117
118 /// \private
119 template <>
120 struct AsComponents<blueprint::archetypes::TimeAxis> {
121 /// Serialize all set component batches.
122 static Result<Collection<ComponentBatch>> as_batches(
123 const blueprint::archetypes::TimeAxis& archetype
124 );
125 };
126} // 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 time (X) axis of a plot.
Definition time_axis.hpp:24
static TimeAxis update_fields()
Update only some specific fields of a TimeAxis.
Definition time_axis.hpp:64
TimeAxis with_link(const rerun::blueprint::components::LinkAxis &_link) &&
How should the horizontal/X/time axis be linked across multiple plots?
Definition time_axis.hpp:74
static constexpr auto Descriptor_view_range
ComponentDescriptor for the view_range field.
Definition time_axis.hpp:46
static constexpr auto Descriptor_zoom_lock
ComponentDescriptor for the zoom_lock field.
Definition time_axis.hpp:51
std::optional< ComponentBatch > zoom_lock
If enabled, the X axis range will remain locked to the specified range when zooming.
Definition time_axis.hpp:34
std::optional< ComponentBatch > link
How should the horizontal/X/time axis be linked across multiple plots?
Definition time_axis.hpp:28
TimeAxis with_zoom_lock(const rerun::blueprint::components::LockRangeDuringZoom &_zoom_lock) &&
If enabled, the X axis range will remain locked to the specified range when zooming.
Definition time_axis.hpp:87
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.
static TimeAxis clear_fields()
Clear all the fields of a TimeAxis.
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition time_axis.hpp:38
TimeAxis with_view_range(const rerun::blueprint::components::TimeRange &_view_range) &&
The view range of the horizontal/X/time axis.
Definition time_axis.hpp:80
static constexpr auto Descriptor_link
ComponentDescriptor for the link field.
Definition time_axis.hpp:41
std::optional< ComponentBatch > view_range
The view range of the horizontal/X/time axis.
Definition time_axis.hpp:31
Component: Indicate whether the range should be locked when zooming in on the data.
Definition lock_range_during_zoom.hpp:19
Component: A time range on an unspecified timeline using either relative or absolute boundaries.
Definition time_range.hpp:17