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/build/re_type_definitions/rerun/blueprint/archetypes/time_axis.def.rs".
3
4#pragma once
5
6#include "../../archetype_utils.hpp"
7#include "../../blueprint/components/link_axis.hpp"
8#include "../../blueprint/components/lock_range_during_zoom.hpp"
9#include "../../blueprint/components/time_range.hpp"
10#include "../../collection.hpp"
11#include "../../component_batch.hpp"
12#include "../../component_column.hpp"
13#include "../../result.hpp"
14
15#include <cstdint>
16#include <optional>
17#include <utility>
18#include <vector>
19
20namespace rerun::blueprint::archetypes {
21 /// **Archetype**: Configuration for the horizontal time axis of time series and state timeline views.
22 ///
23 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
24 ///
25 struct TimeAxis {
26 /// How should the horizontal time axis be linked across multiple views?
27 ///
28 /// Linking with global uses the shared global view range instead of this view's `view_range`.
29 std::optional<ComponentBatch> link;
30
31 /// The view range of the horizontal/X/time axis.
32 std::optional<ComponentBatch> view_range;
33
34 /// If enabled, the X axis range will remain locked to the specified range when zooming.
35 std::optional<ComponentBatch> zoom_lock;
36
37 public:
38 /// The name of the archetype as used in `ComponentDescriptor`s.
39 static constexpr const char ArchetypeName[] = "rerun.blueprint.archetypes.TimeAxis";
40
41 /// `ComponentDescriptor` for the `link` field.
42 static constexpr auto Descriptor_link = ComponentDescriptor(
43 ArchetypeName, "TimeAxis:link",
45 );
46 /// `ComponentDescriptor` for the `view_range` field.
48 ArchetypeName, "TimeAxis:view_range",
50 );
51 /// `ComponentDescriptor` for the `zoom_lock` field.
53 ArchetypeName, "TimeAxis:zoom_lock",
55 );
56
57 public:
58 TimeAxis() = default;
59 TimeAxis(TimeAxis&& other) = default;
60 TimeAxis(const TimeAxis& other) = default;
61 TimeAxis& operator=(const TimeAxis& other) = default;
62 TimeAxis& operator=(TimeAxis&& other) = default;
63
64 /// Update only some specific fields of a `TimeAxis`.
66 return TimeAxis();
67 }
68
69 /// Clear all the fields of a `TimeAxis`.
71
72 /// How should the horizontal time axis be linked across multiple views?
73 ///
74 /// Linking with global uses the shared global view range instead of this view's `view_range`.
75 TimeAxis with_link(const rerun::blueprint::components::LinkAxis& _link) && {
76 link = ComponentBatch::from_loggable(_link, Descriptor_link).value_or_throw();
77 return std::move(*this);
78 }
79
80 /// The view range of the horizontal/X/time axis.
83 ComponentBatch::from_loggable(_view_range, Descriptor_view_range).value_or_throw();
84 return std::move(*this);
85 }
86
87 /// If enabled, the X axis range will remain locked to the specified range when zooming.
89 ) && {
90 zoom_lock =
91 ComponentBatch::from_loggable(_zoom_lock, Descriptor_zoom_lock).value_or_throw();
92 return std::move(*this);
93 }
94
95 /// Partitions the component data into multiple sub-batches.
96 ///
97 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
98 /// instead, via `ComponentBatch::partitioned`.
99 ///
100 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
101 ///
102 /// The specified `lengths` must sum to the total length of the component batch.
104 return detail::partition_batches({&link, &view_range, &zoom_lock}, lengths_)
105 .value_or_throw();
106 }
107
108 /// Partitions the component data into unit-length sub-batches.
109 ///
110 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
111 /// where `n` is automatically guessed.
113 return detail::partition_batches_of_unit_length({&link, &view_range, &zoom_lock})
114 .value_or_throw();
115 }
116 };
117
118} // namespace rerun::blueprint::archetypes
119
120namespace rerun {
121 /// \private
122 template <typename T>
123 struct AsComponents;
124
125 /// \private
126 template <>
127 struct AsComponents<blueprint::archetypes::TimeAxis> {
128 /// Serialize all set component batches.
129 static Result<Collection<ComponentBatch>> as_batches(
130 const blueprint::archetypes::TimeAxis& archetype
131 ) {
132 return detail::collect_batches(
133 {&archetype.link, &archetype.view_range, &archetype.zoom_lock}
134 );
135 }
136 };
137} // 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 horizontal time axis of time series and state timeline views.
Definition time_axis.hpp:25
static TimeAxis update_fields()
Update only some specific fields of a TimeAxis.
Definition time_axis.hpp:65
TimeAxis with_link(const rerun::blueprint::components::LinkAxis &_link) &&
How should the horizontal time axis be linked across multiple views?
Definition time_axis.hpp:75
static constexpr auto Descriptor_view_range
ComponentDescriptor for the view_range field.
Definition time_axis.hpp:47
static constexpr auto Descriptor_zoom_lock
ComponentDescriptor for the zoom_lock field.
Definition time_axis.hpp:52
std::optional< ComponentBatch > zoom_lock
If enabled, the X axis range will remain locked to the specified range when zooming.
Definition time_axis.hpp:35
std::optional< ComponentBatch > link
How should the horizontal time axis be linked across multiple views?
Definition time_axis.hpp:29
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:88
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition time_axis.hpp:112
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition time_axis.hpp:103
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:39
TimeAxis with_view_range(const rerun::blueprint::components::TimeRange &_view_range) &&
The view range of the horizontal/X/time axis.
Definition time_axis.hpp:81
static constexpr auto Descriptor_link
ComponentDescriptor for the link field.
Definition time_axis.hpp:42
std::optional< ComponentBatch > view_range
The view range of the horizontal/X/time axis.
Definition time_axis.hpp:32
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