CommRaT 2.0.0
C++20 Real-Time Messaging Framework
Loading...
Searching...
No Matches
tims_helpers.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <cstdint>
6#include <utility>
7
8namespace commrat {
9
10// ============================================================================
11// TimsMessage Creation Helpers
12// ============================================================================
13
20template<typename T>
21TimsMessage<T> create_tims_message(T&& payload, uint64_t timestamp_ns) {
23 .header = {
24 .msg_type = 0, // serialize() will set this
25 .msg_size = 0, // serialize() will set this
26 .timestamp = timestamp_ns, // ONE SOURCE OF TRUTH
27 .seq_number = 0, // TiMS will set this
28 .flags = 0
29 },
30 .payload = std::forward<T>(payload)
31 };
32 return msg;
33}
34
35} // namespace commrat
CommRaT - Modern C++ Real-Time Communication Framework.
TimsMessage< T > create_tims_message(T &&payload, uint64_t timestamp_ns)
Create TimsMessage with header.timestamp set.
Unified timestamp and time utility abstractions for CommRaT.