FERS 1.0.0
The Flexible Extensible Radar Simulator
Loading...
Searching...
No Matches
object.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 object.h
10 * @brief Base class for all physical objects in the radar system.
11 */
12
13#pragma once
14
15#include "core/sim_id.h"
16#include "platform.h"
17
18namespace radar
19{
20 /**
21 * @class Object
22 * @brief Represents a physical object in the radar system.
23 */
24 class Object
25 {
26 public:
27 /**
28 * @brief Constructor for Object.
29 *
30 * @param platform Pointer to the Platform object associated with this Object.
31 * @param name The name of the Object.
32 */
33 Object(Platform* platform, std::string name, const ObjectType type, const SimId id = 0) noexcept :
34 _platform(platform), _id(id == 0 ? SimIdGenerator::instance().generateId(type) : id), _name(std::move(name))
35 {
36 }
37
38 virtual ~Object() = default;
39 Object(const Object&) = delete;
40 Object& operator=(const Object&) = delete;
41 Object(Object&&) noexcept = default;
42 Object& operator=(Object&&) noexcept = default;
43
44 /**
45 * @brief Retrieves the position of the object.
46 *
47 * @param time The time at which to get the position of the object.
48 * @return A math::Vec3 representing the position of the object.
49 */
50 [[nodiscard]] math::Vec3 getPosition(const RealType time) const { return _platform->getPosition(time); }
51
52 /**
53 * @brief Retrieves the rotation of the object.
54 *
55 * @param time The time at which to get the rotation of the object.
56 * @return A math::SVec3 representing the rotation of the object.
57 */
58 [[nodiscard]] math::SVec3 getRotation(const RealType time) const { return _platform->getRotation(time); }
59
60 /**
61 * @brief Retrieves the associated platform of the object.
62 *
63 * @return A pointer to the Platform object associated with this object.
64 */
65 [[nodiscard]] Platform* getPlatform() const noexcept { return _platform; }
66
67 /**
68 * @brief Retrieves the unique ID of the object.
69 *
70 * @return The unique SimId of the object.
71 */
72 [[nodiscard]] SimId getId() const noexcept { return _id; }
73
74 /**
75 * @brief Retrieves the name of the object.
76 *
77 * @return A const reference to the string representing the object's name.
78 */
79 [[nodiscard]] const std::string& getName() const noexcept { return _name; }
80
81 /**
82 * @brief Sets the name of the object.
83 *
84 * @param name The new name for the object.
85 */
86 void setName(std::string name) noexcept { _name = std::move(name); }
87
88 private:
89 Platform* _platform; ///< Pointer to the Platform object associated with this Object.
90 SimId _id; ///< Unique ID for this object.
91 std::string _name; ///< The name of the Object.
92 };
93}
Thread-safe Meyers singleton for generating unique object IDs.
Definition sim_id.h:42
A class representing a vector in spherical coordinates.
Represents a physical object in the radar system.
Definition object.h:25
const std::string & getName() const noexcept
Retrieves the name of the object.
Definition object.h:79
Platform * getPlatform() const noexcept
Retrieves the associated platform of the object.
Definition object.h:65
SimId getId() const noexcept
Retrieves the unique ID of the object.
Definition object.h:72
void setName(std::string name) noexcept
Sets the name of the object.
Definition object.h:86
Object(Platform *platform, std::string name, const ObjectType type, const SimId id=0) noexcept
Constructor for Object.
Definition object.h:33
Object & operator=(const Object &)=delete
math::SVec3 getRotation(const RealType time) const
Retrieves the rotation of the object.
Definition object.h:58
math::Vec3 getPosition(const RealType time) const
Retrieves the position of the object.
Definition object.h:50
Object(const Object &)=delete
Object(Object &&) noexcept=default
virtual ~Object()=default
Represents a simulation platform with motion and rotation paths.
Definition platform.h:32
math::Vec3 getPosition(const RealType time) const
Gets the position of the platform at a specific time.
Definition platform.h:75
math::SVec3 getRotation(const RealType time) const
Gets the rotation of the platform at a specific time.
Definition platform.h:83
double RealType
Type for real numbers.
Definition config.h:27
Definition coord.h:18
Defines the Platform class used in radar simulation.
uint64_t SimId
64-bit Unique Simulation ID.
Definition sim_id.h:18
ObjectType
Categorizes objects for ID generation.
Definition sim_id.h:25