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"
20
21class XmlElement;
22
23namespace fers_signal
24{
25 class RadarSignal;
26}
27
28namespace radar
29{
30 class Transmitter;
31}
32
33namespace serial
34{
35 /**
36 * @class Response
37 * @brief Manages radar signal responses from a transmitter.
38 */
40 {
41 public:
42 /**
43 * @brief Constructor for the `Response` class.
44 *
45 * @param wave Pointer to the radar signal object.
46 * @param transmitter Pointer to the transmitter object.
47 */
48 Response(const fers_signal::RadarSignal* wave, const radar::Transmitter* transmitter) noexcept :
49 _transmitter(transmitter), _wave(wave)
50 {
51 }
52
53 ~Response() = default;
54 Response(const Response&) = delete;
55 Response& operator=(const Response&) = delete;
56 Response(Response&&) = delete;
58
59 /**
60 * @brief Retrieves the start time of the response.
61 *
62 * @return Start time as a `RealType`. Returns 0.0 if no points are present.
63 */
64 [[nodiscard]] RealType startTime() const noexcept { return _points.empty() ? 0.0 : _points.front().time; }
65
66 /**
67 * @brief Retrieves the end time of the response.
68 *
69 * @return End time as a `RealType`. Returns 0.0 if no points are present.
70 */
71 [[nodiscard]] RealType endTime() const noexcept { return _points.empty() ? 0.0 : _points.back().time; }
72
73 /**
74 * @brief Adds an interpolation point to the response.
75 *
76 * @param point The interpolation point to be added.
77 * @throws std::logic_error If the new point has a time earlier than the last point.
78 */
79 void addInterpPoint(const interp::InterpPoint& point);
80
81 /**
82 * @brief Renders the response in binary format.
83 *
84 * @param rate Output parameter for the signal rate.
85 * @param size Output parameter for the size of the binary data.
86 * @param fracWinDelay Delay factor applied during windowing.
87 * @return A vector of `ComplexType` representing the binary data.
88 */
89 std::vector<ComplexType> renderBinary(RealType& rate, unsigned& size, RealType fracWinDelay) const;
90
91 /**
92 * @brief Retrieves the length of the response.
93 *
94 * @return The length of the response as a `RealType`.
95 */
96 [[nodiscard]] RealType getLength() const noexcept { return endTime() - startTime(); }
97
98 /**
99 * @brief Retrieves the name of the associated transmitter.
100 *
101 * @return The name of the transmitter as a `std::string`.
102 */
103 [[nodiscard]] std::string getTransmitterName() const noexcept;
104
105 private:
106 const radar::Transmitter* _transmitter; ///< Pointer to the transmitter object.
107 const fers_signal::RadarSignal* _wave; ///< Pointer to the radar signal object.
108 std::vector<interp::InterpPoint> _points; ///< Vector of interpolation points.
109 };
110}
Class representing a node in an XML document.
Class representing a radar signal with associated properties.
Represents a radar transmitter system.
Definition transmitter.h:32
Manages radar signal responses from a transmitter.
Definition response.h:40
void addInterpPoint(const interp::InterpPoint &point)
Adds an interpolation point to the response.
Definition response.cpp:26
Response & operator=(const Response &)=delete
RealType startTime() const noexcept
Retrieves the start time of the response.
Definition response.h:64
std::string getTransmitterName() const noexcept
Retrieves the name of the associated transmitter.
Definition response.cpp:24
Response & operator=(Response &&)=delete
~Response()=default
RealType getLength() const noexcept
Retrieves the length of the response.
Definition response.h:96
Response(Response &&)=delete
std::vector< ComplexType > renderBinary(RealType &rate, unsigned &size, RealType fracWinDelay) const
Renders the response in binary format.
Definition response.cpp:28
RealType endTime() const noexcept
Retrieves the end time of the response.
Definition response.h:71
Response(const Response &)=delete
Response(const fers_signal::RadarSignal *wave, const radar::Transmitter *transmitter) noexcept
Constructor for the Response class.
Definition response.h:48
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.
Stores data for an interpolation point.