| DtCommandSpecBuilder::DtCommandSpecBuilder |
( |
DtScenarioManager & |
mgr, |
|
|
const std::string & |
configFilePath = "" |
|
) |
| |
|
explicit |
configFilePath — path to an optional JSON file that may override or supplement the built-in command catalog. Pass an empty string to skip file loading entirely. scriptedTaskManager — optional pointer to the scripted task manager used to build specs from DtScriptedTaskMetaData. May be null if the scripted task system is not available.
| DtCommandSpecBuilder::~DtCommandSpecBuilder |
( |
| ) |
|
|
default |
| Json::Value DtCommandSpecBuilder::buildCommandSummaries |
( |
const std::vector< std::string > & |
filter = {} | ) |
const |
Returns a JSON array of lightweight command summaries. If filter is non-empty, only entries whose commandType appears in filter are returned (in filter order). Omit filter to retrieve all entries.
| DtCommandSpecJobHandle DtCommandSpecBuilder::buildCommandSpec |
( |
const std::string & |
commandType, |
|
|
const std::string & |
objectName = "" |
|
) |
| |
Returns the full parameter spec for a single command type as a job handle. If objectName is non-empty and the command type has entity-specific parameters (e.g. weapon lists), the job may be pending until the VRF back-end responds. Call waitFor() on the returned handle to block until the spec is fully assembled, then read it via result(). If objectName is empty or the command type needs no async data, the returned job is already complete and waitFor() returns immediately. Returns a job whose result() is a null Json::Value if commandType is unknown.
| void DtCommandSpecBuilder::tick |
( |
| ) |
|
Advances all pending DtCommandSpecJobBuilder instances: removes expired or completed jobs, then calls update() on the remaining ones. Call this once per simulation tick from the VRF tick thread.
| bool DtCommandSpecBuilder::isHiddenCommand |
( |
const std::string & |
commandType | ) |
const |
Returns true if commandType should be suppressed from the AvailableCommands list sent to web clients.
Scripted tasks: hidden when showInMenu() is false in the task metadata and its not overwritten in the commandSpec RW tasks/sets:
| bool DtCommandSpecBuilder::isHiddenRwCommand |
( |
const std::string & |
commandType | ) |
const |
Returns true if commandSpecs.json was loaded and the commandType is not listed there (or is listed with "hidden": true). When commandSpecs.json is absent, all RW tasks/sets are visible.
| Json::Value DtCommandSpecBuilder::buildRwCommandSpecsConfig |
( |
| ) |
const |
Returns a JSON array of all registered RW command types merged with any existing configuration from commandSpecs.json. Types not yet present in the file are returned with only CommandType and DisplayName populated. Intended for the configure web UI.
| bool DtCommandSpecBuilder::updateCommandSpecEntry |
( |
const std::string & |
commandType, |
|
|
const Json::Value & |
entry |
|
) |
| |
Upserts the entry for commandType in the in-memory raw config and writes the updated commandSpecs.json to disk. The entire entry JSON is replaced (not field-patched). In-memory visibility and catalog state are updated atomically with the file write under myWriteMutex.
- Returns
- True on success; false if the path is unset or the file cannot be written (a warning is logged in that case).
| std::shared_ptr<DtCommandSpecJobBuilder> DtCommandSpecBuilder::commandSpecJobFromOverrideFile |
( |
const std::string & |
commandType, |
|
|
const std::string & |
objectName |
|
) |
| const |
|
protected |
| std::shared_ptr<DtCommandSpecJobBuilder> DtCommandSpecBuilder::commandSpecFromScriptedTaskMetaData |
( |
const std::string & |
commandType, |
|
|
const std::string & |
objectName |
|
) |
| const |
|
protected |
| std::shared_ptr<DtCommandSpecJobBuilder> DtCommandSpecBuilder::commandSpecJobFromRwFactory |
( |
const std::string & |
commandType, |
|
|
const std::string & |
objectName |
|
) |
| const |
|
protected |
| void DtCommandSpecBuilder::initializeCatalog |
( |
| ) |
|
|
private |
| void DtCommandSpecBuilder::loadCommandSpecFile |
( |
const std::string & |
filePath | ) |
|
|
private |
Returns the group string extracted from the first menu location in metaData. The group is the text that precedes "/$(menutext)" in the location string (e.g. "Engagement/$(menutext)..." yields "Engagement"). Returns an empty string when no group can be determined.
Extracts the summary catalog fields (CommandType, DisplayName, Group, Icon, Level) from scripted task metadata. This is the single canonical mapping used by both buildCommandSummaries and commandSpecFromScriptedTaskMetaData.
Combines two catalog entries into one, preferring non-empty fields from the first entry and falling back to the second entry when a field is empty. Used to merge scripted task metadata with commandSpecs.json overrides.
Ordered catalog of all known command types and their display metadata.
| std::unordered_map<std::string, size_t> DtCommandSpecBuilder::myCatalogIndex |
|
private |
Fast lookup from commandType string to index in myCatalog.
| std::unordered_map<std::string, Json::Value> DtCommandSpecBuilder::myCommandSpecOverrides |
|
private |
| std::unordered_set<std::string> DtCommandSpecBuilder::myRwCommandTypes |
|
private |
Set of all RW task/set type strings registered in the VRF factory at construction time. Does not contain any scripted tasks, as they dont follow the same factory pattern.
| std::unordered_set<std::string> DtCommandSpecBuilder::myVisibleRwCommands |
|
private |
Command types explicitly allowed by commandSpecs.json ("hidden" absent or false). Only populated when myCommandSpecFileWasLoaded is true. Can contain both RW and scripted tasks.
| bool DtCommandSpecBuilder::myCommandSpecFileWasLoaded = false |
|
private |
True once a commandSpecs.json file has been successfully parsed.
| std::string DtCommandSpecBuilder::myCommandSpecsFilePath |
|
private |
Path passed to the constructor; used for write-back by updateCommandSpecEntry.
| Json::Value DtCommandSpecBuilder::myRawFileRoot |
|
private |
Entire parsed commandSpecs.json root. Pre-initialised to {"commands":[]} so that updateCommandSpecEntry can write a valid file even when no commandSpecs.json existed at startup.
| tbb::mutex DtCommandSpecBuilder::myWriteMutex |
|
mutableprivate |
Serialises concurrent configure writes and the config read endpoint.
| constexpr int DtCommandSpecBuilder::theSpecTimeoutMs = 5000 |
|
staticprivate |
Timeout used when waiting for async command spec data.
Weak references to in-progress job builders. Only jobs that were not yet complete at creation time are tracked here. tick() prunes expired and completed entries and drives update() on the remainder.
The documentation for this class was generated from the following file:
- /data/exports/nrhent7-1/nightly/docs/vrForces.vrf5-3-branch/appsrc/vrfWebServer/commandSpecBuilder.h