FERS 0.1.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
stream_registry.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2026-present FERS Contributors (see AUTHORS.md).
4//
5// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
6
7#pragma once
8
9#include <cstdint>
10#include <string>
11#include <unordered_map>
12
14
15namespace serial::vita49
16{
18 {
19 public:
20 [[nodiscard]] std::uint32_t registerStream(const core::ReceiverStreamDescriptor& stream);
21 [[nodiscard]] bool contains(std::uint32_t stream_id) const;
22 [[nodiscard]] const core::ReceiverStreamDescriptor& descriptor(std::uint32_t stream_id) const;
23
24 private:
25 struct Key
26 {
27 SimId receiver_id = 0;
28 std::string receiver_name;
29 std::string mode;
30
31 [[nodiscard]] bool operator==(const Key& other) const noexcept;
32 };
33
34 struct KeyHash
35 {
36 [[nodiscard]] std::size_t operator()(const Key& key) const noexcept;
37 };
38
39 [[nodiscard]] static std::uint32_t initialStreamId(const Key& key) noexcept;
40
41 std::unordered_map<Key, std::uint32_t, KeyHash> _by_key;
42 std::unordered_map<std::uint32_t, Key> _by_stream_id;
43 std::unordered_map<std::uint32_t, core::ReceiverStreamDescriptor> _descriptors;
44 };
45}
const core::ReceiverStreamDescriptor & descriptor(std::uint32_t stream_id) const
bool contains(std::uint32_t stream_id) const
std::uint32_t registerStream(const core::ReceiverStreamDescriptor &stream)
uint64_t SimId
64-bit Unique Simulation ID.
Definition sim_id.h:18
math::Vec3 max