VR-Engage  2.3
Loading...
Searching...
No Matches
vreAssignmentTracker.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2026 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreAssignmentTracker.h
7//! \ingroup vreManager
8//! \brief Centralized tracking of VR-Engage station assignments
9//!
10//! This file defines the DtVreAssignmentTracker class, which provides a unified
11//! view of confirmed and pending station assignments for the VR-Engage Manager
12//! Panel. It wraps DtVreStatusListener for confirmed state and maintains pending
13//! user edits separately.
14
15#pragma once
16
17#include "vreManager/export.h"
19
20#include <QObject>
21
22#include <functional>
23#include <map>
24#include <set>
25#include <string>
26#include <vector>
27
29
30
31namespace makVre
32{
33
34//! \brief Structure representing a role assignment for display
35//!
36//! Contains information about a single role on an entity and its assignment
37//! status, including both confirmed station assignments and any pending changes.
38//! This structure is returned by getRoleAssignments() to provide the UI with
39//! all information needed to display a role's state.
40//!
41//! \par Example Usage
42//! \code
43//! std::vector<DtRoleAssignment> assignments = tracker.getRoleAssignments(entityUUID, roles);
44//! for (const auto& assignment : assignments)
45//! {
46//! if (assignment.myHasConflict)
47//! {
48//! showWarningIcon(assignment.myRoleName);
49//! }
50//! }
51//! \endcode
53{
54 //! \brief The role name (e.g., "driver", "gunner", "commander")
55 std::string myRoleName;
56
57 //! \brief Station IDs currently assigned to this role (confirmed state)
58 //!
59 //! May contain multiple IDs if multiple stations were assigned to the
60 //! same role directly at VRE stations (bypassing the Manager Panel).
61 //! Empty if the role is unassigned.
62 std::vector<std::string> myStationIds;
63
64 //! \brief Station names for display (parallel to myStationIds)
65 std::vector<std::string> myStationNames;
66
67 //! \brief Whether each station is a spectator (parallel to myStationIds)
68 std::vector<bool> myStationSpectatorFlags;
69
70 //! \brief Whether each station is a pending assignment (parallel to myStationIds)
71 //!
72 //! True for stations that have been assigned via the Manager Panel but not yet
73 //! submitted. False for confirmed stations from VRE status updates.
74 std::vector<bool> myStationPendingFlags;
75
76 //! \brief True if 2+ non-spectator stations are on this role (unresolved conflict)
77 //!
78 //! A conflict exists when two or more stations assigned to the same role are
79 //! not in spectator mode. This includes both confirmed and pending stations.
80 //! The Submit button is disabled until all conflicts are resolved.
81 bool myHasConflict = false;
82};
83
84
85//! \brief Structure representing a pending assignment for submit iteration
86//!
87//! Contains all information needed to send an assignment message when the
88//! user clicks Submit. Returned by getPendingAssignments() for the submit
89//! workflow.
91{
92 //! \brief Station ID receiving the assignment
93 std::string myStationId;
94
95 //! \brief The entity UUID being assigned to
97
98 //! \brief The role name being assigned
99 std::string myRoleName;
100
101 //! \brief Whether spectator mode should be enabled
102 bool mySpectatorMode = false;
103};
104
105
106//! \brief Represents an offline placeholder station whose assignment is saved
107//! but whose real station is not currently connected.
109{
110 //! \brief Synthetic station ID assigned to the placeholder
111 std::string myStationId;
112
113 //! \brief Name of the offline station (used for matching on discovery)
114 std::string myStationName;
115
116 //! \brief UUID of the entity the placeholder is assigned to
118
119 //! \brief Entity object name from the saved layout, for display
120 //!
121 //! Persisted alongside the UUID so an offline card can label its assignment
122 //! even when the saved UUID form does not reconstruct to a resolvable DtUUID.
123 std::string myObjectName;
124
125 //! \brief Role name the placeholder holds (e.g., "driver", "gunner")
126 std::string myRoleName;
127
128 //! \brief Whether spectator mode is enabled for this placeholder assignment
129 bool mySpectatorMode = false;
130};
131
132
133//! \brief Centralized tracking of confirmed and pending station assignments
134//!
135//! DtVreAssignmentTracker provides a unified view of VR-Engage station
136//! assignments, combining confirmed assignments from DtVreStatusListener
137//! with pending user edits. It serves as the single source of truth for
138//! the Manager Panel UI, providing query methods for displaying assignment
139//! state and tracking conflicts when pending assignments would displace
140//! existing stations.
141//!
142//! \par Key Concepts
143//! - **Confirmed assignments**: Current state from DtVreStatusListener,
144//! representing what stations are actually controlling
145//! - **Pending assignments**: User edits not yet submitted, stored locally
146//! in this tracker
147//! - **Conflicts**: When a pending assignment targets a role that already
148//! has a confirmed station
149//! - **Conflict detection**: Roles with 2+ non-spectator stations are flagged
150//! as conflicts that must be resolved before submission
151//!
152//! \par Thread Safety
153//! This class must only be used from the GUI thread.
154//!
155//! \par Example Usage
156//! \code
157//! // Create tracker attached to the status listener
158//! DtVreAssignmentTracker tracker(statusListener);
159//!
160//! // User assigns a station to a role
161//! tracker.setPendingAssignment(stationId, entityUUID, "driver");
162//!
163//! // Check if there are conflicts before submit
164//! int pending, conflicts;
165//! tracker.getPendingCounts(pending, conflicts);
166//! if (conflicts > 0)
167//! {
168//! // Conflicts must be resolved before submit
169//! return;
170//! }
171//!
172//! // Get stations that will be unassigned by pending assignments
173//! auto toUnassign = tracker.getStationsToUnassign();
174//! if (!toUnassign.empty())
175//! {
176//! showConfirmationDialog(toUnassign);
177//! }
178//!
179//! // Submit the assignments
180//! for (const auto& assignment : tracker.getPendingAssignments())
181//! {
182//! sendAssignMessage(assignment);
183//! }
184//! tracker.clearAllPendingAssignments();
185//! \endcode
187{
188 Q_OBJECT
189
190public:
191 //! \brief Constructor
192 //! \param statusListener Reference to the status listener for confirmed assignments
193 //! \param parent Optional parent QObject for Qt memory management
194 //!
195 //! Creates a tracker that monitors the given status listener for confirmed
196 //! assignment state. Registers callbacks with the listener to receive
197 //! notifications when stations are added, removed, or changed.
198 DtVreAssignmentTracker(DtVreStatusListener& statusListener, QObject* parent = nullptr);
199
200 //! \brief Destructor
201 //!
202 //! Unregisters callbacks from the status listener.
203 virtual ~DtVreAssignmentTracker() override;
204
205 // -------------------------------------------------------------------------
206 //! @name Pending Assignment Management
207 //! Methods for creating and clearing pending (uncommitted) assignments.
208 //! @{
209 // -------------------------------------------------------------------------
210
211 //! \brief Sets a pending assignment for a station
212 //! \param stationId The station ID to assign
213 //! \param entityUUID The entity UUID to assign to
214 //! \param roleName The role name to assign (e.g., "driver", "gunner")
215 //! \param spectatorMode Whether spectator mode should be enabled
216 //!
217 //! Creates or updates a pending assignment for the specified station.
218 //! Multiple pending assignments to the same entity+role are allowed.
219 //! This may create a conflict (2+ non-spectator on same role) that the
220 //! user must resolve before submitting.
221 //!
222 //! Emits assignmentStateChanged() after updating state.
224 std::string stationId, const DtUUID& entityUUID, const std::string& roleName, bool spectatorMode = false);
225
226 //! \brief Toggles spectator mode on an existing pending assignment
227 //! \param stationId The station ID with the pending assignment
228 //! \param spectatorMode True for spectator, false for normal
229 //!
230 //! Changes the spectator flag on an existing pending assignment.
231 //! Has no effect if the station has no pending assignment.
232 //!
233 //! Emits assignmentStateChanged() if the flag was changed.
234 virtual void setPendingSpectatorMode(std::string stationId, bool spectatorMode);
235
236 //! \brief Sets a pending unassignment for a station
237 //! \param stationId The station ID to mark for unassignment
238 //!
239 //! Marks a station with a confirmed assignment for unassignment.
240 //! On submit, DtIfUnassignRolePlayer is sent to this station.
241 //! If the station has a pending assignment, it is cleared first.
242 //!
243 //! Emits assignmentStateChanged() after updating state.
244 virtual void setPendingUnassignment(std::string stationId);
245
246 //! \brief Clears the pending assignment or unassignment for a station
247 //! \param stationId The station ID to clear
248 //!
249 //! Removes any pending assignment or pending unassignment for the
250 //! specified station, returning it to its confirmed state. Has no
251 //! effect if the station has no pending state.
252 //!
253 //! Emits assignmentStateChanged() if state was changed.
254 virtual void clearPendingAssignment(std::string stationId);
255
256 //! \brief Clears all pending assignments
257 //!
258 //! Removes all pending assignments, returning all stations to their
259 //! confirmed state. Typically called after Submit to clear the pending
260 //! state, or on Revert to discard user edits.
261 //!
262 //! Emits assignmentStateChanged() if any state was changed.
264
265 //! @}
266
267 // -------------------------------------------------------------------------
268 //! @name Query Methods
269 //! Methods for querying assignment state for UI display.
270 //! @{
271 // -------------------------------------------------------------------------
272
273 //! \brief Gets all stations assigned to a specific role
274 //! \param entityUUID The entity UUID
275 //! \param roleName The role name
276 //! \param includePending If true, includes pending assignments in results
277 //! \return List of station IDs assigned to this role
278 //!
279 //! Returns confirmed station assignments, optionally merged with pending
280 //! assignments. When includePending is true, pending assignments replace
281 //! any confirmed assignment for the same station.
282 virtual std::vector<std::string> getAssignedStations(
283 const DtUUID& entityUUID, const std::string& roleName, bool includePending = true) const;
284
285 //! \brief Gets role assignment information for all roles on an entity
286 //! \param entityUUID The entity UUID
287 //! \param availableRoles List of available role names for this entity
288 //! \return List of DtRoleAssignment structures with assignment status for each role
289 //!
290 //! Returns complete assignment information for each role, suitable for
291 //! populating the entity/role tree view. Each DtRoleAssignment contains
292 //! both confirmed and pending state, plus conflict indicators.
293 virtual std::vector<DtRoleAssignment> getRoleAssignments(const DtUUID& entityUUID,
294 const std::vector<std::string>& availableRoles) const;
295
296 //! \brief Gets the current assignment for a station
297 //! \param stationId The station ID to query
298 //! \param entityUUID Output parameter for entity UUID
299 //! \param roleName Output parameter for role name
300 //! \param isPending Output parameter indicating if assignment is pending
301 //! \return True if station has an assignment (confirmed or pending)
302 //!
303 //! Returns the effective assignment for a station, preferring pending
304 //! state over confirmed state when both exist.
306 std::string stationId, DtUUID& entityUUID, std::string& roleName, bool& isPending) const;
307
308 //! \brief Checks if a station is part of an unresolved conflict
309 //! (2+ non-spectator stations on the same entity+role)
310 //! \param stationId The station ID to check
311 //! \return True if the station is involved in an unresolved conflict
312 virtual bool hasConflict(std::string stationId) const;
313
314 //! \brief Checks if any entity+role has 2+ non-spectator stations
315 //! When true, the Submit button is disabled.
316 //! \return True if unresolved conflicts exist
317 virtual bool hasUnresolvedConflicts() const;
318
319 //! \brief Returns the number of roles with unresolved conflicts
320 //! \return Count of entity+role pairs with 2+ non-spectator stations
321 virtual int getConflictCount() const;
322
323 //! \brief Returns confirmed stations that will be unassigned on submit
324 //!
325 //! Returns confirmed non-spectator stations whose role is being taken by
326 //! a pending assignment from a different station. Excludes stations that
327 //! have their own pending reassignment to another role. Excludes spectator
328 //! stations.
329 //! \return List of station IDs that will be unassigned
330 virtual std::vector<std::string> getStationsToUnassign() const;
331
332 //! \brief Gets all pending assignments for submit iteration
333 //! \return List of pending assignment info structures
334 //!
335 //! Returns all pending assignments in a form suitable for sending
336 //! DtIfAssignRolePlayer messages during submit. Does not include
337 //! pending unassignments (use getPendingUnassignments() for those).
338 virtual std::vector<DtPendingAssignmentInfo> getPendingAssignments() const;
339
340 //! \brief Gets all stations with pending unassignments
341 //! \return List of station IDs marked for unassignment
342 //!
343 //! Returns station IDs that the user explicitly marked for
344 //! unassignment. On submit, DtIfUnassignRolePlayer is sent to each.
345 virtual std::vector<std::string> getPendingUnassignments() const;
346
347 //! \brief Checks if a station has a pending unassignment
348 //! \param stationId The station ID to check
349 //! \return True if the station is marked for pending unassignment
350 virtual bool hasPendingUnassignment(std::string stationId) const;
351
352 //! \brief Gets the confirmed entity UUID for a station
353 //! \param stationId The station ID
354 //! \return Entity UUID or empty string if not assigned
355 //!
356 //! Returns only the confirmed (not pending) entity UUID. Used to
357 //! construct unassign messages for displaced stations.
358 virtual DtUUID getStationEntityUUID(std::string stationId) const;
359
360 //! \brief Gets the confirmed role name for a station
361 //! \param stationId The station ID
362 //! \return Role name or empty string if not assigned
363 //!
364 //! Returns only the confirmed (not pending) role name.
365 virtual std::string getStationRoleName(std::string stationId) const;
366
367 //! \brief Gets counts of pending changes and conflicts
368 //! \param pendingCount Output for total pending assignment count
369 //! \param conflictCount Output for count of entity+role pairs with unresolved conflicts
370 //!
371 //! Provides summary counts for the Submit button display.
372 virtual void getPendingCounts(int& pendingCount, int& conflictCount) const;
373
374 //! \brief Gets the display name for a station
375 //! \param stationId The station ID
376 //! \return Station name or empty string if station not found
377 virtual std::string getStationName(std::string stationId) const;
378
379 //! \brief Gets the saved entity object name for an offline placeholder station.
380 //! \param stationId The station ID
381 //! \return The object name persisted with the placeholder, or empty string
382 //! when the station is not a placeholder or has no saved object name.
383 //!
384 //! Offline placeholders carry the entity's object name from the saved layout
385 //! so the station card can label the assignment without depending on the
386 //! entity UUID round-tripping (a bare-hex UUID from an older save does not
387 //! reconstruct to a valid DtUUID and cannot be resolved to a name).
388 virtual std::string getStationObjectName(std::string stationId) const;
389
390 //! \brief Gets whether a station is in spectator mode
391 //! \param stationId The station ID to query
392 //! \return True if the station is in spectator mode (pending, confirmed, or preference)
393 //!
394 //! Returns the effective spectator mode for a station. Checks in order:
395 //! 1. Pending assignment spectator flag
396 //! 2. Confirmed assignment spectator flag
397 //! 3. Spectator preference (set before any assignment exists)
398 virtual bool isStationSpectator(std::string stationId) const;
399
400 //! \brief Sets the spectator mode preference for a station
401 //! \param stationId The station ID
402 //! \param spectatorMode True for spectator, false for normal
403 //!
404 //! Records a spectator preference that will be applied when a pending
405 //! assignment is created for this station. This allows the user to
406 //! pre-select spectator mode before choosing an entity/role.
407 //! If the station already has a pending assignment, its spectator flag
408 //! is updated in place.
409 //!
410 //! Emits assignmentStateChanged() if the effective state changed.
411 virtual void setSpectatorPreference(std::string stationId, bool spectatorMode);
412
413 //! @}
414
415 // -------------------------------------------------------------------------
416 //! @name Summary Queries
417 //! Methods for getting aggregate information about assignments.
418 //! @{
419 // -------------------------------------------------------------------------
420
421 //! \brief Gets count of assigned roles for an entity
422 //! \param entityUUID The entity UUID
423 //! \param availableRoles List of available role names
424 //! \return Number of roles that have at least one station assigned
425 //!
426 //! Counts roles with either confirmed or pending assignments.
427 //! Used for the entity badge display (e.g., "2/3").
428 virtual int getAssignedRoleCount(const DtUUID& entityUUID, const std::vector<std::string>& availableRoles) const;
429
430 //! \brief Gets count of unassigned stations
431 //! \return Number of stations without a confirmed assignment. Pending changes are not considered.
432 virtual int getUnassignedStationCount() const;
433
434 //! \brief Gets total station count
435 //! \return Total number of known stations
436 virtual int getTotalStationCount() const;
437
438 //! \brief Checks if there are any pending changes
439 //! \return True if any pending assignments exist
440 virtual bool hasPendingChanges() const;
441
442 //! \brief Gets all station IDs
443 //! \return Vector of all known station IDs
444 //!
445 //! Returns the IDs of all stations known to the status listener.
446 //! Used by the station list model to populate its list.
447 virtual std::vector<std::string> getAllStationIds() const;
448
449 //! \brief Checks if a station ID is a synthetic placeholder.
450 virtual bool isPlaceholderStation(std::string stationId) const;
451
452 //! \brief Returns all synthetic placeholder station IDs.
453 virtual std::vector<std::string> getPlaceholderStationIds() const;
454
455 //! \brief Exports the effective assignment snapshot for persistence.
456 //!
457 //! Returns name-based records from the merged confirmed+pending view,
458 //! excluding stations with pending unassignment.
459 virtual std::vector<DtPersistedAssignmentRecord> exportAssignmentsForPersistence() const;
460
461 //! \brief Imports saved assignments as pending state.
462 //!
463 //! For each record, if a live station with the saved name exists, creates
464 //! a pending assignment on that station. Otherwise creates a placeholder.
465 //! Records whose entity UUID fails the entityExists callback are skipped
466 //! with a warning appended to \p warnings.
467 //!
468 //! Existing pending assignments and placeholders are cleared before import.
469 //!
470 //! Records whose entity UUID is not currently in the exercise are still
471 //! imported as placeholder stations so the assignments are ready when the
472 //! entity and station appear later. This makes the function safe to call
473 //! before a scenario is loaded.
474 //!
475 //! \param records The saved assignment records to import.
476 //! \param entityExists Callback that returns true if an entity UUID is
477 //! currently in the exercise. Used only for informational logging; a
478 //! false result does not prevent the record from being imported.
479 //! \param warnings Receives non-fatal informational messages.
480 //! \param errorText Receives a fatal error string; import is aborted when non-empty.
481 //! \return true on success (check warnings for informational notes).
482 virtual bool importAssignmentsForPersistence(const std::vector<DtPersistedAssignmentRecord>& records,
483 const std::function<bool(const DtUUID&)>& entityExists,
484 std::vector<std::string>& warnings,
485 std::string& errorText);
486
487 //! @}
488
489signals:
490 //! \brief Emitted when any assignment state changes
491 //!
492 //! Emitted when pending assignments are added, cleared, or when
493 //! confirmed state changes from the status listener. UI should
494 //! refresh display when this signal is received.
496
497 //! \brief Emitted when a station is added
498 //! \param stationId The new station ID
499 void stationAdded(std::string stationId);
500
501 //! \brief Emitted when a station is removed
502 //! \param stationId The removed station ID
503 void stationRemoved(std::string stationId);
504
505 //! \brief Emitted when a station's confirmed assignment changes
506 //! \param stationId The station ID
507 void stationAssignmentChanged(std::string stationId);
508
509protected:
510 //! \brief Reference to status listener for confirmed assignments
512
513 //! \brief Internal structure for pending assignment data
515 {
516 DtUUID myEntityUUID; //!< Entity UUID for pending assignment
517 std::string myRoleName; //!< Role name for pending assignment
518 bool mySpectatorMode; //!< Spectator mode flag
519 };
520
521 //! \brief Map of station ID to pending assignment
522 //!
523 //! Contains only stations with pending (uncommitted) assignments.
524 //! Stations not in this map use their confirmed state from the listener.
525 std::map<std::string, PendingAssignment> myPendingAssignments;
526
527 //! \brief Set of station IDs with pending unassignments
528 //!
529 //! Contains station IDs that the user explicitly marked for
530 //! unassignment. These stations currently have confirmed assignments
531 //! that will be removed when the user clicks Submit.
532 std::set<std::string> myPendingUnassignments;
533
534 //! \brief Station IDs that have been removed but may still be in the listener's map
535 //!
536 //! Handles the case where the removed callback fires before the listener
537 //! erases the station from its map. Cleared on the next stationAdded call.
538 std::set<std::string> myRemovedStationIds;
539
540 //! \brief Map of station ID to pre-assignment spectator preference
541 //!
542 //! Stores spectator mode preferences for stations that do not yet have
543 //! a pending or confirmed assignment. When a pending assignment is later
544 //! created for a station with a preference, the preference is applied
545 //! automatically. Cleared alongside pending state by
546 //! clearAllPendingAssignments() / importAssignmentsForPersistence() and
547 //! pruned per-station on station removal.
548 std::map<std::string, bool> mySpectatorPreferences;
549
550 //! \brief Prefix for synthetic placeholder station IDs.
551 //!
552 //! Placeholder IDs are allocated in a reserved string namespace so they can
553 //! be distinguished from live station IDs while remaining valid string IDs.
554 static constexpr const char* thePlaceholderStationIdPrefix = "PLACE_HOLDER_BASE_";
555
556 //! \brief Next synthetic placeholder ID suffix to allocate.
558
559 //! \brief Map of placeholder station ID to placeholder data.
560 std::map<std::string, DtPlaceholderStation> myPlaceholderStations;
561
562 //! \brief Map of station name to placeholder station ID for quick lookup.
563 std::map<std::string, std::string> myPlaceholderIdsByName;
564
565 // -------------------------------------------------------------------------
566 //! @name Callback Handlers
567 //! Static callbacks registered with DtVreStatusListener.
568 //! @{
569 // -------------------------------------------------------------------------
570
571 //! \brief Callback invoked when a station is added to the listener
572 //! \param id The station ID
573 //! \param userData Pointer to the DtVreAssignmentTracker instance
574 static void onStationAdded(const std::string& id, void* userData);
575
576 //! \brief Callback invoked when a station is removed from the listener
577 //! \param id The station ID
578 //! \param userData Pointer to the DtVreAssignmentTracker instance
579 static void onStationRemoved(const std::string& id, void* userData);
580
581 //! \brief Callback invoked when a station's confirmed state changes
582 //! \param id The station ID
583 //! \param userData Pointer to the DtVreAssignmentTracker instance
584 static void onStationChanged(const std::string& id, void* userData);
585
586 //! @}
587
588private:
591 bool findLiveStationIdByName(const std::string& stationName, std::string& stationId) const;
592 void wakePlaceholderForLiveStation(std::string liveStationId);
593 void removePlaceholderStation(std::string stationId);
594
595 //! \brief Copy constructor (deleted)
597
598 //! \brief Assignment operator (deleted)
600};
601
602} // namespace makVre
Tracks the status of VREngage applications.
Definition vreListener.h:105
virtual bool hasConflict(std::string stationId) const
Checks if a station is part of an unresolved conflict (2+ non-spectator stations on the same entity+r...
void stationRemoved(std::string stationId)
Emitted when a station is removed.
virtual std::vector< std::string > getPendingUnassignments() const
Gets all stations with pending unassignments.
DtVreAssignmentTracker(DtVreStatusListener &statusListener, QObject *parent=nullptr)
Constructor.
virtual bool isPlaceholderStation(std::string stationId) const
Checks if a station ID is a synthetic placeholder.
virtual bool hasPendingChanges() const
Checks if there are any pending changes.
void stationAdded(std::string stationId)
Emitted when a station is added.
virtual bool hasPendingUnassignment(std::string stationId) const
Checks if a station has a pending unassignment.
void stationAssignmentChanged(std::string stationId)
Emitted when a station's confirmed assignment changes.
virtual std::string getStationObjectName(std::string stationId) const
Gets the saved entity object name for an offline placeholder station.
virtual void clearPendingAssignment(std::string stationId)
Clears the pending assignment or unassignment for a station.
virtual void clearAllPendingAssignments()
Clears all pending assignments.
virtual DtUUID getStationEntityUUID(std::string stationId) const
Gets the confirmed entity UUID for a station.
std::string ensurePlaceholderStation(const DtPersistedAssignmentRecord &record)
virtual std::vector< DtPendingAssignmentInfo > getPendingAssignments() const
Gets all pending assignments for submit iteration.
DtVreAssignmentTracker(const DtVreAssignmentTracker &)=delete
Copy constructor (deleted)
virtual std::vector< DtRoleAssignment > getRoleAssignments(const DtUUID &entityUUID, const std::vector< std::string > &availableRoles) const
Gets role assignment information for all roles on an entity.
std::map< std::string, bool > mySpectatorPreferences
Map of station ID to pre-assignment spectator preference.
Definition vreAssignmentTracker.h:548
std::set< std::string > myRemovedStationIds
Station IDs that have been removed but may still be in the listener's map.
Definition vreAssignmentTracker.h:538
virtual void getPendingCounts(int &pendingCount, int &conflictCount) const
Gets counts of pending changes and conflicts.
std::map< std::string, DtPlaceholderStation > myPlaceholderStations
Map of placeholder station ID to placeholder data.
Definition vreAssignmentTracker.h:560
virtual void setPendingAssignment(std::string stationId, const DtUUID &entityUUID, const std::string &roleName, bool spectatorMode=false)
Sets a pending assignment for a station.
std::set< std::string > myPendingUnassignments
Set of station IDs with pending unassignments.
Definition vreAssignmentTracker.h:532
DtVreStatusListener & myStatusListener
Reference to status listener for confirmed assignments.
Definition vreAssignmentTracker.h:511
DtVreAssignmentTracker & operator=(const DtVreAssignmentTracker &)=delete
Assignment operator (deleted)
virtual void setPendingSpectatorMode(std::string stationId, bool spectatorMode)
Toggles spectator mode on an existing pending assignment.
std::map< std::string, std::string > myPlaceholderIdsByName
Map of station name to placeholder station ID for quick lookup.
Definition vreAssignmentTracker.h:563
virtual int getUnassignedStationCount() const
Gets count of unassigned stations.
virtual std::vector< DtPersistedAssignmentRecord > exportAssignmentsForPersistence() const
Exports the effective assignment snapshot for persistence.
virtual std::vector< std::string > getAssignedStations(const DtUUID &entityUUID, const std::string &roleName, bool includePending=true) const
Gets all stations assigned to a specific role.
virtual ~DtVreAssignmentTracker() override
Destructor.
unsigned int myNextPlaceholderStationId
Next synthetic placeholder ID suffix to allocate.
Definition vreAssignmentTracker.h:557
virtual bool importAssignmentsForPersistence(const std::vector< DtPersistedAssignmentRecord > &records, const std::function< bool(const DtUUID &)> &entityExists, std::vector< std::string > &warnings, std::string &errorText)
Imports saved assignments as pending state.
virtual bool getStationAssignment(std::string stationId, DtUUID &entityUUID, std::string &roleName, bool &isPending) const
Gets the current assignment for a station.
void wakePlaceholderForLiveStation(std::string liveStationId)
bool findLiveStationIdByName(const std::string &stationName, std::string &stationId) const
virtual bool isStationSpectator(std::string stationId) const
Gets whether a station is in spectator mode.
std::map< std::string, PendingAssignment > myPendingAssignments
Map of station ID to pending assignment.
Definition vreAssignmentTracker.h:525
void removePlaceholderStation(std::string stationId)
virtual std::vector< std::string > getPlaceholderStationIds() const
Returns all synthetic placeholder station IDs.
static constexpr const char * thePlaceholderStationIdPrefix
Prefix for synthetic placeholder station IDs.
Definition vreAssignmentTracker.h:554
static void onStationChanged(const std::string &id, void *userData)
Callback invoked when a station's confirmed state changes.
virtual void setPendingUnassignment(std::string stationId)
Sets a pending unassignment for a station.
virtual void setSpectatorPreference(std::string stationId, bool spectatorMode)
Sets the spectator mode preference for a station.
virtual std::string getStationRoleName(std::string stationId) const
Gets the confirmed role name for a station.
virtual std::string getStationName(std::string stationId) const
Gets the display name for a station.
virtual std::vector< std::string > getStationsToUnassign() const
Returns confirmed stations that will be unassigned on submit.
virtual int getAssignedRoleCount(const DtUUID &entityUUID, const std::vector< std::string > &availableRoles) const
Gets count of assigned roles for an entity.
virtual bool hasUnresolvedConflicts() const
Checks if any entity+role has 2+ non-spectator stations When true, the Submit button is disabled.
static void onStationRemoved(const std::string &id, void *userData)
Callback invoked when a station is removed from the listener.
void assignmentStateChanged()
Emitted when any assignment state changes.
virtual std::vector< std::string > getAllStationIds() const
Gets all station IDs.
static void onStationAdded(const std::string &id, void *userData)
Callback invoked when a station is added to the listener.
virtual int getConflictCount() const
Returns the number of roles with unresolved conflicts.
virtual int getTotalStationCount() const
Gets total station count.
std::string allocatePlaceholderStationId()
Export macros for the VREngage Manager library.
#define VREMANAGER_DLL
Platform-specific export/import macro for VREngage Manager library.
Definition export.h:28
!
Definition glsVreMessageUtil.h:50
Structure representing a pending assignment for submit iteration.
Definition vreAssignmentTracker.h:91
std::string myRoleName
The role name being assigned.
Definition vreAssignmentTracker.h:99
bool mySpectatorMode
Whether spectator mode should be enabled.
Definition vreAssignmentTracker.h:102
std::string myStationId
Station ID receiving the assignment.
Definition vreAssignmentTracker.h:93
DtUUID myEntityUUID
The entity UUID being assigned to.
Definition vreAssignmentTracker.h:96
One saved station-to-role assignment record.
Definition vreAssignmentPersistence.h:30
Represents an offline placeholder station whose assignment is saved but whose real station is not cur...
Definition vreAssignmentTracker.h:109
std::string myRoleName
Role name the placeholder holds (e.g., "driver", "gunner")
Definition vreAssignmentTracker.h:126
std::string myObjectName
Entity object name from the saved layout, for display.
Definition vreAssignmentTracker.h:123
std::string myStationId
Synthetic station ID assigned to the placeholder.
Definition vreAssignmentTracker.h:111
bool mySpectatorMode
Whether spectator mode is enabled for this placeholder assignment.
Definition vreAssignmentTracker.h:129
DtUUID myEntityUUID
UUID of the entity the placeholder is assigned to.
Definition vreAssignmentTracker.h:117
std::string myStationName
Name of the offline station (used for matching on discovery)
Definition vreAssignmentTracker.h:114
Structure representing a role assignment for display.
Definition vreAssignmentTracker.h:53
std::vector< bool > myStationSpectatorFlags
Whether each station is a spectator (parallel to myStationIds)
Definition vreAssignmentTracker.h:68
std::vector< std::string > myStationIds
Station IDs currently assigned to this role (confirmed state)
Definition vreAssignmentTracker.h:62
bool myHasConflict
True if 2+ non-spectator stations are on this role (unresolved conflict)
Definition vreAssignmentTracker.h:81
std::vector< bool > myStationPendingFlags
Whether each station is a pending assignment (parallel to myStationIds)
Definition vreAssignmentTracker.h:74
std::vector< std::string > myStationNames
Station names for display (parallel to myStationIds)
Definition vreAssignmentTracker.h:65
std::string myRoleName
The role name (e.g., "driver", "gunner", "commander")
Definition vreAssignmentTracker.h:55
Internal structure for pending assignment data.
Definition vreAssignmentTracker.h:515
DtUUID myEntityUUID
Entity UUID for pending assignment.
Definition vreAssignmentTracker.h:516
bool mySpectatorMode
Spectator mode flag.
Definition vreAssignmentTracker.h:518
std::string myRoleName
Role name for pending assignment.
Definition vreAssignmentTracker.h:517
JSON persistence helpers for Manager Panel assignment layouts.