Rerun C++ SDK
Loading...
Searching...
No Matches
mcap_statistics.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/mcap_statistics.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/channel_message_counts.hpp"
11#include "../components/count.hpp"
12#include "../components/timestamp.hpp"
13#include "../result.hpp"
14
15#include <cstdint>
16#include <optional>
17#include <utility>
18#include <vector>
19
20namespace rerun::archetypes {
21 /// **Archetype**: Recording-level statistics about an MCAP file.
22 ///
23 /// This archetype contains summary information about an entire MCAP recording, including
24 /// counts of messages, schemas, channels, and other records, as well as timing information
25 /// spanning the full recording duration. It is typically logged once per recording to provide
26 /// an overview of the dataset's structure and content.
27 ///
28 /// See also `archetypes::McapChannel` for individual channel definitions,
29 /// `archetypes::McapMessage` for message content, `archetypes::McapSchema` for schema definitions,
30 /// and the [MCAP specification](https://mcap.dev/) for complete format details.
31 ///
32 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
33 ///
35 /// Total number of data messages contained in the MCAP recording.
36 ///
37 /// This count includes all timestamped data messages but excludes metadata records,
38 /// schema definitions, and other non-message records.
39 std::optional<ComponentBatch> message_count;
40
41 /// Number of unique schema definitions in the recording.
42 ///
43 /// Each schema defines the structure for one or more message types used by channels.
44 std::optional<ComponentBatch> schema_count;
45
46 /// Number of channels defined in the recording.
47 ///
48 /// Each channel represents a unique topic and encoding combination for publishing messages.
49 std::optional<ComponentBatch> channel_count;
50
51 /// Number of file attachments embedded in the recording.
52 ///
53 /// Attachments can include calibration files, configuration data, or other auxiliary files.
54 std::optional<ComponentBatch> attachment_count;
55
56 /// Number of metadata records providing additional context about the recording.
57 ///
58 /// Metadata records contain key-value pairs with information about the recording environment,
59 /// system configuration, or other contextual data.
60 std::optional<ComponentBatch> metadata_count;
61
62 /// Number of data chunks used to organize messages in the file.
63 ///
64 /// Chunks group related messages together for efficient storage and indexed access.
65 std::optional<ComponentBatch> chunk_count;
66
67 /// Timestamp of the earliest message in the recording.
68 ///
69 /// This marks the beginning of the recorded data timeline.
70 std::optional<ComponentBatch> message_start_time;
71
72 /// Timestamp of the latest message in the recording.
73 ///
74 /// Together with `message_start_time`, this defines the total duration of the recording.
75 std::optional<ComponentBatch> message_end_time;
76
77 /// Detailed breakdown of message counts per channel.
78 std::optional<ComponentBatch> channel_message_counts;
79
80 public:
81 /// The name of the archetype as used in `ComponentDescriptor`s.
82 static constexpr const char ArchetypeName[] = "rerun.archetypes.McapStatistics";
83
84 /// `ComponentDescriptor` for the `message_count` field.
86 ArchetypeName, "McapStatistics:message_count",
88 );
89 /// `ComponentDescriptor` for the `schema_count` field.
91 ArchetypeName, "McapStatistics:schema_count",
93 );
94 /// `ComponentDescriptor` for the `channel_count` field.
96 ArchetypeName, "McapStatistics:channel_count",
98 );
99 /// `ComponentDescriptor` for the `attachment_count` field.
101 ArchetypeName, "McapStatistics:attachment_count",
103 );
104 /// `ComponentDescriptor` for the `metadata_count` field.
106 ArchetypeName, "McapStatistics:metadata_count",
108 );
109 /// `ComponentDescriptor` for the `chunk_count` field.
111 ArchetypeName, "McapStatistics:chunk_count",
113 );
114 /// `ComponentDescriptor` for the `message_start_time` field.
116 ArchetypeName, "McapStatistics:message_start_time",
118 );
119 /// `ComponentDescriptor` for the `message_end_time` field.
121 ArchetypeName, "McapStatistics:message_end_time",
123 );
124 /// `ComponentDescriptor` for the `channel_message_counts` field.
126 ArchetypeName, "McapStatistics:channel_message_counts",
128 );
129
130 public:
131 McapStatistics() = default;
132 McapStatistics(McapStatistics&& other) = default;
133 McapStatistics(const McapStatistics& other) = default;
134 McapStatistics& operator=(const McapStatistics& other) = default;
135 McapStatistics& operator=(McapStatistics&& other) = default;
136
137 explicit McapStatistics(
138 rerun::components::Count _message_count, rerun::components::Count _schema_count,
139 rerun::components::Count _channel_count, rerun::components::Count _attachment_count,
140 rerun::components::Count _metadata_count, rerun::components::Count _chunk_count,
141 rerun::components::Timestamp _message_start_time,
142 rerun::components::Timestamp _message_end_time
143 )
145 ComponentBatch::from_loggable(std::move(_message_count), Descriptor_message_count)
146 .value_or_throw()
147 ),
149 ComponentBatch::from_loggable(std::move(_schema_count), Descriptor_schema_count)
150 .value_or_throw()
151 ),
153 ComponentBatch::from_loggable(std::move(_channel_count), Descriptor_channel_count)
154 .value_or_throw()
155 ),
156 attachment_count(ComponentBatch::from_loggable(
157 std::move(_attachment_count), Descriptor_attachment_count
158 )
159 .value_or_throw()),
160 metadata_count(ComponentBatch::from_loggable(
161 std::move(_metadata_count), Descriptor_metadata_count
162 )
163 .value_or_throw()),
165 ComponentBatch::from_loggable(std::move(_chunk_count), Descriptor_chunk_count)
166 .value_or_throw()
167 ),
168 message_start_time(ComponentBatch::from_loggable(
169 std::move(_message_start_time), Descriptor_message_start_time
170 )
171 .value_or_throw()),
172 message_end_time(ComponentBatch::from_loggable(
173 std::move(_message_end_time), Descriptor_message_end_time
174 )
175 .value_or_throw()) {}
176
177 /// Update only some specific fields of a `McapStatistics`.
179 return McapStatistics();
180 }
181
182 /// Clear all the fields of a `McapStatistics`.
184
185 /// Total number of data messages contained in the MCAP recording.
186 ///
187 /// This count includes all timestamped data messages but excludes metadata records,
188 /// schema definitions, and other non-message records.
191 .value_or_throw();
192 return std::move(*this);
193 }
194
195 /// This method makes it possible to pack multiple `message_count` in a single component batch.
196 ///
197 /// This only makes sense when used in conjunction with `columns`. `with_message_count` should
198 /// be used when logging a single row's worth of data.
200 const Collection<rerun::components::Count>& _message_count
201 ) && {
203 .value_or_throw();
204 return std::move(*this);
205 }
206
207 /// Number of unique schema definitions in the recording.
208 ///
209 /// Each schema defines the structure for one or more message types used by channels.
212 .value_or_throw();
213 return std::move(*this);
214 }
215
216 /// This method makes it possible to pack multiple `schema_count` in a single component batch.
217 ///
218 /// This only makes sense when used in conjunction with `columns`. `with_schema_count` should
219 /// be used when logging a single row's worth of data.
221 const Collection<rerun::components::Count>& _schema_count
222 ) && {
224 .value_or_throw();
225 return std::move(*this);
226 }
227
228 /// Number of channels defined in the recording.
229 ///
230 /// Each channel represents a unique topic and encoding combination for publishing messages.
233 .value_or_throw();
234 return std::move(*this);
235 }
236
237 /// This method makes it possible to pack multiple `channel_count` in a single component batch.
238 ///
239 /// This only makes sense when used in conjunction with `columns`. `with_channel_count` should
240 /// be used when logging a single row's worth of data.
242 const Collection<rerun::components::Count>& _channel_count
243 ) && {
245 .value_or_throw();
246 return std::move(*this);
247 }
248
249 /// Number of file attachments embedded in the recording.
250 ///
251 /// Attachments can include calibration files, configuration data, or other auxiliary files.
255 .value_or_throw();
256 return std::move(*this);
257 }
258
259 /// This method makes it possible to pack multiple `attachment_count` in a single component batch.
260 ///
261 /// This only makes sense when used in conjunction with `columns`. `with_attachment_count` should
262 /// be used when logging a single row's worth of data.
264 const Collection<rerun::components::Count>& _attachment_count
265 ) && {
268 .value_or_throw();
269 return std::move(*this);
270 }
271
272 /// Number of metadata records providing additional context about the recording.
273 ///
274 /// Metadata records contain key-value pairs with information about the recording environment,
275 /// system configuration, or other contextual data.
279 .value_or_throw();
280 return std::move(*this);
281 }
282
283 /// This method makes it possible to pack multiple `metadata_count` in a single component batch.
284 ///
285 /// This only makes sense when used in conjunction with `columns`. `with_metadata_count` should
286 /// be used when logging a single row's worth of data.
288 const Collection<rerun::components::Count>& _metadata_count
289 ) && {
292 .value_or_throw();
293 return std::move(*this);
294 }
295
296 /// Number of data chunks used to organize messages in the file.
297 ///
298 /// Chunks group related messages together for efficient storage and indexed access.
301 .value_or_throw();
302 return std::move(*this);
303 }
304
305 /// This method makes it possible to pack multiple `chunk_count` in a single component batch.
306 ///
307 /// This only makes sense when used in conjunction with `columns`. `with_chunk_count` should
308 /// be used when logging a single row's worth of data.
310 const Collection<rerun::components::Count>& _chunk_count
311 ) && {
313 .value_or_throw();
314 return std::move(*this);
315 }
316
317 /// Timestamp of the earliest message in the recording.
318 ///
319 /// This marks the beginning of the recorded data timeline.
321 const rerun::components::Timestamp& _message_start_time
322 ) && {
325 .value_or_throw();
326 return std::move(*this);
327 }
328
329 /// This method makes it possible to pack multiple `message_start_time` in a single component batch.
330 ///
331 /// This only makes sense when used in conjunction with `columns`. `with_message_start_time` should
332 /// be used when logging a single row's worth of data.
334 const Collection<rerun::components::Timestamp>& _message_start_time
335 ) && {
338 .value_or_throw();
339 return std::move(*this);
340 }
341
342 /// Timestamp of the latest message in the recording.
343 ///
344 /// Together with `message_start_time`, this defines the total duration of the recording.
346 ) && {
349 .value_or_throw();
350 return std::move(*this);
351 }
352
353 /// This method makes it possible to pack multiple `message_end_time` in a single component batch.
354 ///
355 /// This only makes sense when used in conjunction with `columns`. `with_message_end_time` should
356 /// be used when logging a single row's worth of data.
358 const Collection<rerun::components::Timestamp>& _message_end_time
359 ) && {
362 .value_or_throw();
363 return std::move(*this);
364 }
365
366 /// Detailed breakdown of message counts per channel.
368 const rerun::components::ChannelMessageCounts& _channel_message_counts
369 ) && {
371 _channel_message_counts,
373 )
374 .value_or_throw();
375 return std::move(*this);
376 }
377
378 /// This method makes it possible to pack multiple `channel_message_counts` in a single component batch.
379 ///
380 /// This only makes sense when used in conjunction with `columns`. `with_channel_message_counts` should
381 /// be used when logging a single row's worth of data.
383 const Collection<rerun::components::ChannelMessageCounts>& _channel_message_counts
384 ) && {
386 _channel_message_counts,
388 )
389 .value_or_throw();
390 return std::move(*this);
391 }
392
393 /// Partitions the component data into multiple sub-batches.
394 ///
395 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
396 /// instead, via `ComponentBatch::partitioned`.
397 ///
398 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
399 ///
400 /// The specified `lengths` must sum to the total length of the component batch.
402 return detail::partition_batches(
412 lengths_
413 )
414 .value_or_throw();
415 }
416
417 /// Partitions the component data into unit-length sub-batches.
418 ///
419 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
420 /// where `n` is automatically guessed.
422 return detail::partition_batches_of_unit_length({&message_count,
431 .value_or_throw();
432 }
433 };
434
435} // namespace rerun::archetypes
436
437namespace rerun {
438 /// \private
439 template <typename T>
440 struct AsComponents;
441
442 /// \private
443 template <>
444 struct AsComponents<archetypes::McapStatistics> {
445 /// Serialize all set component batches.
446 static Result<Collection<ComponentBatch>> as_batches(
447 const archetypes::McapStatistics& archetype
448 ) {
449 return detail::collect_batches(
450 {&archetype.message_count,
451 &archetype.schema_count,
452 &archetype.channel_count,
453 &archetype.attachment_count,
454 &archetype.metadata_count,
455 &archetype.chunk_count,
456 &archetype.message_start_time,
457 &archetype.message_end_time,
458 &archetype.channel_message_counts}
459 );
460 }
461 };
462} // 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
Arrow-encoded data of a single batch of components together with a component descriptor.
Definition component_batch.hpp:28
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: Recording-level statistics about an MCAP file.
Definition mcap_statistics.hpp:34
std::optional< ComponentBatch > attachment_count
Number of file attachments embedded in the recording.
Definition mcap_statistics.hpp:54
McapStatistics with_message_count(const rerun::components::Count &_message_count) &&
Total number of data messages contained in the MCAP recording.
Definition mcap_statistics.hpp:189
McapStatistics with_metadata_count(const rerun::components::Count &_metadata_count) &&
Number of metadata records providing additional context about the recording.
Definition mcap_statistics.hpp:276
std::optional< ComponentBatch > message_count
Total number of data messages contained in the MCAP recording.
Definition mcap_statistics.hpp:39
static constexpr auto Descriptor_chunk_count
ComponentDescriptor for the chunk_count field.
Definition mcap_statistics.hpp:110
std::optional< ComponentBatch > channel_message_counts
Detailed breakdown of message counts per channel.
Definition mcap_statistics.hpp:78
static constexpr auto Descriptor_schema_count
ComponentDescriptor for the schema_count field.
Definition mcap_statistics.hpp:90
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
Definition mcap_statistics.hpp:401
static McapStatistics clear_fields()
Clear all the fields of a McapStatistics.
McapStatistics with_many_channel_count(const Collection< rerun::components::Count > &_channel_count) &&
This method makes it possible to pack multiple channel_count in a single component batch.
Definition mcap_statistics.hpp:241
McapStatistics with_channel_count(const rerun::components::Count &_channel_count) &&
Number of channels defined in the recording.
Definition mcap_statistics.hpp:231
McapStatistics with_many_channel_message_counts(const Collection< rerun::components::ChannelMessageCounts > &_channel_message_counts) &&
This method makes it possible to pack multiple channel_message_counts in a single component batch.
Definition mcap_statistics.hpp:382
McapStatistics with_many_attachment_count(const Collection< rerun::components::Count > &_attachment_count) &&
This method makes it possible to pack multiple attachment_count in a single component batch.
Definition mcap_statistics.hpp:263
std::optional< ComponentBatch > message_end_time
Timestamp of the latest message in the recording.
Definition mcap_statistics.hpp:75
McapStatistics with_many_message_count(const Collection< rerun::components::Count > &_message_count) &&
This method makes it possible to pack multiple message_count in a single component batch.
Definition mcap_statistics.hpp:199
McapStatistics with_message_end_time(const rerun::components::Timestamp &_message_end_time) &&
Timestamp of the latest message in the recording.
Definition mcap_statistics.hpp:345
McapStatistics with_many_chunk_count(const Collection< rerun::components::Count > &_chunk_count) &&
This method makes it possible to pack multiple chunk_count in a single component batch.
Definition mcap_statistics.hpp:309
std::optional< ComponentBatch > chunk_count
Number of data chunks used to organize messages in the file.
Definition mcap_statistics.hpp:65
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition mcap_statistics.hpp:82
static constexpr auto Descriptor_channel_count
ComponentDescriptor for the channel_count field.
Definition mcap_statistics.hpp:95
std::optional< ComponentBatch > schema_count
Number of unique schema definitions in the recording.
Definition mcap_statistics.hpp:44
McapStatistics with_attachment_count(const rerun::components::Count &_attachment_count) &&
Number of file attachments embedded in the recording.
Definition mcap_statistics.hpp:252
McapStatistics with_many_metadata_count(const Collection< rerun::components::Count > &_metadata_count) &&
This method makes it possible to pack multiple metadata_count in a single component batch.
Definition mcap_statistics.hpp:287
McapStatistics with_schema_count(const rerun::components::Count &_schema_count) &&
Number of unique schema definitions in the recording.
Definition mcap_statistics.hpp:210
static constexpr auto Descriptor_attachment_count
ComponentDescriptor for the attachment_count field.
Definition mcap_statistics.hpp:100
static constexpr auto Descriptor_message_end_time
ComponentDescriptor for the message_end_time field.
Definition mcap_statistics.hpp:120
McapStatistics with_chunk_count(const rerun::components::Count &_chunk_count) &&
Number of data chunks used to organize messages in the file.
Definition mcap_statistics.hpp:299
McapStatistics with_many_message_start_time(const Collection< rerun::components::Timestamp > &_message_start_time) &&
This method makes it possible to pack multiple message_start_time in a single component batch.
Definition mcap_statistics.hpp:333
static constexpr auto Descriptor_channel_message_counts
ComponentDescriptor for the channel_message_counts field.
Definition mcap_statistics.hpp:125
McapStatistics with_message_start_time(const rerun::components::Timestamp &_message_start_time) &&
Timestamp of the earliest message in the recording.
Definition mcap_statistics.hpp:320
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
Definition mcap_statistics.hpp:421
std::optional< ComponentBatch > channel_count
Number of channels defined in the recording.
Definition mcap_statistics.hpp:49
McapStatistics with_many_message_end_time(const Collection< rerun::components::Timestamp > &_message_end_time) &&
This method makes it possible to pack multiple message_end_time in a single component batch.
Definition mcap_statistics.hpp:357
static constexpr auto Descriptor_metadata_count
ComponentDescriptor for the metadata_count field.
Definition mcap_statistics.hpp:105
static McapStatistics update_fields()
Update only some specific fields of a McapStatistics.
Definition mcap_statistics.hpp:178
static constexpr auto Descriptor_message_count
ComponentDescriptor for the message_count field.
Definition mcap_statistics.hpp:85
std::optional< ComponentBatch > message_start_time
Timestamp of the earliest message in the recording.
Definition mcap_statistics.hpp:70
static constexpr auto Descriptor_message_start_time
ComponentDescriptor for the message_start_time field.
Definition mcap_statistics.hpp:115
std::optional< ComponentBatch > metadata_count
Number of metadata records providing additional context about the recording.
Definition mcap_statistics.hpp:60
McapStatistics with_channel_message_counts(const rerun::components::ChannelMessageCounts &_channel_message_counts) &&
Detailed breakdown of message counts per channel.
Definition mcap_statistics.hpp:367
McapStatistics with_many_schema_count(const Collection< rerun::components::Count > &_schema_count) &&
This method makes it possible to pack multiple schema_count in a single component batch.
Definition mcap_statistics.hpp:220
Component: A mapping of channel IDs to their respective message counts.
Definition channel_message_counts.hpp:27
Component: A generic count value.
Definition count.hpp:19
Component: When the recording started.
Definition timestamp.hpp:16