Rerun C++ SDK
Loading...
Searching...
No Matches
recording_info.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/archetypes/recording_info.def.rs".
3
4#pragma once
5
6#include "../archetype_utils.hpp"
7#include "../collection.hpp"
8#include "../component_batch.hpp"
9#include "../component_column.hpp"
10#include "../components/name.hpp"
11#include "../components/timestamp.hpp"
12#include "../result.hpp"
13
14#include <cstdint>
15#include <optional>
16#include <utility>
17#include <vector>
18
19namespace rerun::archetypes {
20 /// **Archetype**: A list of properties associated with a recording.
22 /// When the recording started.
23 ///
24 /// Should be an absolute time, i.e. relative to Unix Epoch.
25 std::optional<ComponentBatch> start_time;
26
27 /// A user-chosen name for the recording.
28 std::optional<ComponentBatch> name;
29
30 public:
31 /// The name of the archetype as used in `ComponentDescriptor`s.
32 static constexpr const char ArchetypeName[] = "rerun.archetypes.RecordingInfo";
33
34 /// `ComponentDescriptor` for the `start_time` field.
36 ArchetypeName, "RecordingInfo:start_time",
38 );
39 /// `ComponentDescriptor` for the `name` field.
40 static constexpr auto Descriptor_name = ComponentDescriptor(
42 );
43
44 public:
45 RecordingInfo() = default;
46 RecordingInfo(RecordingInfo&& other) = default;
47 RecordingInfo(const RecordingInfo& other) = default;
48 RecordingInfo& operator=(const RecordingInfo& other) = default;
49 RecordingInfo& operator=(RecordingInfo&& other) = default;
50
51 /// Update only some specific fields of a `RecordingInfo`.
53 return RecordingInfo();
54 }
55
56 /// Clear all the fields of a `RecordingInfo`.
58
59 /// When the recording started.
60 ///
61 /// Should be an absolute time, i.e. relative to Unix Epoch.
64 ComponentBatch::from_loggable(_start_time, Descriptor_start_time).value_or_throw();
65 return std::move(*this);
66 }
67
68 /// This method makes it possible to pack multiple `start_time` in a single component batch.
69 ///
70 /// This only makes sense when used in conjunction with `columns`. `with_start_time` should
71 /// be used when logging a single row's worth of data.
74 ) && {
76 ComponentBatch::from_loggable(_start_time, Descriptor_start_time).value_or_throw();
77 return std::move(*this);
78 }
79
80 /// A user-chosen name for the recording.
82 name = ComponentBatch::from_loggable(_name, Descriptor_name).value_or_throw();
83 return std::move(*this);
84 }
85
86 /// This method makes it possible to pack multiple `name` in a single component batch.
87 ///
88 /// This only makes sense when used in conjunction with `columns`. `with_name` should
89 /// be used when logging a single row's worth of data.
91 name = ComponentBatch::from_loggable(_name, Descriptor_name).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({&start_time, &name}, lengths_).value_or_throw();
105 }
106
107 /// Partitions the component data into unit-length sub-batches.
108 ///
109 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
110 /// where `n` is automatically guessed.
112 return detail::partition_batches_of_unit_length({&start_time, &name}).value_or_throw();
113 }
114 };
115
116} // namespace rerun::archetypes
117
118namespace rerun {
119 /// \private
120 template <typename T>
121 struct AsComponents;
122
123 /// \private
124 template <>
125 struct AsComponents<archetypes::RecordingInfo> {
126 /// Serialize all set component batches.
127 static Result<Collection<ComponentBatch>> as_batches(
128 const archetypes::RecordingInfo& archetype
129 ) {
130 return detail::collect_batches({&archetype.start_time, &archetype.name});
131 }
132 };
133} // namespace rerun
Generic collection of elements that are roughly contiguous in memory.
Definition collection.hpp:49
All built-in archetypes. See Types in the Rerun manual.
Definition rerun.hpp:90
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: A list of properties associated with a recording.
Definition recording_info.hpp:21
static constexpr auto Descriptor_name
ComponentDescriptor for the name field.
Definition recording_info.hpp:40
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition recording_info.hpp:111
RecordingInfo with_name(const rerun::components::Name &_name) &&
A user-chosen name for the recording.
Definition recording_info.hpp:81
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition recording_info.hpp:103
static constexpr auto Descriptor_start_time
ComponentDescriptor for the start_time field.
Definition recording_info.hpp:35
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition recording_info.hpp:32
RecordingInfo with_many_name(const Collection< rerun::components::Name > &_name) &&
This method makes it possible to pack multiple name in a single component batch.
Definition recording_info.hpp:90
static RecordingInfo update_fields()
Update only some specific fields of a RecordingInfo.
Definition recording_info.hpp:52
std::optional< ComponentBatch > start_time
When the recording started.
Definition recording_info.hpp:25
std::optional< ComponentBatch > name
A user-chosen name for the recording.
Definition recording_info.hpp:28
static RecordingInfo clear_fields()
Clear all the fields of a RecordingInfo.
RecordingInfo with_start_time(const rerun::components::Timestamp &_start_time) &&
When the recording started.
Definition recording_info.hpp:62
RecordingInfo with_many_start_time(const Collection< rerun::components::Timestamp > &_start_time) &&
This method makes it possible to pack multiple start_time in a single component batch.
Definition recording_info.hpp:72
Component: A display name, typically for an entity or a item like a plot series.
Definition name.hpp:19
Component: When the recording started.
Definition timestamp.hpp:16