Rerun C++ SDK
Loading...
Searching...
No Matches
series_points.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/archetypes/series_points.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/color.hpp"
10#include "../components/marker_shape.hpp"
11#include "../components/marker_size.hpp"
12#include "../components/name.hpp"
13#include "../components/series_visible.hpp"
14#include "../result.hpp"
15
16#include <cstdint>
17#include <optional>
18#include <utility>
19#include <vector>
20
21namespace rerun::archetypes {
22 /// **Archetype**: Define the style properties for one or more point series (scatter plot) in a chart.
23 ///
24 /// This archetype only provides styling information.
25 /// Changes over time are supported for most but not all its fields (see respective fields for details),
26 /// it's generally recommended to log this type as static.
27 ///
28 /// The underlying data needs to be logged to the same entity-path using `archetypes::Scalars`.
29 /// Dimensionality of the scalar arrays logged at each time point is assumed to be the same over time.
30 ///
31 /// ## Example
32 ///
33 /// ### Point series
34 /// ![image](https://static.rerun.io/series_point_style/82207a705da6c086b28ce161db1db9e8b12258b7/full.png)
35 ///
36 /// ```cpp
37 /// #include <rerun.hpp>
38 ///
39 /// #include <cmath>
40 ///
41 /// constexpr float TAU = 6.28318530717958647692528676655900577f;
42 ///
43 /// int main() {
44 /// const auto rec = rerun::RecordingStream("rerun_example_series_point_style");
45 /// rec.spawn().exit_on_failure();
46 ///
47 /// // Set up plot styling:
48 /// // They are logged static as they don't change over time and apply to all timelines.
49 /// // Log two point series under a shared root so that they show in the same plot by default.
50 /// rec.log_static(
51 /// "trig/sin",
52 /// rerun::SeriesPoints()
53 /// .with_colors(rerun::Rgba32{255, 0, 0})
54 /// .with_names("sin(0.01t)")
55 /// .with_markers(rerun::components::MarkerShape::Circle)
56 /// .with_marker_sizes(4.0f)
57 /// );
58 /// rec.log_static(
59 /// "trig/cos",
60 /// rerun::SeriesPoints()
61 /// .with_colors(rerun::Rgba32{0, 255, 0})
62 /// .with_names("cos(0.01t)")
63 /// .with_markers(rerun::components::MarkerShape::Cross)
64 /// .with_marker_sizes(2.0f)
65 /// );
66 ///
67 /// // Log the data on a timeline called "step".
68 /// for (int t = 0; t <static_cast<int>(TAU * 2.0 * 10.0); ++t) {
69 /// rec.set_time_sequence("step", t);
70 ///
71 /// rec.log("trig/sin", rerun::Scalars(sin(static_cast<double>(t) / 10.0)));
72 /// rec.log("trig/cos", rerun::Scalars(cos(static_cast<double>(t) / 10.0)));
73 /// }
74 /// }
75 /// ```
76 struct SeriesPoints {
77 /// Color for the corresponding series.
78 ///
79 /// May change over time, but can cause discontinuities in the line.
80 std::optional<ComponentBatch> colors;
81
82 /// What shape to use to represent the point
83 ///
84 /// May change over time.
85 std::optional<ComponentBatch> markers;
86
87 /// Display name of the series.
88 ///
89 /// Used in the legend. Expected to be unchanging over time.
90 std::optional<ComponentBatch> names;
91
92 /// Which lines are visible.
93 ///
94 /// If not set, all line series on this entity are visible.
95 /// Unlike with the regular visibility property of the entire entity, any series that is hidden
96 /// via this property will still be visible in the legend.
97 ///
98 /// May change over time.
99 std::optional<ComponentBatch> visible_series;
100
101 /// Sizes of the markers.
102 ///
103 /// May change over time.
104 std::optional<ComponentBatch> marker_sizes;
105
106 public:
107 /// The name of the archetype as used in `ComponentDescriptor`s.
108 static constexpr const char ArchetypeName[] = "rerun.archetypes.SeriesPoints";
109
110 /// `ComponentDescriptor` for the `colors` field.
111 static constexpr auto Descriptor_colors = ComponentDescriptor(
113 );
114 /// `ComponentDescriptor` for the `markers` field.
116 ArchetypeName, "SeriesPoints:markers",
118 );
119 /// `ComponentDescriptor` for the `names` field.
120 static constexpr auto Descriptor_names = ComponentDescriptor(
122 );
123 /// `ComponentDescriptor` for the `visible_series` field.
125 ArchetypeName, "SeriesPoints:visible_series",
127 );
128 /// `ComponentDescriptor` for the `marker_sizes` field.
130 ArchetypeName, "SeriesPoints:marker_sizes",
132 );
133
134 public: // START of extensions from series_points_ext.cpp:
135 // Overload needed to avoid confusion with passing single strings.
136 /// Display name of the series.
137 ///
138 /// Used in the legend. Expected to be unchanging over time.
139 SeriesPoints with_names(const char* _name) && {
141 .value_or_throw();
142 return std::move(*this);
143 }
144
145 // END of extensions from series_points_ext.cpp, start of generated code:
146
147 public:
148 SeriesPoints() = default;
149 SeriesPoints(SeriesPoints&& other) = default;
150 SeriesPoints(const SeriesPoints& other) = default;
151 SeriesPoints& operator=(const SeriesPoints& other) = default;
152 SeriesPoints& operator=(SeriesPoints&& other) = default;
153
154 /// Update only some specific fields of a `SeriesPoints`.
156 return SeriesPoints();
157 }
158
159 /// Clear all the fields of a `SeriesPoints`.
161
162 /// Color for the corresponding series.
163 ///
164 /// May change over time, but can cause discontinuities in the line.
166 colors = ComponentBatch::from_loggable(_colors, Descriptor_colors).value_or_throw();
167 return std::move(*this);
168 }
169
170 /// What shape to use to represent the point
171 ///
172 /// May change over time.
174 markers = ComponentBatch::from_loggable(_markers, Descriptor_markers).value_or_throw();
175 return std::move(*this);
176 }
177
178 /// Display name of the series.
179 ///
180 /// Used in the legend. Expected to be unchanging over time.
182 names = ComponentBatch::from_loggable(_names, Descriptor_names).value_or_throw();
183 return std::move(*this);
184 }
185
186 /// Which lines are visible.
187 ///
188 /// If not set, all line series on this entity are visible.
189 /// Unlike with the regular visibility property of the entire entity, any series that is hidden
190 /// via this property will still be visible in the legend.
191 ///
192 /// May change over time.
195 ) && {
198 .value_or_throw();
199 return std::move(*this);
200 }
201
202 /// Sizes of the markers.
203 ///
204 /// May change over time.
207 ) && {
209 .value_or_throw();
210 return std::move(*this);
211 }
212
213 /// Partitions the component data into multiple sub-batches.
214 ///
215 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
216 /// instead, via `ComponentBatch::partitioned`.
217 ///
218 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
219 ///
220 /// The specified `lengths` must sum to the total length of the component batch.
222
223 /// Partitions the component data into unit-length sub-batches.
224 ///
225 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
226 /// where `n` is automatically guessed.
228 };
229
230} // namespace rerun::archetypes
231
232namespace rerun {
233 /// \private
234 template <typename T>
235 struct AsComponents;
236
237 /// \private
238 template <>
239 struct AsComponents<archetypes::SeriesPoints> {
240 /// Serialize all set component batches.
241 static Result<Collection<ComponentBatch>> as_batches(
242 const archetypes::SeriesPoints& archetype
243 );
244 };
245} // 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 built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:76
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: Define the style properties for one or more point series (scatter plot) in a chart.
Definition series_points.hpp:76
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
SeriesPoints with_visible_series(const Collection< rerun::components::SeriesVisible > &_visible_series) &&
Which lines are visible.
Definition series_points.hpp:193
static constexpr auto Descriptor_markers
ComponentDescriptor for the markers field.
Definition series_points.hpp:115
std::optional< ComponentBatch > visible_series
Which lines are visible.
Definition series_points.hpp:99
SeriesPoints with_marker_sizes(const Collection< rerun::components::MarkerSize > &_marker_sizes) &&
Sizes of the markers.
Definition series_points.hpp:205
static constexpr auto Descriptor_visible_series
ComponentDescriptor for the visible_series field.
Definition series_points.hpp:124
SeriesPoints with_names(const char *_name) &&
Display name of the series.
Definition series_points.hpp:139
static constexpr auto Descriptor_colors
ComponentDescriptor for the colors field.
Definition series_points.hpp:111
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
static SeriesPoints update_fields()
Update only some specific fields of a SeriesPoints.
Definition series_points.hpp:155
SeriesPoints with_colors(const Collection< rerun::components::Color > &_colors) &&
Color for the corresponding series.
Definition series_points.hpp:165
SeriesPoints with_names(const Collection< rerun::components::Name > &_names) &&
Display name of the series.
Definition series_points.hpp:181
std::optional< ComponentBatch > markers
What shape to use to represent the point.
Definition series_points.hpp:85
std::optional< ComponentBatch > names
Display name of the series.
Definition series_points.hpp:90
static constexpr auto Descriptor_marker_sizes
ComponentDescriptor for the marker_sizes field.
Definition series_points.hpp:129
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition series_points.hpp:108
std::optional< ComponentBatch > colors
Color for the corresponding series.
Definition series_points.hpp:80
std::optional< ComponentBatch > marker_sizes
Sizes of the markers.
Definition series_points.hpp:104
static SeriesPoints clear_fields()
Clear all the fields of a SeriesPoints.
SeriesPoints with_markers(const Collection< rerun::components::MarkerShape > &_markers) &&
What shape to use to represent the point.
Definition series_points.hpp:173
static constexpr auto Descriptor_names
ComponentDescriptor for the names field.
Definition series_points.hpp:120
Component: A display name, typically for an entity or a item like a plot series.
Definition name.hpp:16