Rerun C++ SDK
Loading...
Searching...
No Matches
status.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/archetypes/status.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/text.hpp"
10#include "../result.hpp"
11
12#include <cstdint>
13#include <optional>
14#include <utility>
15#include <vector>
16
17namespace rerun::archetypes {
18 /// **Archetype**: A status update, representing a change in the status of an entity.
19 ///
20 /// Useful for representing discrete state machines, mode transitions, or
21 /// status changes over time. Each logged `archetypes::Status` marks a new status
22 /// at the given time. A `null` status is ignored by the Status view.
23 ///
24 /// The Status view displays these as horizontal colored lanes over time.
25 ///
26 /// ## Example
27 ///
28 /// ### Status changes over time
29 /// ![image](https://static.rerun.io/status/8f224c6e4a9cbbb4b1e279c56a426ec4c6bfca50/full.png)
30 ///
31 /// ```cpp
32 /// #include <rerun.hpp>
33 ///
34 /// int main(int argc, char* argv[]) {
35 /// const auto rec = rerun::RecordingStream("rerun_example_status");
36 /// rec.spawn().exit_on_failure();
37 ///
38 /// rec.set_time_sequence("step", 0);
39 /// rec.log("door", rerun::Status().with_status("open"));
40 ///
41 /// rec.set_time_sequence("step", 1);
42 /// rec.log("door", rerun::Status().with_status("closed"));
43 ///
44 /// rec.set_time_sequence("step", 2);
45 /// rec.log("door", rerun::Status().with_status("open"));
46 /// }
47 /// ```
48 ///
49 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
50 ///
51 struct Status {
52 /// The new status value. A `null` status is ignored, it can be used to partially update a multi-instance status array.
53 std::optional<ComponentBatch> status;
54
55 public:
56 /// The name of the archetype as used in `ComponentDescriptor`s.
57 static constexpr const char ArchetypeName[] = "rerun.archetypes.Status";
58
59 /// `ComponentDescriptor` for the `status` field.
60 static constexpr auto Descriptor_status = ComponentDescriptor(
62 );
63
64 public:
65 Status() = default;
66 Status(Status&& other) = default;
67 Status(const Status& other) = default;
68 Status& operator=(const Status& other) = default;
69 Status& operator=(Status&& other) = default;
70
71 /// Update only some specific fields of a `Status`.
73 return Status();
74 }
75
76 /// Clear all the fields of a `Status`.
78
79 /// The new status value. A `null` status is ignored, it can be used to partially update a multi-instance status array.
81 status = ComponentBatch::from_loggable(_status, Descriptor_status).value_or_throw();
82 return std::move(*this);
83 }
84
85 /// This method makes it possible to pack multiple `status` in a single component batch.
86 ///
87 /// This only makes sense when used in conjunction with `columns`. `with_status` should
88 /// be used when logging a single row's worth of data.
90 status = ComponentBatch::from_loggable(_status, Descriptor_status).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::archetypes
112
113namespace rerun {
114 /// \private
115 template <typename T>
116 struct AsComponents;
117
118 /// \private
119 template <>
120 struct AsComponents<archetypes::Status> {
121 /// Serialize all set component batches.
122 static Result<Collection<ComponentBatch>> as_batches(const archetypes::Status& archetype);
123 };
124} // 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:81
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: A status update, representing a change in the status of an entity.
Definition status.hpp:51
static Status update_fields()
Update only some specific fields of a Status.
Definition status.hpp:72
std::optional< ComponentBatch > status
The new status value. A null status is ignored, it can be used to partially update a multi-instance s...
Definition status.hpp:53
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Status with_many_status(const Collection< rerun::components::Text > &_status) &&
This method makes it possible to pack multiple status in a single component batch.
Definition status.hpp:89
Status with_status(const rerun::components::Text &_status) &&
The new status value. A null status is ignored, it can be used to partially update a multi-instance s...
Definition status.hpp:80
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition status.hpp:57
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
static Status clear_fields()
Clear all the fields of a Status.
static constexpr auto Descriptor_status
ComponentDescriptor for the status field.
Definition status.hpp:60
Component: A string of text, e.g. for labels and text documents.
Definition text.hpp:16