CommRaT 2.0.0
C++20 Real-Time Messaging Framework
Loading...
Searching...
No Matches
input_metadata_manager.hpp
Go to the documentation of this file.
1#pragma once
2
5#include <iostream>
6
7namespace commrat {
8
21template<typename ModuleType>
23protected:
35 template<typename T>
36 void update_input_metadata(std::size_t index, const TimsMessage<T>& received, bool is_new) {
37 auto& module = static_cast<ModuleType&>(*this);
38
39 if (index >= module.num_inputs) {
40 std::cerr << "[Module] ERROR: Invalid metadata index " << index << "\n";
41 return;
42 }
43
44 module.input_metadata_[index].timestamp = received.header.timestamp;
45 module.input_metadata_[index].sequence_number = received.header.seq_number;
46 module.input_metadata_[index].message_id = received.header.msg_type;
47 module.input_metadata_[index].is_new_data = is_new;
48 module.input_metadata_[index].is_valid = true;
49 }
50
59 void mark_input_invalid(std::size_t index) {
60 auto& module = static_cast<ModuleType&>(*this);
61
62 if (index >= module.num_inputs) {
63 return;
64 }
65
66 module.input_metadata_[index].is_valid = false;
67 module.input_metadata_[index].is_new_data = false;
68 }
69};
70
71} // namespace commrat
Phase 9: Input Metadata Manager CRTP Mixin.
void update_input_metadata(std::size_t index, const TimsMessage< T > &received, bool is_new)
Update metadata for a specific input index.
void mark_input_invalid(std::size_t index)
Mark input metadata as invalid (getData failed)
CommRaT - Modern C++ Real-Time Communication Framework.