VR-Engage  2.2
Loading...
Searching...
No Matches
radarStateMonitor.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file radarStateMonitor.h
7//! \ingroup vreVrfmodel
8//! \brief Monitor for managing radar state information communication
9//!
10//! This file defines the DtRadarStateMonitor class which manages
11//! the communication of radar state information between a radar system
12//! and visualization systems. It handles subscription requests and notifications
13//! when radar state changes.
14
15#pragma once
16
17#include "vreVrfmodel/export.h"
18
19class DtSimMessage;
21
22namespace makVre
23{
24
25//! \brief Monitor for managing radar state information communication
26//!
27//! DtRadarStateMonitor manages the communication of radar state information
28//! between a radar system and visualization systems. It handles subscription
29//! requests from clients, maintains a list of current subscribers, and sends
30//! radar state messages when the radar state changes.
32{
33private:
34 //! \brief Default constructor (not implemented)
35 //!
36 //! Default constructor is private and not implemented to prevent
37 //! creation of instances without proper initialization.
39
40 //! \brief Copy constructor (not implemented)
41 //!
42 //! Copy constructor is private and not implemented to prevent
43 //! copy construction.
45
46 //! \brief Assignment operator (not implemented)
47 //! \return Reference to this object
48 //!
49 //! Assignment operator is private and not implemented to prevent assignment.
51
52public:
53 //! \brief Constructor
54 //! \param hostObject The local object that owns the radar this monitor is for
55 //! \param contactInfoList Pointer to the radar state information maintained by the radar
56 //!
57 //! Creates a new radar state monitor that will handle communication between the
58 //! specified radar system and visualization clients.
59 DtRadarStateMonitor(DtLocalObject* hostObject, const DtRwRadarStateInfo* contactInfoList);
60
61 //! \brief Virtual destructor
62 //!
63 //! Cleans up resources used by the radar state monitor.
65
66 //! \brief Initializes the monitor
67 //! \return True if initialization is successful, false otherwise
68 //!
69 //! Initializes the monitor by registering message callbacks to handle
70 //! subscription requests from clients. Called after construction.
71 virtual bool init();
72
73 //! \brief Sets the radar name
74 //! \param val The name to set for the radar
75 //!
76 //! Sets the name identifier for the radar being monitored.
77 virtual void setRadarName(const DtString& val);
78
79 //! \brief Gets the radar name
80 //! \return The name of the radar being monitored
81 //!
82 //! Retrieves the name identifier for the radar being monitored.
83 virtual DtString radarName() const;
84
85 //! \brief Registers message callbacks for radar state requests
86 //!
87 //! Registers callback functions to handle radarStateRequest and
88 //! radarStateUnsubscribe messages from visualization clients.
90
91 //! \brief Static callback function for radar state request messages
92 //! \param msg The simulation message containing the request
93 //! \param usrData User data pointer (contains the monitor instance)
94 //!
95 //! Static function registered as a callback to handle radar state request
96 //! messages. Forwards the request to the appropriate monitor instance.
97 static void radarStateRequestCallback(DtSimMessage* msg, void* usrData);
98
99 //! \brief Processes a radar state request message
100 //! \param msg The simulation message containing the request
101 //!
102 //! Handles subscription requests for radar state data,
103 //! adding the client to the subscriber list and sending initial data.
104 virtual void processRadarStateRequest(DtSimMessage* msg);
105
106 //! \brief Static callback function for radar state unsubscribe messages
107 //! \param msg The simulation message containing the unsubscribe request
108 //! \param usrData User data pointer (contains the monitor instance)
109 //!
110 //! Static function registered as a callback to handle radar state unsubscribe
111 //! messages. Forwards the request to the appropriate monitor instance.
112 static void radarStateUnsubscribeCallback(DtSimMessage* msg, void* usrData);
113
114 //! \brief Processes a radar state unsubscribe message
115 //! \param msg The simulation message containing the unsubscribe request
116 //!
117 //! Handles unsubscription requests for radar state data,
118 //! removing the client from the subscriber list.
119 virtual void processRadarStateUnsubscribe(DtSimMessage* msg);
120
121 //! \brief Creates and sends a radar state message to subscribers
122 //!
123 //! Constructs a DtRadarState message based on the current state of
124 //! the radar system and sends it to all current subscribers.
125 //! This provides visualization clients with up-to-date radar state information.
127
128 //! \brief Notifies that the radar state has changed
129 //!
130 //! Called by the radar system whenever its state changes. This triggers
131 //! radar state messages to be sent out to all current subscribers,
132 //! ensuring they have the latest state information.
134
135protected:
136 //! \brief Adds a client to the subscriber list
137 //! \param add The simulation address of the client to add
138 //!
139 //! Adds the specified client address to the list of subscribers
140 //! for this radar's state data. Maintains a counter for each address
141 //! to support multiple subscriptions from the same client.
142 virtual void addToSubscriberList(const DtSimulationAddress& add);
143
144 //! \brief Removes a client from the subscriber list
145 //! \param add The simulation address of the client to remove
146 //!
147 //! Removes one subscription entry for the specified client address
148 //! from the list of subscribers. Only completely removes the client
149 //! when all subscription instances are removed.
150 virtual void removeFromSubscriberList(const DtSimulationAddress& add);
151
152 //! \brief Gets the number of current subscribers
153 //! \return The number of clients currently subscribed to this radar's state data
154 //!
155 //! Returns the count of unique clients currently subscribed to receive
156 //! radar state updates.
157 virtual int numberOfSubscribers();
158
159protected:
160 //! \brief Pointer to the local object that owns the radar
161 //!
162 //! The entity object that owns the radar this monitor is associated with.
163 DtLocalObject* myHostObject;
164
165 //! \brief Name of the radar
166 //!
167 //! String identifier for the radar being monitored.
168 DtString myRadarName;
169
170 //! \brief Pointer to the radar state information
171 //!
172 //! Contains the current state information for the radar system.
174
175 //! \brief Type definition for the subscriber list with counter
176 //!
177 //! Defines the container type used to store simulation addresses of subscribers
178 //! with a counter for each to track multiple subscriptions from the same client.
179 using DtSubscriberListCounter = std::map<DtSimulationAddress, int>;
180
181 //! \brief List of current subscribers with subscription counts
182 //!
183 //! Contains the simulation addresses of all clients currently subscribed
184 //! to receive radar state updates, with a count of subscriptions for each.
186};
187
188} // namespace makVre
Radar state information class for radar system configurations.
Definition rwRadarStateInfo.h:32
const DtRadarStateMonitor & operator=(const DtRadarStateMonitor &orig)
Assignment operator (not implemented)
virtual void processRadarStateUnsubscribe(DtSimMessage *msg)
Processes a radar state unsubscribe message.
virtual void setRadarName(const DtString &val)
Sets the radar name.
virtual void removeFromSubscriberList(const DtSimulationAddress &add)
Removes a client from the subscriber list.
virtual int numberOfSubscribers()
Gets the number of current subscribers.
DtString myRadarName
Name of the radar.
Definition radarStateMonitor.h:168
virtual void createAndSendRadarStateMessage()
Creates and sends a radar state message to subscribers.
virtual DtString radarName() const
Gets the radar name.
const DtRwRadarStateInfo * myRadarStateInfo
Pointer to the radar state information.
Definition radarStateMonitor.h:173
virtual void notifyRadarStateChanged()
Notifies that the radar state has changed.
virtual ~DtRadarStateMonitor()
Virtual destructor.
static void radarStateRequestCallback(DtSimMessage *msg, void *usrData)
Static callback function for radar state request messages.
DtRadarStateMonitor(const DtRadarStateMonitor &orig)
Copy constructor (not implemented)
virtual bool init()
Initializes the monitor.
static void radarStateUnsubscribeCallback(DtSimMessage *msg, void *usrData)
Static callback function for radar state unsubscribe messages.
DtRadarStateMonitor()
Default constructor (not implemented)
DtSubscriberListCounter mySubscriberList
List of current subscribers with subscription counts.
Definition radarStateMonitor.h:185
DtRadarStateMonitor(DtLocalObject *hostObject, const DtRwRadarStateInfo *contactInfoList)
Constructor.
virtual void registerMessageCallbacks()
Registers message callbacks for radar state requests.
DtLocalObject * myHostObject
Pointer to the local object that owns the radar.
Definition radarStateMonitor.h:163
std::map< DtSimulationAddress, int > DtSubscriberListCounter
Type definition for the subscriber list with counter.
Definition radarStateMonitor.h:179
virtual void processRadarStateRequest(DtSimMessage *msg)
Processes a radar state request message.
virtual void addToSubscriberList(const DtSimulationAddress &add)
Adds a client to the subscriber list.
Defines export macros for the vreVrfmodel library.
#define VREVRFMODEL_DLL
Definition export.h:22
Include export definitions for this library.
Definition glsVreMessageUtil.h:49