Rerun C++ SDK
Loading...
Searching...
No Matches
mcap_message.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/mcap_message.fbs".
3
4#pragma once
5
6#include "../collection.hpp"
7#include "../component_batch.hpp"
8#include "../component_column.hpp"
9#include "../components/blob.hpp"
10#include "../result.hpp"
11
12#include <cstdint>
13#include <optional>
14#include <utility>
15#include <vector>
16
17namespace rerun::archetypes {
18 /// **Archetype**: The binary payload of a single MCAP message, without metadata.
19 ///
20 /// This archetype represents only the raw message data from an MCAP file. It does not include
21 /// MCAP message metadata such as timestamps, channel IDs, sequence numbers, or publication times.
22 /// The binary payload represents sensor data, commands, or other information encoded according
23 /// to the format specified by the associated channel.
24 ///
25 /// See `archetypes::McapChannel` for channel definitions that specify message encoding,
26 /// `archetypes::McapSchema` for data structure definitions, and the
27 /// [MCAP specification](https://mcap.dev/) for complete format details.
28 ///
29 /// ⚠ **This type is _unstable_ and may change significantly in a way that the data won't be backwards compatible.**
30 ///
31 struct McapMessage {
32 /// The raw message payload as a binary blob.
33 ///
34 /// This contains the actual message data encoded according to the format specified
35 /// by the associated channel's `message_encoding` field. The structure and interpretation
36 /// of this binary data depends on the encoding format (e.g., ros1, cdr, protobuf)
37 /// and the message schema defined for the channel.
38 std::optional<ComponentBatch> data;
39
40 public:
41 /// The name of the archetype as used in `ComponentDescriptor`s.
42 static constexpr const char ArchetypeName[] = "rerun.archetypes.McapMessage";
43
44 /// `ComponentDescriptor` for the `data` field.
45 static constexpr auto Descriptor_data = ComponentDescriptor(
47 );
48
49 public:
50 McapMessage() = default;
51 McapMessage(McapMessage&& other) = default;
52 McapMessage(const McapMessage& other) = default;
53 McapMessage& operator=(const McapMessage& other) = default;
54 McapMessage& operator=(McapMessage&& other) = default;
55
57 : data(ComponentBatch::from_loggable(std::move(_data), Descriptor_data).value_or_throw()
58 ) {}
59
60 /// Update only some specific fields of a `McapMessage`.
62 return McapMessage();
63 }
64
65 /// Clear all the fields of a `McapMessage`.
67
68 /// The raw message payload as a binary blob.
69 ///
70 /// This contains the actual message data encoded according to the format specified
71 /// by the associated channel's `message_encoding` field. The structure and interpretation
72 /// of this binary data depends on the encoding format (e.g., ros1, cdr, protobuf)
73 /// and the message schema defined for the channel.
75 data = ComponentBatch::from_loggable(_data, Descriptor_data).value_or_throw();
76 return std::move(*this);
77 }
78
79 /// This method makes it possible to pack multiple `data` in a single component batch.
80 ///
81 /// This only makes sense when used in conjunction with `columns`. `with_data` should
82 /// be used when logging a single row's worth of data.
84 data = ComponentBatch::from_loggable(_data, Descriptor_data).value_or_throw();
85 return std::move(*this);
86 }
87
88 /// Partitions the component data into multiple sub-batches.
89 ///
90 /// Specifically, this transforms the existing `ComponentBatch` data into `ComponentColumn`s
91 /// instead, via `ComponentBatch::partitioned`.
92 ///
93 /// This makes it possible to use `RecordingStream::send_columns` to send columnar data directly into Rerun.
94 ///
95 /// The specified `lengths` must sum to the total length of the component batch.
97
98 /// Partitions the component data into unit-length sub-batches.
99 ///
100 /// This is semantically similar to calling `columns` with `std::vector<uint32_t>(n, 1)`,
101 /// where `n` is automatically guessed.
103 };
104
105} // namespace rerun::archetypes
106
107namespace rerun {
108 /// \private
109 template <typename T>
110 struct AsComponents;
111
112 /// \private
113 template <>
114 struct AsComponents<archetypes::McapMessage> {
115 /// Serialize all set component batches.
116 static Result<Collection<ComponentBatch>> as_batches(
117 const archetypes::McapMessage& archetype
118 );
119 };
120} // 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
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: The binary payload of a single MCAP message, without metadata.
Definition mcap_message.hpp:31
static constexpr const char ArchetypeName[]
The name of the archetype as used in ComponentDescriptors.
Definition mcap_message.hpp:42
Collection< ComponentColumn > columns(const Collection< uint32_t > &lengths_)
Partitions the component data into multiple sub-batches.
McapMessage with_many_data(const Collection< rerun::components::Blob > &_data) &&
This method makes it possible to pack multiple data in a single component batch.
Definition mcap_message.hpp:83
Collection< ComponentColumn > columns()
Partitions the component data into unit-length sub-batches.
McapMessage with_data(const rerun::components::Blob &_data) &&
The raw message payload as a binary blob.
Definition mcap_message.hpp:74
std::optional< ComponentBatch > data
The raw message payload as a binary blob.
Definition mcap_message.hpp:38
static McapMessage clear_fields()
Clear all the fields of a McapMessage.
static McapMessage update_fields()
Update only some specific fields of a McapMessage.
Definition mcap_message.hpp:61
static constexpr auto Descriptor_data
ComponentDescriptor for the data field.
Definition mcap_message.hpp:45
Component: A binary blob of data.
Definition blob.hpp:16