Rerun C++ SDK
Loading...
Searching...
No Matches
time_series_scalar.hpp
1// DO NOT EDIT! This file was auto-generated by crates/re_types_builder/src/codegen/cpp/mod.rs
2// Based on "crates/re_types/definitions/rerun/archetypes/time_series_scalar.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../compiler_utils.hpp"
8#include "../components/color.hpp"
9#include "../components/radius.hpp"
10#include "../components/scalar.hpp"
11#include "../components/scalar_scattering.hpp"
12#include "../components/text.hpp"
13#include "../data_cell.hpp"
14#include "../indicator_component.hpp"
15#include "../result.hpp"
16
17#include <cstdint>
18#include <optional>
19#include <utility>
20#include <vector>
21
22namespace rerun::archetypes {
23 /// **Archetype**: Log a double-precision scalar that will be visualized as a time-series plot.
24 ///
25 /// The current simulation time will be used for the time/X-axis, hence scalars
26 /// cannot be timeless!
27 ///
28 /// ## Example
29 ///
30 /// ### Simple line plot
31 /// ![image](https://static.rerun.io/scalar_simple/8bcc92f56268739f8cd24d60d1fe72a655f62a46/full.png)
32 ///
33 /// ```cpp
34 /// #include <rerun.hpp>
35 ///
36 /// #include <cmath>
37 ///
38 /// int main() {
39 /// const auto rec = rerun::RecordingStream("rerun_example_scalar");
40 /// rec.spawn().exit_on_failure();
41 ///
42 /// for (int step = 0; step <64; ++step) {
43 /// rec.set_time_sequence("step", step);
44 /// rec.log("scalar", rerun::TimeSeriesScalar(std::sin(static_cast<double>(step) / 10.0)));
45 /// }
46 /// }
47 /// ```
49 /// The scalar value to log.
51
52 /// An optional radius for the point.
53 ///
54 /// Points within a single line do not have to share the same radius, the line
55 /// will have differently sized segments as appropriate.
56 ///
57 /// If all points within a single entity path (i.e. a line) share the same
58 /// radius, then this radius will be used as the line width too. Otherwise, the
59 /// line will use the default width of `1.0`.
60 std::optional<rerun::components::Radius> radius;
61
62 /// Optional color for the scalar entry.
63 ///
64 /// If left unspecified, a pseudo-random color will be used instead. That
65 /// same color will apply to all points residing in the same entity path
66 /// that don't have a color specified.
67 ///
68 /// Points within a single line do not have to share the same color, the line
69 /// will have differently colored segments as appropriate.
70 /// If all points within a single entity path (i.e. a line) share the same
71 /// color, then this color will be used as the line color in the plot legend.
72 /// Otherwise, the line will appear gray in the legend.
73 std::optional<rerun::components::Color> color;
74
75 /// An optional label for the point.
76 ///
77 /// TODO(#1289): This won't show up on points at the moment, as our plots don't yet
78 /// support displaying labels for individual points.
79 /// If all points within a single entity path (i.e. a line) share the same label, then
80 /// this label will be used as the label for the line itself. Otherwise, the
81 /// line will be named after the entity path. The plot itself is named after
82 /// the space it's in.
83 std::optional<rerun::components::Text> label;
84
85 /// Specifies whether a point in a scatter plot should form a continuous line.
86 ///
87 /// If set to true, this scalar will be drawn as a point, akin to a scatterplot.
88 /// Otherwise, it will form a continuous line with its neighbors.
89 /// Points within a single line do not have to all share the same scatteredness:
90 /// the line will switch between a scattered and a continuous representation as
91 /// required.
92 std::optional<rerun::components::ScalarScattering> scattered;
93
94 public:
95 static constexpr const char IndicatorComponentName[] =
96 "rerun.components.TimeSeriesScalarIndicator";
97
98 /// Indicator component, used to identify the archetype when converting to a list of components.
100
101 public:
102 TimeSeriesScalar() = default;
103 TimeSeriesScalar(TimeSeriesScalar&& other) = default;
104
105 explicit TimeSeriesScalar(rerun::components::Scalar _scalar) : scalar(std::move(_scalar)) {}
106
107 /// An optional radius for the point.
108 ///
109 /// Points within a single line do not have to share the same radius, the line
110 /// will have differently sized segments as appropriate.
111 ///
112 /// If all points within a single entity path (i.e. a line) share the same
113 /// radius, then this radius will be used as the line width too. Otherwise, the
114 /// line will use the default width of `1.0`.
116 radius = std::move(_radius);
117 // See: https://github.com/rerun-io/rerun/issues/4027
118 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
119 }
120
121 /// Optional color for the scalar entry.
122 ///
123 /// If left unspecified, a pseudo-random color will be used instead. That
124 /// same color will apply to all points residing in the same entity path
125 /// that don't have a color specified.
126 ///
127 /// Points within a single line do not have to share the same color, the line
128 /// will have differently colored segments as appropriate.
129 /// If all points within a single entity path (i.e. a line) share the same
130 /// color, then this color will be used as the line color in the plot legend.
131 /// Otherwise, the line will appear gray in the legend.
133 color = std::move(_color);
134 // See: https://github.com/rerun-io/rerun/issues/4027
135 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
136 }
137
138 /// An optional label for the point.
139 ///
140 /// TODO(#1289): This won't show up on points at the moment, as our plots don't yet
141 /// support displaying labels for individual points.
142 /// If all points within a single entity path (i.e. a line) share the same label, then
143 /// this label will be used as the label for the line itself. Otherwise, the
144 /// line will be named after the entity path. The plot itself is named after
145 /// the space it's in.
147 label = std::move(_label);
148 // See: https://github.com/rerun-io/rerun/issues/4027
149 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
150 }
151
152 /// Specifies whether a point in a scatter plot should form a continuous line.
153 ///
154 /// If set to true, this scalar will be drawn as a point, akin to a scatterplot.
155 /// Otherwise, it will form a continuous line with its neighbors.
156 /// Points within a single line do not have to all share the same scatteredness:
157 /// the line will switch between a scattered and a continuous representation as
158 /// required.
160 scattered = std::move(_scattered);
161 // See: https://github.com/rerun-io/rerun/issues/4027
162 RERUN_WITH_MAYBE_UNINITIALIZED_DISABLED(return std::move(*this);)
163 }
164
165 /// Returns the number of primary instances of this archetype.
166 size_t num_instances() const {
167 return 1;
168 }
169 };
170
171} // namespace rerun::archetypes
172
173namespace rerun {
174 /// \private
175 template <typename T>
176 struct AsComponents;
177
178 /// \private
179 template <>
180 struct AsComponents<archetypes::TimeSeriesScalar> {
181 /// Serialize all set component batches.
182 static Result<std::vector<DataCell>> serialize(const archetypes::TimeSeriesScalar& archetype
183 );
184 };
185} // namespace rerun
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:66
All Rerun C++ types and functions are in the rerun namespace or one of its nested namespaces.
Definition rerun.hpp:20
Archetype: Log a double-precision scalar that will be visualized as a time-series plot.
Definition time_series_scalar.hpp:48
std::optional< rerun::components::Text > label
An optional label for the point.
Definition time_series_scalar.hpp:83
TimeSeriesScalar with_label(rerun::components::Text _label) &&
An optional label for the point.
Definition time_series_scalar.hpp:146
TimeSeriesScalar with_radius(rerun::components::Radius _radius) &&
An optional radius for the point.
Definition time_series_scalar.hpp:115
std::optional< rerun::components::ScalarScattering > scattered
Specifies whether a point in a scatter plot should form a continuous line.
Definition time_series_scalar.hpp:92
rerun::components::Scalar scalar
The scalar value to log.
Definition time_series_scalar.hpp:50
TimeSeriesScalar with_color(rerun::components::Color _color) &&
Optional color for the scalar entry.
Definition time_series_scalar.hpp:132
std::optional< rerun::components::Radius > radius
An optional radius for the point.
Definition time_series_scalar.hpp:60
TimeSeriesScalar with_scattered(rerun::components::ScalarScattering _scattered) &&
Specifies whether a point in a scatter plot should form a continuous line.
Definition time_series_scalar.hpp:159
std::optional< rerun::components::Color > color
Optional color for the scalar entry.
Definition time_series_scalar.hpp:73
size_t num_instances() const
Returns the number of primary instances of this archetype.
Definition time_series_scalar.hpp:166
Component: An RGBA color with unmultiplied/separate alpha, in sRGB gamma space with linear alpha.
Definition color.hpp:28
Indicator component used by archetypes when converting them to component lists.
Definition indicator_component.hpp:23
Component: A Radius component.
Definition radius.hpp:24
Component: If true, a scalar will be shown as individual point in a scatter plot.
Definition scalar_scattering.hpp:19
Component: A double-precision scalar.
Definition scalar.hpp:26
Component: A string of text, e.g. for labels and text documents.
Definition text.hpp:22