VR-Engage  2.3
Loading...
Searching...
No Matches
vreAssignmentPersistence.h
Go to the documentation of this file.
1/*******************************************************************************
2** Copyright (c) 2026 MAK Technologies
3** All rights reserved.
4*******************************************************************************/
5
6//! \file vreAssignmentPersistence.h
7//! \ingroup vreManager
8//! \brief JSON persistence helpers for Manager Panel assignment layouts
9
10#pragma once
11
12#include "vreManager/export.h"
13
14#include <QString>
15#include <QStringList>
16
17#include <vrfutil/uuid.h>
18
19#include <string>
20#include <vector>
21
22
23namespace makVre
24{
25
27
28//! \brief One saved station-to-role assignment record.
30{
31 //! \brief Name of the station that held this assignment
32 std::string myStationName;
33
34 //! \brief UUID of the entity assigned to the station
36
37 //! \brief Display name of the entity at save time (e.g., "Abrams-1").
38 //!
39 //! Stored so that placeholder cards can show a readable label before the
40 //! scenario is loaded and the entity publishes on the network.
41 //! Optional: empty string in files saved before this field was added.
42 std::string myObjectName;
43
44 //! \brief Role name the station was assigned to (e.g., "driver", "gunner")
45 std::string myRoleName;
46
47 //! \brief Whether spectator mode was enabled for the assignment
48 bool mySpectatorMode = false;
49};
50
51//! \brief Top-level persistence file data with version and assignment array.
53{
54 int myVersion = 1;
55 std::vector<DtPersistedAssignmentRecord> myAssignments;
56};
57
58//! \brief JSON persistence helper for Manager Panel assignment layouts.
59//!
60//! Serializes and deserializes assignment layouts to versioned JSON files.
61//! This class is UI-free and returns error and warning strings for the caller
62//! to present.
64{
65public:
66 //! \brief Saves the assignment file data to a JSON file.
67 //! \param filePath The target file path.
68 //! \param fileData The assignment data to serialize.
69 //! \param errorText Receives an error description on failure.
70 //! \return true on success.
71 static bool saveToFile(const QString& filePath,
72 const DtPersistedAssignmentFile& fileData,
73 QString& errorText);
74
75 //! \brief Loads assignment data from a JSON file.
76 //! \param filePath The source file path.
77 //! \param fileData Receives the parsed assignment data on success.
78 //! \param errorText Receives an error description on failure.
79 //! \param warningTexts Receives non-fatal warnings.
80 //! \return true on success.
81 static bool loadFromFile(const QString& filePath,
83 QString& errorText,
84 QStringList& warningTexts);
85
86 //! \brief Builds a persistence snapshot from the tracker's effective assignment state.
87 //!
88 //! Exports the merged confirmed plus pending view so the saved file
89 //! represents the operator's intended layout.
90 //! \param tracker The assignment tracker to export from.
91 //! \return The file data ready for saveToFile.
93};
94
95} // namespace makVre
JSON persistence helper for Manager Panel assignment layouts.
Definition vreAssignmentPersistence.h:64
static bool saveToFile(const QString &filePath, const DtPersistedAssignmentFile &fileData, QString &errorText)
Saves the assignment file data to a JSON file.
static DtPersistedAssignmentFile buildFileData(const DtVreAssignmentTracker &tracker)
Builds a persistence snapshot from the tracker's effective assignment state.
static bool loadFromFile(const QString &filePath, DtPersistedAssignmentFile &fileData, QString &errorText, QStringList &warningTexts)
Loads assignment data from a JSON file.
Centralized tracking of confirmed and pending station assignments.
Definition vreAssignmentTracker.h:187
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
Top-level persistence file data with version and assignment array.
Definition vreAssignmentPersistence.h:53
std::vector< DtPersistedAssignmentRecord > myAssignments
Definition vreAssignmentPersistence.h:55
int myVersion
Definition vreAssignmentPersistence.h:54
One saved station-to-role assignment record.
Definition vreAssignmentPersistence.h:30
std::string myObjectName
Display name of the entity at save time (e.g., "Abrams-1").
Definition vreAssignmentPersistence.h:42
bool mySpectatorMode
Whether spectator mode was enabled for the assignment.
Definition vreAssignmentPersistence.h:48
std::string myStationName
Name of the station that held this assignment.
Definition vreAssignmentPersistence.h:32
std::string myRoleName
Role name the station was assigned to (e.g., "driver", "gunner")
Definition vreAssignmentPersistence.h:45
DtUUID myEntityUUID
UUID of the entity assigned to the station.
Definition vreAssignmentPersistence.h:35