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 | Static Private Member Functions
DtSerialization::DtJsonSerializer Class Reference

DtJsonSerializer - Converts data source types to JSON.

This is the single point of JSON conversion from VRF-agnostic data. All JSON generation for entity data should go through these methods.

Static Public Member Functions

static Json::Value entitySnapshotToJson (const DtDatasource::DtEntitySnapshot &snapshot, bool omitSpatial=false)
 
static Json::Value entityIdentifierToJson (const DtEntityIdentifier &id)
 
static Json::Value entityTypeToJson (const DtEntityType &type)
 
static DtEntityType entityTypeFromJson (const Json::Value &arr)
 
static Json::Value geocentricToJson (const DtVector &ecef)
 
static DtVector geocentricFromJson (const Json::Value &arr)
 
static Json::Value uuidToJson (const DtUUID &uuid)
 
static Json::Value tacticalGraphicSnapshotToJson (const DtDatasource::DtTacticalGraphicSnapshot &snapshot, bool omitSpatial=false)
 
static Json::Value aggregateSnapshotToJson (const DtDatasource::DtAggregateSnapshot &snapshot, bool omitSpatial=false)
 
static Json::Value contactReportSnapshotToJson (const DtDatasource::DtContactReportSnapshot &snapshot, bool omitSpatial=false)
 
static Json::Value createObjectDeletedMessage (const std::string &objectName, const std::string &objectType)
 
static bool hasChanges (const Json::Value &current, const Json::Value &lastSent)
 

Static Private Member Functions

static Json::Value location3dToJson (const std::array< double, 3 > &loc)
 
static Json::Value stringVectorToJson (const std::vector< std::string > &strings)
 

Member Function Documentation

static Json::Value DtSerialization::DtJsonSerializer::entitySnapshotToJson ( const DtDatasource::DtEntitySnapshot &  snapshot,
bool  omitSpatial = false 
)
static

Convert an DtEntitySnapshot to JSON attributes.

Parameters
snapshotThe entity snapshot to convert
Returns
JSON object containing all entity attributes When omitSpatial is true, location and dynamic-state fields are not written.
static Json::Value DtSerialization::DtJsonSerializer::entityIdentifierToJson ( const DtEntityIdentifier &  id)
static

Convert DtEntityIdentifier to JSON array [site, app, entity].

static Json::Value DtSerialization::DtJsonSerializer::entityTypeToJson ( const DtEntityType &  type)
static

Convert DtEntityType to JSON array [kind, domain, country, category, subcategory, specific, extra].

static DtEntityType DtSerialization::DtJsonSerializer::entityTypeFromJson ( const Json::Value &  arr)
static

Convert a JSON array [kind, domain, country, category, subcategory, specific, extra] to DtEntityType.

static Json::Value DtSerialization::DtJsonSerializer::geocentricToJson ( const DtVector &  ecef)
static

Convert a geocentric ECEF position to a JSON array [lat_deg, lon_deg, alt_m].

static DtVector DtSerialization::DtJsonSerializer::geocentricFromJson ( const Json::Value &  arr)
static

Convert a JSON array [lat_deg, lon_deg, alt_m] (or [lat_deg, lon_deg]) to a geocentric ECEF DtVector. When only two elements are present, altitude defaults to 0.

static Json::Value DtSerialization::DtJsonSerializer::uuidToJson ( const DtUUID &  uuid)
static

Convert a DtUUID to a JSON string, or an empty string if the UUID is invalid.

static Json::Value DtSerialization::DtJsonSerializer::tacticalGraphicSnapshotToJson ( const DtDatasource::DtTacticalGraphicSnapshot &  snapshot,
bool  omitSpatial = false 
)
static

Convert a DtTacticalGraphicSnapshot to JSON attributes.

Parameters
snapshotThe tactical graphic snapshot to convert
Returns
JSON object containing all tactical graphic attributes When omitSpatial is true, location and dynamic-state fields are not written.
static Json::Value DtSerialization::DtJsonSerializer::aggregateSnapshotToJson ( const DtDatasource::DtAggregateSnapshot &  snapshot,
bool  omitSpatial = false 
)
static

Convert a DtAggregateSnapshot to JSON attributes.

Parameters
snapshotThe aggregate snapshot to convert
Returns
JSON object containing all aggregate attributes When omitSpatial is true, location and dynamic-state fields are not written.
static Json::Value DtSerialization::DtJsonSerializer::contactReportSnapshotToJson ( const DtDatasource::DtContactReportSnapshot &  snapshot,
bool  omitSpatial = false 
)
static

Convert a DtContactReportSnapshot to JSON attributes.

Parameters
snapshotThe contact report snapshot to convert
Returns
JSON object containing all contact report attributes When omitSpatial is true, location and dynamic-state fields are not written.
static Json::Value DtSerialization::DtJsonSerializer::createObjectDeletedMessage ( const std::string &  objectName,
const std::string &  objectType 
)
static

Create a WebLVC ObjectDeleted message.

Parameters
objectNameThe name of the deleted object
objectTypeThe type of the deleted object
Returns
Complete WebLVC message JSON
static bool DtSerialization::DtJsonSerializer::hasChanges ( const Json::Value &  current,
const Json::Value &  lastSent 
)
static

Check if any attributes have changed between two JSON objects.

Parameters
currentCurrent attributes
lastSentPreviously sent attributes
Returns
True if at least one attribute differs

Referenced by DtDetectChangedItems().

static Json::Value DtSerialization::DtJsonSerializer::location3dToJson ( const std::array< double, 3 > &  loc)
staticprivate

Convert a 3-element [lat, lon, alt] or [x, y, z] array to a JSON array.

static Json::Value DtSerialization::DtJsonSerializer::stringVectorToJson ( const std::vector< std::string > &  strings)
staticprivate

Convert a vector of strings to a JSON array.


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)