FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
response.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-only
2//
3// Copyright (c) 2006-2008 Marc Brooker and Michael Inggs
4// Copyright (c) 2008-present FERS Contributors (see AUTHORS.md).
5//
6// See the GNU GPLv2 LICENSE file in the FERS project root for more information.
7
8/**
9 * @file response.h
10 * @brief Classes for managing radar signal responses.
11 */
12
13#pragma once
14
15#include <string>
16#include <vector>
17
18#include "core/config.h"
19#include "core/sim_id.h"
21
22class XmlElement;
23
24namespace fers_signal
25{
26 class RadarSignal;
27}
28
29namespace radar
30{
31 class Transmitter;
32}
33
34namespace serial
35{
36 /**
37 * @class Response
38 * @brief Manages radar signal responses from a transmitter.
39 */
41 {
42 public:
43 /**
44 * @brief Constructor for the `Response` class.
45 *
46 * @param wave Pointer to the radar signal object.
47 * @param transmitter Pointer to the transmitter object.
48 */
49 Response(const fers_signal::RadarSignal* wave, const radar::Transmitter* transmitter) noexcept :
50 _transmitter(transmitter), _wave(wave)
51 {
52 }
53
54 ~Response() = default;
55 Response(const Response&) = delete;
56 Response& operator=(const Response&) = delete;
57 Response(Response&&) = delete;
59
60 /**
61 * @brief Retrieves the start time of the response.
62 *
63 * @return Start time as a `RealType`. Returns 0.0 if no points are present.
64 */
65 [[nodiscard]] RealType startTime() const noexcept { return _points.empty() ? 0.0 : _points.front().time; }
66
67 /**
68 * @brief Retrieves the end time of the response.
69 *
70 * @return End time as a `RealType`. Returns 0.0 if no points are present.
71 */
72 [[nodiscard]] RealType endTime() const noexcept { return _points.empty() ? 0.0 : _points.back().time; }
73
74 /**
75 * @brief Adds an interpolation point to the response.
76 *
77 * @param point The interpolation point to be added.
78 * @throws std::logic_error If the new point has a time earlier than the last point.
79 */
80 void addInterpPoint(const interp::InterpPoint& point);
81
82 /**
83 * @brief Renders the response in binary format.
84 *
85 * @param rate Output parameter for the signal rate.
86 * @param size Output parameter for the size of the binary data.
87 * @param fracWinDelay Delay factor applied during windowing.
88 * @return A vector of `ComplexType` representing the binary data.
89 */
90 std::vector<ComplexType> renderBinary(RealType& rate, unsigned& size, RealType fracWinDelay) const;
91
92 /**
93 * @brief Retrieves the length of the response.
94 *
95 * @return The length of the response as a `RealType`.
96 */
97 [[nodiscard]] RealType getLength() const noexcept { return endTime() - startTime(); }
98
99 /**
100 * @brief Retrieves the ID of the associated transmitter.
101 *
102 * @return The transmitter SimId.
103 */
104 [[nodiscard]] SimId getTransmitterId() const noexcept;
105
106 private:
107 const radar::Transmitter* _transmitter; ///< Pointer to the transmitter object.
108 const fers_signal::RadarSignal* _wave; ///< Pointer to the radar signal object.
109 std::vector<interp::InterpPoint> _points; ///< Vector of interpolation points.
110 };
111}
Class representing a node in an XML document.
Class representing a radar signal with associated properties.
Represents a radar transmitter system.
Definition transmitter.h:33
Manages radar signal responses from a transmitter.
Definition response.h:41
void addInterpPoint(const interp::InterpPoint &point)
Adds an interpolation point to the response.
Definition response.cpp:27
Response & operator=(const Response &)=delete
RealType startTime() const noexcept
Retrieves the start time of the response.
Definition response.h:65
Response & operator=(Response &&)=delete
SimId getTransmitterId() const noexcept
Retrieves the ID of the associated transmitter.
Definition response.cpp:25
~Response()=default
RealType getLength() const noexcept
Retrieves the length of the response.
Definition response.h:97
Response(Response &&)=delete
std::vector< ComplexType > renderBinary(RealType &rate, unsigned &size, RealType fracWinDelay) const
Renders the response in binary format.
Definition response.cpp:29
RealType endTime() const noexcept
Retrieves the end time of the response.
Definition response.h:72
Response(const Response &)=delete
Response(const fers_signal::RadarSignal *wave, const radar::Transmitter *transmitter) noexcept
Constructor for the Response class.
Definition response.h:49
Global configuration file for the project.
double RealType
Type for real numbers.
Definition config.h:27
Defines a structure to store interpolation point data for signal processing.
uint64_t SimId
64-bit Unique Simulation ID.
Definition sim_id.h:18
Stores data for an interpolation point.