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

Converts a DtSimTask, DtSetDataRequest, or DtReaderWriter to a JSON parameter object. This is the inverse of DtJsonTaskSetBuilder: the JSON it produces can be fed back into DtJsonTaskSetBuilder::buildTask() or buildSet() to reconstruct an equivalent task or set.

All methods are static — the class is stateless and requires no construction.

Note
Only the static registry-walk path is covered. Scripted-task variable serialisation is out of scope.
Parameters
unconvertedTypesOptional out-parameter accepted by each public method. When non-null, the readerWriterType() string of every RW node that could not be converted is appended to the vector. This mirrors the unusedParams pattern in DtJsonTaskSetBuilder and is intended as a debugging aid.

Static Public Member Functions

static Json::Value taskToJson (const DtSimTask &task, std::vector< std::string > *unconvertedTypes=nullptr)
 
static Json::Value setToJson (const DtSetDataRequest &set, std::vector< std::string > *unconvertedTypes=nullptr)
 
static Json::Value rwToJson (const DtReaderWriter *rw, std::vector< std::string > *unconvertedTypes=nullptr)
 
static Json::Value currentTasksToJson (const DtCurrentTaskManager::EntityTaskInformation &tasks)
 

Protected Types

using RwToJsonFcn = Json::Value(*)(const DtReaderWriter *rw)
 

Static Protected Member Functions

static const std::map
< DtString, RwToJsonFcn > & 
rwToJsonFcnMap ()
 
static const std::set
< std::string > & 
theIgnoredTopLevelParams ()
 
static Json::Value registryToJson (const DtReaderWriterRegistry &reg, std::vector< std::string > *unconvertedTypes, const std::set< std::string > &ignoredParams={})
 
static Json::Value templatedListToJson (const DtRwTemplatedListInterface *list, std::vector< std::string > *unconvertedTypes)
 
static Json::Value stringToJson (const DtReaderWriter *rw)
 
static Json::Value uuidToJson (const DtReaderWriter *rw)
 
static Json::Value objectNameToJson (const DtReaderWriter *rw)
 
static Json::Value intToJson (const DtReaderWriter *rw)
 
static Json::Value doubleToJson (const DtReaderWriter *rw)
 
static Json::Value boolToJson (const DtReaderWriter *rw)
 
static Json::Value headingToJson (const DtReaderWriter *rw)
 
static Json::Value vectorToJson (const DtReaderWriter *rw)
 
static Json::Value locationReferenceToJson (const DtReaderWriter *rw)
 
static Json::Value entityTypeToJson (const DtReaderWriter *rw)
 
static Json::Value resourceTypeToJson (const DtReaderWriter *rw)
 
static Json::Value stringListToJson (const DtReaderWriter *rw)
 
static Json::Value nLengthStringVectorToJson (const DtReaderWriter *rw)
 
static Json::Value nLengthUUIDVectorToJson (const DtReaderWriter *rw)
 
static Json::Value vectorListToJson (const DtReaderWriter *rw)
 
static Json::Value offsetVectorListToJson (const DtReaderWriter *rw)
 
static Json::Value offsetVectorToJson (const DtReaderWriter *rw)
 
static Json::Value taitBryanToJson (const DtReaderWriter *rw)
 
static Json::Value intListToJson (const DtReaderWriter *rw)
 
static Json::Value keyValueListToJson (const DtReaderWriter *rw)
 
static Json::Value aggregateStateToJson (const DtReaderWriter *rw)
 
static Json::Value forceTypeToJson (const DtReaderWriter *rw)
 
static Json::Value postureToJson (const DtReaderWriter *rw)
 

Member Typedef Documentation

using DtJsonRwSerializer::RwToJsonFcn = Json::Value (*)(const DtReaderWriter* rw)
protected

Function pointer type for per-RW-type serialisation handlers.

Member Function Documentation

static Json::Value DtJsonRwSerializer::taskToJson ( const DtSimTask &  task,
std::vector< std::string > *  unconvertedTypes = nullptr 
)
static

Converts all registry parameters of task to a JSON object. Keys are parameter names; values are their JSON equivalents. Returns a Json::objectValue.

static Json::Value DtJsonRwSerializer::setToJson ( const DtSetDataRequest &  set,
std::vector< std::string > *  unconvertedTypes = nullptr 
)
static

Converts all registry parameters of set to a JSON object. Keys are parameter names; values are their JSON equivalents. Returns a Json::objectValue.

static Json::Value DtJsonRwSerializer::rwToJson ( const DtReaderWriter *  rw,
std::vector< std::string > *  unconvertedTypes = nullptr 
)
static

Converts a single DtReaderWriter node to its JSON equivalent. Returns Json::nullValue when the type is not supported.

static Json::Value DtJsonRwSerializer::currentTasksToJson ( const DtCurrentTaskManager::EntityTaskInformation &  tasks)
static

Converts the current task list for one simulation object into a JSON array of {"CommandType": "...", "Parameters": {...}, "Text": "..."} objects. Entries whose TaskInformation has neither a task nor a set are silently skipped. Any RW parameter types that could not be converted are logged as a DtInfo warning.

Parameters
tasksThe EntityTaskInformation vector from DtCurrentTaskManager::tasksFor().
Returns
A Json::arrayValue; empty when tasks is empty.
static const std::map<DtString, RwToJsonFcn>& DtJsonRwSerializer::rwToJsonFcnMap ( )
staticprotected

Lazy-initialised dispatch map from readerWriterType() string to handler.

static const std::set<std::string>& DtJsonRwSerializer::theIgnoredTopLevelParams ( )
staticprotected

Parameter names always skipped at the top level of taskToJson / setToJson. Analogous to the myParamsIgnored set in DtJsonTaskSetBuilder.

static Json::Value DtJsonRwSerializer::registryToJson ( const DtReaderWriterRegistry &  reg,
std::vector< std::string > *  unconvertedTypes,
const std::set< std::string > &  ignoredParams = {} 
)
staticprotected

Walks reg and returns a JSON object of { paramName: value } pairs. Keys that map to Json::nullValue are omitted.

Parameters
ignoredParamsAdditional parameter names to skip at this level only.
static Json::Value DtJsonRwSerializer::templatedListToJson ( const DtRwTemplatedListInterface *  list,
std::vector< std::string > *  unconvertedTypes 
)
staticprotected

Serialises a templated list RW to a JSON array of objects.

static Json::Value DtJsonRwSerializer::stringToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::uuidToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::objectNameToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::intToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::doubleToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::boolToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::headingToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::vectorToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::locationReferenceToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::entityTypeToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::resourceTypeToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::stringListToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::nLengthStringVectorToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::nLengthUUIDVectorToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::vectorListToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::offsetVectorListToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::offsetVectorToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::taitBryanToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::intListToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::keyValueListToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::aggregateStateToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::forceTypeToJson ( const DtReaderWriter *  rw)
staticprotected
static Json::Value DtJsonRwSerializer::postureToJson ( const DtReaderWriter *  rw)
staticprotected

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)