9 #include <unordered_map> 14 #define MCAP_LIBRARY_VERSION "0.1.2" 20 using KeyValueMap = std::unordered_map<std::string, std::string>;
89 return sizeof(opcode) +
sizeof(dataSize) + dataSize;
118 : summaryStart(summaryStart)
119 , summaryOffsetStart(summaryOffsetStart)
139 , data{
reinterpret_cast<const std::byte*
>(data.data()),
140 reinterpret_cast<const std::byte*>(data.data() + data.size())} {}
167 , messageEncoding(messageEncoding)
169 , metadata(metadata) {}
204 const std::byte*
data =
nullptr;
218 const std::byte* records =
nullptr;
227 std::vector<std::pair<Timestamp, ByteOffset>>
records;
258 const std::byte*
data =
nullptr;
279 4 + attachment.name.
size() +
282 4 + attachment.contentType.
size() +
283 8 + attachment.dataSize +
285 , logTime(attachment.logTime)
286 , createTime(attachment.createTime)
287 , dataSize(attachment.dataSize)
288 , name(attachment.name)
289 , contentType(attachment.contentType) {}
369 #ifdef MCAP_IMPLEMENTATION
Timestamp messageStartTime
Compression
Supported MCAP compression algorithms.
An Attachment is an arbitrary file embedded in an MCAP file, including a name, content-type, timestamps, and optional CRC. Attachment records are written in the Data section, outside of Chunks.
std::function< void(const Status &)> ProblemCallback
The Statistics record is found in the Summary section, providing counts and timestamp ranges for the ...
constexpr ByteOffset EndOffset
Describes a Channel that messages are written to. A Channel represents a single connection from a pub...
ByteOffset uncompressedSize
AttachmentIndex(const Attachment &attachment, ByteOffset fileOffset)
Timestamp messageStartTime
ByteOffset messageIndexLength
std::unordered_map< ChannelId, uint64_t > channelMessageCounts
std::vector< std::pair< Timestamp, ByteOffset > > records
constexpr Timestamp MaxTime
uint32_t sequence
An optional sequence number. If non-zero, sequence numbers should be unique per channel and increasin...
An collection of Schemas, Channels, and Messages that supports compression and indexing.
basic_string_view< char > string_view
uint64_t recordSize() const
Chunk Index records are found in the Summary section, providing summary information for a single Chun...
Attachment Index records are found in the Summary section, providing summary information for a single...
Returned when iterating over Messages in a file, MessageView contains a reference to one Message...
std::string messageEncoding
#define MCAP_LIBRARY_VERSION
Schema(const std::string_view name, const std::string_view encoding, const ByteArray &data)
std::shared_ptr< Schema > SchemaPtr
ByteOffset uncompressedSize
Timestamp messageStartTime
constexpr uint8_t Magic[]
Summary Offset records are found in the Summary Offset section. Records in the Summary section are gr...
std::shared_ptr< Channel > ChannelPtr
Schema(const std::string_view name, const std::string_view encoding, const std::string_view data)
Timestamp publishTime
Nanosecond timestamp when this message was initially published. If not available, this should be set ...
The final record in the Data section, signaling the end of Data and beginning of Summary. Optionally contains a CRC of the entire Data section.
constexpr uint64_t DefaultChunkSize
constexpr std::string_view OpCodeString(OpCode opcode)
Get the string representation of an OpCode.
MessageView(const Message &message, const ChannelPtr channel, const SchemaPtr schema)
ByteOffset chunkStartOffset
A single Message published to a Channel.
std::unordered_map< ChannelId, ByteOffset > messageIndexOffsets
constexpr char SpecVersion
constexpr char LibraryVersion[]
ByteOffset compressedSize
Timestamp logTime
Nanosecond timestamp when this message was recorded or received for recording.
Channel(const std::string_view topic, const std::string_view messageEncoding, SchemaId schemaId, const KeyValueMap &metadata={})
span_constexpr std::size_t size(span< T, Extent > const &spn)
CompressionLevel
Compression level to use when compression is enabled. Slower generally produces smaller files...
uint64_t dataSize
Size of the message payload in bytes, pointed to via data.
std::unordered_map< std::string, std::string > KeyValueMap
Describes a schema used for message encoding and decoding and/or describing the shape of messages...
A list of timestamps to byte offsets for a single Channel. This record appears after each Chunk...
std::vector< std::byte > ByteArray
ByteOffset compressedSize
A generic Type-Length-Value record using a uint8 type and uint64 length. This is the generic form of ...