VR-Engage  2.2
Loading...
Searching...
No Matches
rwrContactInfoList.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2025 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file rwrContactInfoList.h
7//! \ingroup vreVrfobjparam
8//! \brief Radar Warning Receiver (RWR) contact information list
9//!
10//! This file defines the DtRwrContactInfoList class, which manages collections of
11//! radar warning receiver contact information in VREngage. It provides functionality
12//! for tracking detected radar emitters and their properties.
13#pragma once
14
16
17#include <readerWriter/rwList.h>
18#include <readerWriter/noArgumentCallbackList.h>
19
20class DtReaderWriterRegistry;
21class DtString;
23
24namespace makVre
25{
26//! \brief Type identifier string for the RWR contact info list
27const char DtRwrContactInfoListType[] = "DtRwrContactInfoList";
28
29//! \brief A reader-writer list of RWR contact information elements
30//!
31//! This class manages a collection of DtRwRwrContactInfo elements, representing
32//! radar contacts detected by a Radar Warning Receiver. It provides methods for
33//! adding, removing, and finding contact information, as well as notification
34//! mechanisms for tracking changes to the list.
35//!
36//! Use the DtRwList::add() and remove() methods to add and remove elements.
37//! The list can be iterated through using DtList iteration methods.
38//! The list will delete all of its contents when destroyed, so use caution
39//! if holding pointers to any of the list elements.
40//!
41//! If you need to monitor the change state of a list, use a DtRwrContactInfoListChangeMonitor.
43{
44public:
45 //! \brief Default constructor
46 //!
47 //! Creates a new RWR contact information list with default values.
49
50 //! \brief Constructor with name
51 //! \param name The name of this list
52 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
53 //!
54 //! Creates a new RWR contact information list with the specified name.
55 DtRwrContactInfoList(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL);
56
57 //! \brief Constructor with name as symbol string
58 //! \param name The name of this list as a symbol string
59 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
60 //!
61 //! Creates a new RWR contact information list with the specified name.
62 DtRwrContactInfoList(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL);
63
64 //! \brief Virtual destructor
65 //!
66 //! Cleans up resources used by the list, including deleting all contact information elements.
67 virtual ~DtRwrContactInfoList() override;
68
69 //! \brief Copy constructor with name
70 //! \param name The name of the new list
71 //! \param orig The source list to copy from
72 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
73 //!
74 //! Creates a new RWR contact information list as a deep copy of the provided original,
75 //! cloning all list items onto the new list.
77 const DtString& name, const DtRwrContactInfoList& orig, DtReaderWriterRegistry* parentRegistry = NULL);
78
79 //! \brief Copy constructor with name as symbol string
80 //! \param name The name of the new list as a symbol string
81 //! \param orig The source list to copy from
82 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
83 //!
84 //! Creates a new RWR contact information list as a deep copy of the provided original,
85 //! cloning all list items onto the new list.
87 const DtSymbolString& name, const DtRwrContactInfoList& orig, DtReaderWriterRegistry* parentRegistry = NULL);
88
89 //! \brief Assignment operator
90 //! \param orig The source list to copy from
91 //! \return Reference to this list after assignment
92 //!
93 //! Assigns the contents of the provided list to this one. This is a deep copy;
94 //! all items on the target list are deleted, and new items are cloned onto the list.
96
97 //! \brief Creates a complete clone of the list and all items
98 //! \param name The name for the cloned list
99 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
100 //! \return Pointer to a new list that is a clone of this one
101 //!
102 //! Creates a complete clone of this list and all items on it.
103 virtual DtRwrContactInfoList* clone(const DtString& name, DtReaderWriterRegistry* parentRegistry = NULL);
104
105 //! \brief Creates a complete clone of the list and all items
106 //! \param name The name for the cloned list as a symbol string
107 //! \param parentRegistry Parent registry for reader/writer functionality (optional)
108 //! \return Pointer to a new list that is a clone of this one
109 //!
110 //! Creates a complete clone of this list and all items on it.
111 virtual DtRwrContactInfoList* clone(const DtSymbolString& name, DtReaderWriterRegistry* parentRegistry = NULL);
112
113 //! \brief Clears the list
114 //!
115 //! Removes and deletes all contact information elements from the list.
116 //! This method calls the non-virtual emptyList() function.
117 virtual void clear();
118
119 //! \brief Removes and deletes a contact information element
120 //! \param contactInfo Pointer to the contact information to remove and delete
121 //!
122 //! If the specified contact info is on the list, removes it from the list
123 //! and deletes the contact info object.
124 virtual void removeAndDelete(DtRwRwrContactInfo* contactInfo);
125
126 //! \brief Commented-out method for finding contact info by contact ID
127 //!
128 //! Would find the first contact info in the list with the specified contact,
129 //! and return a pointer to it, or NULL if not found.
130 // virtual DtRwRwrContactInfo* findContactInfoByContact(const DtUUID& contact);
131
132 //! \brief Commented-out method for getting all contact IDs
133 //!
134 //! Would return a set of all the contact IDs in the list.
135 // virtual std::set<DtUUID> contacts() const;
136
137 //! \brief Factory method to create new RWR contact information elements
138 //! \return Pointer to a newly created RWR contact information element
139 //!
140 //! Creates a new DtRwRwrContactInfo or derivative object. This base class
141 //! implementation creates the base DtRwRwrContactInfo type.
142 //!
143 //! The getData() method uses this factory when adding new items to the list
144 //! that are read from an input file. All items on the list should be of the
145 //! type created by this method.
146 //!
147 //! \note If you need to add custom data to your RWR contact information,
148 //! create a derived version of DtRwRwrContactInfo, override this class, and
149 //! return your new RWR contact info from this method.
151
152 //! \brief Adds a callback for list modification notifications
153 //! \param fcn The callback function to add
154 //! \param usr User data pointer to pass to the callback
155 //!
156 //! Registers a callback that will be invoked when the list or any of its
157 //! contents change.
158 //!
159 //! \note If you want list modified notification in an asynchronous way, consider
160 //! using a DtRwrContactInfoListChangeMonitor instead.
161 virtual void addModifiedCallback(DtNoArgumentCallbackList::DtCallbackFunctionType fcn, void* usr);
162
163 //! \brief Removes a callback for list modification notifications
164 //! \param fcn The callback function to remove
165 //! \param usr User data pointer that was registered with the callback
166 //!
167 //! Unregisters a previously registered modification callback.
168 virtual void removeModifiedCallback(DtNoArgumentCallbackList::DtCallbackFunctionType fcn, void* usr);
169
170 //! \brief Notifies that the list has been modified
171 //!
172 //! Call this method after making changes to the contents of the list.
173 //! This will invoke all registered modification callbacks.
174 virtual void listModified();
175
176 //! \brief Equality operator
177 //! \param other The list to compare with
178 //! \return True if the lists are equal, false otherwise
179 //!
180 //! Compares this list with another to determine if they are equal.
181 bool operator==(const DtRwrContactInfoList& other) const;
182
183 //! \brief Gets the XML type identifier
184 //! \return String identifying this type in XML archives
185 //!
186 //! Returns the type identifier used when archiving to an XML stream.
187 static const char* theXmlType();
188
189 //! \brief Gets the XML type identifier for this instance
190 //! \return String identifying this type in XML archives
191 //!
192 //! Returns the type identifier used when archiving this instance to an XML stream.
193 virtual const char* xmlType() const override { return theXmlType(); }
194
195protected:
196 //! \brief Copies contents from another list
197 //! \param orig The source list to copy from
198 //!
199 //! Helper method used by constructors to copy contents from another list.
200 //! Performs a deep copy of all list elements.
202
203 //! \brief Removes and deletes all list elements
204 //!
205 //! Helper method used by the destructor and clear() to remove and delete
206 //! all elements from the list.
207 void emptyList();
208
209 //! \brief Processes input data to populate the list
210 //! \param args Input arguments to process
211 //! \param searchPaths Search paths for resolving file references
212 //! \param variableBindings Variable bindings for resolving script variables
213 //! \return Object pointer containing the processed data
214 //!
215 //! Constructs contact information elements and reads their data from
216 //! the input arguments.
217 virtual DtlObjPtr getData(DtlObjPtr args,
218 const DtReaderWriter::SearchPaths& searchPaths,
219 const DtVariableBindingsList& variableBindings) override;
220
221 //! \brief Gets the reader/writer type identifier
222 //! \return String identifying this reader/writer type
223 //!
224 //! Returns the type identifier for this reader/writer class.
225 //! This can be used in place of dynamic-casting and is also used by
226 //! the OPD editor to determine which type of control to create.
227 virtual const char* readerWriterType() const override;
228
229 //! \brief List of callbacks for modification notifications
230 //!
231 //! Stores the list of callback functions to be invoked when the list
232 //! or its contents are modified.
233 DtNoArgumentCallbackList myModifiedCallbackList;
234
235protected:
236};
237
238//! \brief Monitor class for tracking changes to an RWR contact information list
239//!
240//! This class provides a mechanism for monitoring a DtRwrContactInfoList for changes.
241//! When instantiated, this class registers a callback with the list and maintains
242//! internal state as to whether the callback has been invoked since the last time
243//! listChanged() was called.
245{
246private:
247 //! \brief Default constructor (not implemented)
248 //!
249 //! Default constructor is private and not implemented to prevent
250 //! creation of instances without a list to monitor.
252
253 //! \brief Copy constructor (not implemented)
254 //! \param orig The source monitor to copy from
255 //!
256 //! Copy constructor is private and not implemented to prevent copying.
258
259 //! \brief Assignment operator (not implemented)
260 //! \param orig The source monitor to copy from
261 //! \return Reference to this monitor after assignment
262 //!
263 //! Assignment operator is private and not implemented to prevent assignment.
265
266public:
267 //! \brief Constructor with list to monitor
268 //! \param contactInfoList Reference to the list to monitor for changes
269 //!
270 //! Creates a new monitor that will track changes to the specified RWR contact list.
272
273 //! \brief Destructor
274 //!
275 //! Cleans up resources used by the monitor, including unregistering callbacks.
277
278 //! \brief Checks if the list has been changed
279 //! \return True if the list has been changed, false otherwise
280 //!
281 //! Returns whether the list has been changed since the last time the changed
282 //! state was reset. Does not reset the changed value.
283 bool listChanged() const;
284
285 //! \brief Resets the list changed state
286 //!
287 //! Resets the listChanged state of the monitor to false.
288 //! This will not affect any other monitors on the same list.
290
291 //! \brief Checks and resets the list changed state
292 //! \return True if the list has been changed, false otherwise
293 //!
294 //! Returns whether the list has been changed since the last time the changed
295 //! state was reset, and resets the list changed state to false.
297
298protected:
299 //! \brief Static callback function for list changes
300 //! \param usr User data pointer (instance of this monitor)
301 //!
302 //! Static callback function registered with the list to be notified of changes.
303 static void listChangedCallback(void* usr);
304
305 //! \brief Processes list changed notifications
306 //!
307 //! Internal method called when the list has changed to update the internal state.
309
310 //! \brief Reference to the monitored list
311 //!
312 //! Reference to the RWR contact information list being monitored for changes.
314
315 //! \brief Flag indicating if the list has changed
316 //!
317 //! Stores whether the list has changed since the last time the changed state was reset.
319};
320} // namespace makVre
Radar Warning Receiver (RWR) contact information class.
Definition rwRwrContactInfo.h:34
static void listChangedCallback(void *usr)
Static callback function for list changes.
DtRwrContactInfoList & myContactInfoList
Reference to the monitored list.
Definition rwrContactInfoList.h:313
void processListChanged()
Processes list changed notifications.
void markUnchanged()
Resets the list changed state.
DtRwrContactInfoListChangeMonitor(const DtRwrContactInfoListChangeMonitor &orig)
Copy constructor (not implemented)
bool listChanged() const
Checks if the list has been changed.
bool checkAndResetListChanged()
Checks and resets the list changed state.
DtRwrContactInfoListChangeMonitor(DtRwrContactInfoList &contactInfoList)
Constructor with list to monitor.
DtRwrContactInfoListChangeMonitor & operator=(DtRwrContactInfoListChangeMonitor &orig)
Assignment operator (not implemented)
DtRwrContactInfoListChangeMonitor()
Default constructor (not implemented)
bool myListChanged
Flag indicating if the list has changed.
Definition rwrContactInfoList.h:318
A reader-writer list of RWR contact information elements.
Definition rwrContactInfoList.h:43
DtRwrContactInfoList(const DtString &name, const DtRwrContactInfoList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Copy constructor with name.
DtRwrContactInfoList(const DtSymbolString &name, const DtRwrContactInfoList &orig, DtReaderWriterRegistry *parentRegistry=NULL)
Copy constructor with name as symbol string.
void emptyList()
Removes and deletes all list elements.
static const char * theXmlType()
Gets the XML type identifier.
virtual void clear()
Clears the list.
virtual ~DtRwrContactInfoList() override
Virtual destructor.
virtual DtRwRwrContactInfo * createRwrContactInfo()
Commented-out method for finding contact info by contact ID.
virtual void addModifiedCallback(DtNoArgumentCallbackList::DtCallbackFunctionType fcn, void *usr)
Adds a callback for list modification notifications.
virtual void removeModifiedCallback(DtNoArgumentCallbackList::DtCallbackFunctionType fcn, void *usr)
Removes a callback for list modification notifications.
virtual void listModified()
Notifies that the list has been modified.
virtual DtRwrContactInfoList * clone(const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Creates a complete clone of the list and all items.
DtRwrContactInfoList(const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Constructor with name.
virtual DtlObjPtr getData(DtlObjPtr args, const DtReaderWriter::SearchPaths &searchPaths, const DtVariableBindingsList &variableBindings) override
Processes input data to populate the list.
DtRwrContactInfoList(const DtSymbolString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Constructor with name as symbol string.
DtNoArgumentCallbackList myModifiedCallbackList
List of callbacks for modification notifications.
Definition rwrContactInfoList.h:233
void copyList(const DtRwrContactInfoList &orig)
Copies contents from another list.
virtual const char * xmlType() const override
Gets the XML type identifier for this instance.
Definition rwrContactInfoList.h:193
bool operator==(const DtRwrContactInfoList &other) const
Equality operator.
virtual void removeAndDelete(DtRwRwrContactInfo *contactInfo)
Removes and deletes a contact information element.
DtRwrContactInfoList()
Default constructor.
DtRwrContactInfoList & operator=(const DtRwrContactInfoList &orig)
Assignment operator.
virtual const char * readerWriterType() const override
Gets the reader/writer type identifier.
virtual DtRwrContactInfoList * clone(const DtString &name, DtReaderWriterRegistry *parentRegistry=NULL)
Creates a complete clone of the list and all items.
Export macros for the VREngage Object Parameter library.
#define VREVRFOBJPARAM_DLL
Platform-specific DLL export/import declaration.
Definition export.h:27
Include export definitions for this library.
Definition glsVreMessageUtil.h:49
const char DtRwrContactInfoListType[]
Type identifier string for the RWR contact info list.
Definition rwrContactInfoList.h:27