VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
DtScenarioDataManager Class Reference

DtScenarioDataManager — manages per-scenario data stored by the web server.

Each scenario gets its own sub-directory under a configured base directory. The sub-directory name is derived from the VRF scenario filename (path is stripped; only the base scenario key is used (e.g. "BombMission" for "BombMission.scnx"). A special "default" folder is used when no scenario is loaded.

Directory layout:

<scenariosBaseDir>/
default/
roles/defs/ ← role definition JSON files for the default scenario
roles/assignments/ ← saved assignment templates for the default scenario
BombMission/
roles/defs/ ← role definition JSON files for BombMission
roles/assignments/ ← saved assignment templates for BombMission
...

When a scenario is loaded, onScenarioChanged() re-initializes all scenario-scoped subsystems (currently DtRoleDefinitionStore and DtRoleAssignmentStore) to point at the correct data directory. If the scenario-specific folder does not exist, it is created immediately so new role data is saved under that scenario instead of in "default". If the scenario has no saved role definitions yet, both stores use the shared default definition/assignment data until the scenario is saved.

Note: a VRF scenario file literally named "default" (any extension) that would produce the key "default" is a known edge case and is not supported.

Thread safety: onScenarioChanged() is intended to be called from the VRF update thread via a DtVrfManager scenario-changed listener. initialize() must be called from main() before any background threads start.

Public Member Functions

void initialize (const std::string &scenariosBaseDir)
 
void onScenarioChanged (const std::string &vrfScenarioPath, const std::string &terrainName)
 
std::string currentScenarioFolder () const
 

Static Public Member Functions

static DtScenarioDataManager & getInstance ()
 

Private Member Functions

 DtScenarioDataManager ()=default
 

Static Private Member Functions

static std::string extractFilename (const std::string &path)
 
static char pathSep ()
 

Private Attributes

std::string myScenariosBaseDir
 
std::string myCurrentScenarioFolder
 

Constructor & Destructor Documentation

DtScenarioDataManager::DtScenarioDataManager ( )
privatedefault

Member Function Documentation

static DtScenarioDataManager& DtScenarioDataManager::getInstance ( )
static

Returns the process-wide singleton instance.

void DtScenarioDataManager::initialize ( const std::string &  scenariosBaseDir)

Sets the base directory for scenario data and primes all subsystems with the "default" folder. Must be called from main() before background threads start, after DtRoleDefinitionStore is available.

void DtScenarioDataManager::onScenarioChanged ( const std::string &  vrfScenarioPath,
const std::string &  terrainName 
)

Called whenever the active VRF scenario or terrain changes.

Parameters
vrfScenarioPathThe full path to the scenario file as reported by VRF (e.g. "C:\\scenarios\\BombMission.scnx"), or an empty string when no scenario is loaded.
terrainNameThe terrain name from VRF session status; empty when no terrain is loaded (i.e. no scenario of any kind is active). Re-initializes scenario-scoped subsystems using the scenario-specific data folder (or "default" when no scenario is loaded). When terrainName is empty, the active role configuration is cleared so that no roles are published.
std::string DtScenarioDataManager::currentScenarioFolder ( ) const

Returns the path to the currently active scenario data folder. Useful for diagnostics; empty until initialize() has been called.

static std::string DtScenarioDataManager::extractFilename ( const std::string &  path)
staticprivate

Returns the scenario key from a path (e.g. "BombMission" for "BombMission.scnx"). Returns an empty string if the path is empty.

static char DtScenarioDataManager::pathSep ( )
staticprivate

Returns the path separator character for the current platform.

Member Data Documentation

std::string DtScenarioDataManager::myScenariosBaseDir
private
std::string DtScenarioDataManager::myCurrentScenarioFolder
private

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 15 21:27:02 EDT 2026 from SVN revision 296421
Copyright © 2005-2026 MAK Technologies. All Rights Reserved (www.mak.com)