VR-Engage  2.2
Loading...
Searching...
No Matches
vreRadarObjectSensorMonitor.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreRadarObjectSensorMonitor.h
7//! \ingroup vreVrfmodel
8//! \brief Monitor for radar sensor contact information communication
9//!
10//! This file defines the DtVreRadarObjectSensorMonitor class which manages
11//! the communication of radar sensor contact information between a radar system
12//! and visualization systems. It handles subscription requests and notifications
13//! when radar contacts change.
14
15#pragma once
16
17#include "vreVrfmodel/export.h"
18
19#include <vrfmodel/objectSensorMonitor.h>
20
21class DtSimMessage;
23class DtObjectSensorPSR;
24
25namespace makVre
26{
28
29//! \brief Monitor for radar sensor contact information communication
30//!
31//! DtVreRadarObjectSensorMonitor manages the communication of radar sensor
32//! contact information between a radar system and visualization clients. It extends
33//! the base ObjectSensorMonitor with VR-Engage specific functionality for handling
34//! multiple subscriptions from the same client address and providing enhanced
35//! radar contact information.
36//!
37//! This class manages the sending of radar sensor contact information to the
38//! GUI from one particular sensor on an entity, handling subscription requests
39//! and maintaining a list of current subscribers.
40class VREVRFMODEL_DLL DtVreRadarObjectSensorMonitor : public DtObjectSensorMonitor
41{
42private:
43 //! \brief Default constructor (not implemented)
44 //!
45 //! Default constructor is private and not implemented to prevent
46 //! creation of instances without proper initialization.
48
49 //! \brief Copy constructor (not implemented)
50 //!
51 //! Copy constructor is private and not implemented to prevent
52 //! copy construction.
54
55 //! \brief Assignment operator (not implemented)
56 //! \return Reference to this object
57 //!
58 //! Assignment operator is private and not implemented to prevent assignment.
60
61public:
62 //! \brief Constructor
63 //! \param hostObject The local object that owns the sensor this monitor is for
64 //! \param contactInfoList Pointer to the list of sensor contacts maintained by the sensor
65 //! \param sensorName The name of the sensor being monitored
66 //! \param sensorType The type identifier for the sensor being monitored
67 //! \param psr Pointer to the process state repository for the sensor
68 //!
69 //! Creates a new radar sensor monitor that will handle communication between the
70 //! specified radar system and visualization clients.
71 DtVreRadarObjectSensorMonitor(DtLocalObject* hostObject, const DtSensorContactInfoList* contactInfoList,
72 const DtString& sensorName, int sensorType, DtObjectSensorPSR* psr);
73
74 //! \brief Virtual destructor
75 //!
76 //! Cleans up resources used by the radar object sensor monitor.
78
79 //! \brief Creates and sends a sensor data message to subscribers
80 //!
81 //! Constructs a DtSensorData message based on the current state of
82 //! the sensor's process state repository (PSR), and sends it to all
83 //! current subscribers. This provides visualization clients with up-to-date
84 //! radar contact information.
85 virtual void createAndSendSensorDataMessage() override;
86
87 //! \brief Processes a sensor data request message
88 //! \param msg The simulation message containing the request
89 //!
90 //! Handles subscription requests for radar sensor data,
91 //! adding the client to the subscriber list and sending initial data.
92 //! Overrides the base class implementation to use the counter-based
93 //! subscriber list for better handling of multiple subscriptions.
94 virtual void processSensorDataRequest(DtSimMessage* msg) override;
95
96 //! \brief Processes a sensor data unsubscribe message
97 //! \param msg The simulation message containing the unsubscribe request
98 //!
99 //! Handles unsubscription requests for radar sensor data,
100 //! removing the client from the subscriber list. Overrides the base class
101 //! implementation to use the counter-based subscriber list.
102 virtual void processSensorDataUnsubscribe(DtSimMessage* msg) override;
103
104protected:
105 //! \brief Adds a client to the subscriber list
106 //! \param add The simulation address of the client to add
107 //!
108 //! Overridden to use mySubscriberListCounter instead of the base member mySubscriberList
109 //! to properly handle cases where more than one application uses the same SimulationAddress.
110 //! Maintains a counter for each address to track multiple subscriptions from the same client.
111 virtual void addToSubscriberList(const DtSimulationAddress& add) override;
112
113 //! \brief Removes a client from the subscriber list
114 //! \param add The simulation address of the client to remove
115 //!
116 //! Overridden to use mySubscriberListCounter instead of the base member mySubscriberList
117 //! to properly handle cases where more than one application uses the same SimulationAddress.
118 //! Decrements the counter for the address and only completely removes the client
119 //! when the counter reaches zero.
120 virtual void removeFromSubscriberList(const DtSimulationAddress& add) override;
121
122 //! \brief Gets the number of current subscribers
123 //! \return The number of clients currently subscribed to this radar sensor's data
124 //!
125 //! Returns the count of unique clients currently subscribed to receive
126 //! radar sensor data updates. Overridden to use the counter-based subscriber list.
127 virtual int numberOfSubscribers() override;
128
129protected:
130 //! \brief Pointer to the radar contact information list
131 //!
132 //! Contains the current list of radar contacts detected by the radar system.
133 //! Cast from the base contact info list to the radar-specific type.
135
136 //! \brief Type definition for the subscriber list with counter
137 //!
138 //! Defines the container type used to store simulation addresses of subscribers
139 //! with a counter for each to track multiple subscriptions from the same client.
140 using DtSubscriberListCounter = std::map<DtSimulationAddress, int>;
141
142 //! \brief List of current subscribers with subscription counts
143 //!
144 //! Contains the simulation addresses of all clients currently subscribed
145 //! to receive radar sensor data updates, with a count of subscriptions for each.
147};
148
149} // namespace makVre
A reader-writer list of radar contact information elements.
Definition radarContactInfoList.h:35
Radar sensor for detecting objects and publishing emitter systems.
Definition vreRadarObjectSensor.h:40
DtVreRadarObjectSensorMonitor()
Default constructor (not implemented)
virtual int numberOfSubscribers() override
Gets the number of current subscribers.
virtual void processSensorDataRequest(DtSimMessage *msg) override
Processes a sensor data request message.
const DtVreRadarObjectSensorMonitor & operator=(const DtVreRadarObjectSensorMonitor &orig)
Assignment operator (not implemented)
virtual void removeFromSubscriberList(const DtSimulationAddress &add) override
Removes a client from the subscriber list.
virtual void processSensorDataUnsubscribe(DtSimMessage *msg) override
Processes a sensor data unsubscribe message.
virtual void addToSubscriberList(const DtSimulationAddress &add) override
Adds a client to the subscriber list.
virtual ~DtVreRadarObjectSensorMonitor() override
Virtual destructor.
std::map< DtSimulationAddress, int > DtSubscriberListCounter
Type definition for the subscriber list with counter.
Definition vreRadarObjectSensorMonitor.h:140
virtual void createAndSendSensorDataMessage() override
Creates and sends a sensor data message to subscribers.
DtVreRadarObjectSensorMonitor(const DtVreRadarObjectSensorMonitor &orig)
Copy constructor (not implemented)
DtVreRadarObjectSensorMonitor(DtLocalObject *hostObject, const DtSensorContactInfoList *contactInfoList, const DtString &sensorName, int sensorType, DtObjectSensorPSR *psr)
Constructor.
const DtRadarContactInfoList * myRadarContactInfoList
Pointer to the radar contact information list.
Definition vreRadarObjectSensorMonitor.h:134
DtSubscriberListCounter mySubscriberListCounter
List of current subscribers with subscription counts.
Definition vreRadarObjectSensorMonitor.h:146
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49