![]() |
VR-Forces Developer's Guide
|
This document describes the public API changes in the vrfStateData library between VR-Forces 5.2 and 5.3.
The library defines the state component model — the double-buffered current-frame / next-frame state that GUI code, plug-ins, and back-end simulation code read entity state from — plus the templates and macros used to declare custom state components.
The bulk of the change in 5.3 falls into four areas:
sidc (symbol identification code) property was added to the simulated-object state component interface, which forces every concrete frame class derived from it to implement two new virtual methods.debug parameter on many virtual methods, and DtRwVrfKinematicState dropped several redundant overrides.makVrv::DtUniqueID was purged from the spot report and typed dictionary APIs in favour of DtUUID and plain integer types, removing a vrvCore dependency from these public headers.The majority of the roughly seventy modified headers changed only in comments or Doxygen markup. Headers whose only changes were non-API are not listed here.
DtSimulatedObjectStateComponent declares a new property for the symbol identification code used for visual display:
The UNDEFINED_RETURNREF_ACCESSOR_MUTATOR macro expands to a virtual const DtString& sidc() const and a virtual void setSidc(const DtString&), both of which throw DtUnimplementedMethod in the base class. Any class that derives from DtSimulatedObjectStateComponent and is expected to serve as a concrete current-frame or next-frame state must now override these. Existing derived classes that do not override them will compile, but will throw at run time if the accessors are reached.
All in-tree concrete frame classes were updated. The current-frame classes implement only sidc(); the next-frame classes implement both. Components for which the property is not meaningful (spot reports, aerodromes, METOC services, ORBAT entries) implement stubs that return an empty string.
The corresponding data structs also gained a sidc field, declared with DEFINE_ACCESSOR_MUTATOR(DtString, sidc, Sidc): DtEntityStateComponentData, DtEnvironmentalStateComponentData, and DtSpotReportStateComponentData. Code that constructs these structs by aggregate initialisation or that compares them member-by-member must account for the new field.
Call sites that bind the result to auto now get a reference rather than a copy. Where the returned identifier is retained past the point at which the state data may be advanced or destroyed, copy it explicitly:
DtStateData::entityType() and DtStateData::objectType() swapped roles at the same time — entityType() is now the primary implementation and objectType() forwards to it. Both still return DtEntityType by value, so no call site changes are required.
spotReportStateComponent.h no longer includes <vrvCore/DtUniqueID.h>. Every observer method that took or returned a makVrv::DtUniqueID now uses DtUUID:
The change applies to DtSpotReportStateComponent, DtSpotReportStateComponentNextFrame, DtSpotReportStateComponentCurrentFrame, and to the same methods on DtSpotReportStateComponentData. Overriding classes must update their signatures or the overrides will silently stop overriding.
The following accessors and mutators were removed from DtSpotReportStateComponent and from both frame classes, along with the matching fields and accessors on DtSpotReportStateComponentData:
| Removed 5.2 declaration | Notes |
|---|---|
visualHandlerType() / setVisualHandlerType(const std::string&) | No replacement |
dataHandlerType() / setDataHandlerType(const std::string&) | No replacement |
isTDLReport() / setIsTDLReport(const bool&) | No replacement |
TDL-specific spot report handling is no longer expressed through the state component. Store equivalent information in the report's DtSimpleTypedDictionary if your application needs it.
isSpotReport() is unchanged. There is no replacement for isTDLReport().
simpleTypedDictionary.h dropped its <vrvCore/DtUniqueID.h> includes. Two members changed signature as a result:
The stored string representation is unchanged, so dictionaries written by 5.2 are read correctly by 5.3. Call sites that passed a makVrv::DtUniqueID must convert to unsigned long long, and call sites that assigned the result of elementIDValue to a makVrv::DtElementID must change the variable type. Code that relied on this header transitively providing makVrv::DtUniqueID must now include <vrvCore/DtUniqueID.h> directly.
Two properties were removed from the interface, from both frame classes, and from DtTimeAndDateStateComponentData:
| Removed 5.2 declaration |
|---|
int scenarioStartTimeAtLocalOnFirstObjectCreationToTime() const |
void setScenarioStartTimeAtLocalOnFirstObjectCreationToTime(const int&) |
bool scenarioStartTimeIsLocal() const |
void setScenarioStartTimeIsLocal(const bool&) |
The remaining timeToLocalOnFirstPlacement / alreadySetTimePlacement / canSetScenarioPreStartTime properties carry the surviving behaviour. The default value of myScenarioStartTimeAtLocalOnFirstObjectCreationToTime (36000 seconds) is gone with it; the component's default date and time of day is still 43200 seconds.
Several core kinematic accessors and mutators acquired a trailing bool debug = false argument. Existing call sites compile unchanged because the argument is defaulted, but any class that overrides these methods must update its signature, otherwise the override is silently lost and the base class implementation is used at run time.
| 5.2 declaration | 5.3 declaration |
|---|---|
virtual const DtVector& worldPosition() const | virtual const DtVector& worldPosition(bool debug = false) const |
virtual void setWorldPosition(const DtVector&) | virtual void setWorldPosition(const DtVector&, bool debug = false) |
virtual const DtVector& setWorldPositionFromParent() | virtual const DtVector& setWorldPositionFromParent(bool debug = false) |
virtual const DtVector& worldVelocity() const | virtual const DtVector& worldVelocity(bool debug = false) const |
virtual void setWorldVelocity(const DtVector&, bool recomputeSpeed = true) | virtual void setWorldVelocity(const DtVector&, bool recomputeSpeed = true, bool debug = false) |
virtual void setParentPosition(const DtVector&) | virtual void setParentPosition(const DtVector&, bool debug = false) |
virtual void setParentVelocity(const DtVector&, bool recomputeSpeed = true) | virtual void setParentVelocity(const DtVector&, bool recomputeSpeed = true, bool debug = false) |
DtRwVrfKinematicState follows the same debug pattern for its local- and relative-frame methods:
| 5.2 declaration | 5.3 declaration |
|---|---|
virtual void setLocalPosition(const DtVector&) | virtual void setLocalPosition(const DtVector&, bool debug = false) |
virtual const DtVector& localVelocity() const | virtual const DtVector& localVelocity(bool debug = false) const |
virtual void setLocalVelocity(const DtVector&, bool recomputeSpeed = true) | virtual void setLocalVelocity(const DtVector&, bool recomputeSpeed = true, bool debug = false) |
virtual const DtVector& relativeVelocity() const | virtual const DtVector& relativeVelocity(bool debug = false) const |
virtual void setRelativeVelocity(const DtVector&, bool recomputeSpeed = true) | virtual void setRelativeVelocity(const DtVector&, bool recomputeSpeed = true, bool debug = false) |
In addition, three overrides were removed from DtRwVrfKinematicState. The methods themselves are still available through DtRwSimKinematicState, so ordinary call sites are unaffected; only code that called the derived-class version explicitly (for example ks.DtRwVrfKinematicState::worldVelocity()) needs to change.
setWorldOrientationMatrix and setWorldAcceleration remain overridden, and setLocalOrientationMatrix is no longer declared with a redundant override alongside the world variant. The relative-state validation helpers (invalidateRelativeVelocity, validateRelativeVelocity, invalidateRelativeAcceleration, validateRelativeAcceleration) and localVV() moved within the class declaration but retain their public access and signatures.
This affects DtSensorFieldOfViewStateComponent, DtSensorFieldOfViewStateComponentNextFrame, and DtSensorFieldOfViewStateComponentCurrentFrame. Derived classes that override host() must change the return type to const DtUUID&.
sensorFieldOfViewStateComponent.h introduces a DtSensorFieldOfViewStateComponentData frame-state struct, and both frame classes now expose frameState():
DtSensorFieldOfViewStateComponentImplementation::updateDataStorage() now guards the promotion with myNextFrameState.isWritable() and calls advanceFrame() on the current-frame object. Previously the targeted entity was copied unconditionally. Code that relied on the targeted entity being propagated for read-only (remote) components must obtain it from the Legion read repository instead.
reserve(unsigned int) now behaves as a high-water mark rather than a running total. In 5.2 two successive calls of reserve(1000) produced capacity for 2000 entities; in 5.3 the second call is a no-op. Pass the total required capacity in a single call:
The method is still not thread safe.
DtStateComponent::StateComponentTypeEnum in stateComponent.h gained two enumerators. No enumerators were removed, and no existing value changed, so plug-ins that persist numeric component types remain compatible.
| Enumerator | Value | Status |
|---|---|---|
LaserLightStateComponent | 33 | Added |
SearchLightStateComponent | 34 | Added |
UserStateComponent | 64 | Unchanged — user components still start here |
stateDataTypes.h itself has no API changes in 5.3; the SimStateID, UInt64, UInt32, UInt8, Bool, and DtInstanceUpdatedCallback type aliases, the DtUnimplementedMethod and DtUnknownStateComponent types, InvalidSimStateID, and the COMPONENT_TYPE / CREATOR_TYPE macros are all unchanged.
The new header defines a state component for entity-mounted laser light emitters. It follows the standard four-class pattern — DtLaserLightStateComponent (interface), DtLaserLightStateComponentNextFrame (write), DtLaserLightStateComponentCurrentFrame (read), DtLaserLightStateComponentImplementation (double-buffered) — plus DtLaserLightStateComponentData and the DtLaserLightStateComponentCreator typedef.
The interface exposes three groups of properties:
| Group | Accessors |
|---|---|
| Laser light | signal / setSignal (unsigned), spread / setSpread (radians), wavelength / setWavelength (nanometers) |
| Aimable system | powerOn / setPowerOn, trackingMode / setTrackingMode, laserId / setLaserId (DtString), relativeOrientation / setRelativeOrientation (DtTaitBryan), targetedLocation / setTargetedLocation (geocentric), targetedRelativeLocation / setTargetedRelativeLocation, targetedEntity / setTargetedEntity (DtUUID) |
| Embedded system | host() (const DtUUID&), entityId() (const DtEntityIdentifier&), relativeLocation / setRelativeLocation |
Register the component in the usual way with REGISTER_STATE_COMPONENT(DtLaserLightStateComponentCreator, DtLaserLightStateComponentImplementation).
The new header defines a state component for steerable search lights. It has the same class structure and the same aimable-system and embedded-system property groups as the laser light component, with a different first group:
| Group | Accessors |
|---|---|
| Search light | lightType / setLightType (unsigned), color / setColor (packed RGBA), intensity / setIntensity, range / setRange (meters), coneAngle / setConeAngle (radians) |
| Aimable system | powerOn, trackingMode, searchId (DtString), relativeOrientation, targetedLocation, targetedRelativeLocation, targetedEntity |
| Embedded system | host(), entityId(), relativeLocation / setRelativeLocation |
The supporting types are DtSearchLightStateComponentData and DtSearchLightStateComponentCreator.
The new header moves the true-aggregate property roll-up logic into vrfStateData so that it can be shared between the GUI and the web server. It declares two classes in the global namespace.
DtTrueAggregateRollUp derives from DtTrueAggregateRollUpHelper and rolls state and parameter properties up an aggregate hierarchy:
Numeric properties are summed across the leaf nodes. String and boolean properties that agree across all leaves are preserved; those that disagree are marked read-only or dropped.
DtTrueAggregateRollUpFunctor is the abstract callback interface that supplies UUID-to-wrapper lookup and parameter property resolution, allowing the roll-up to run in either the GUI or the web server without depending on GUI-specific identifier types:
DtFrameStateInterface gained a pair of accessors that let a component be flagged for removal while still physically present in the frame state tables:
The flag is honoured by DtExternalFrameStateInterface::getStateComponentList<T>() and DtExternalNextFrameState::getStateComponentList<T>(), which now skip entries whose markedForRemoval() is true. Code that counts components through numComponents() and then indexes with getStateComponent(type, index) will still see the marked entries; prefer getStateComponentList<T>() when the marked entries should be excluded.
signal_uuidChanged is now declared mutable, so it can be connected to from a const DtStateData.
parameterProperties() complements the existing stateProperties() accessor and returns the parameter (base) property record used by the true-aggregate roll-up described above.
simObjectReferenceTemplate.h now includes <vlpi/entityType.h> to support the new method. The implementation in simObjectReferenceTemplate.inl returns a default-constructed DtEntityType when the reference is null, so the method is safe to call on an invalid reference.
setMaximumVertices throws DtUnimplementedMethod on the interface and is implemented by DtVrfGeometryStateComponentNextFrame. Use it to bound the vertex count of multi-point tactical graphics and environmental objects.
DtEntityLocationStateComponentInterface gained UNDEFINED_RETURNREF_ACCESSOR_MUTATOR(DtString, markingText, MarkingText), and both DtEntityLocationStateComponent and DtEnvironmentalLocationStateComponent implement virtual const DtString& markingText() const by delegating to the owning DtStateData. This lets diagnostic code identify an entity from a location component without first resolving the simulated object state component.
A ship class property was added to the AIS data component:
DtAisDataStateComponentData gained a matching shipClass / setShipClass pair and a myShipClass field that defaults to DtAisShipClass_A.
dataGate.h adds a third static signal alongside signal_gateLocked and signal_gateUnlocked:
Connect to it to run work that must complete while the gate is still held, before readers are released.
The environmental state component implementation now overrides initializeFromParameters:
Classes deriving from DtEnvironmentalStateComponentImplementation that also override this method must call the base implementation.
The comparison covers every field, including the new sidc. It does not include the removed visualHandlerType, dataHandlerType, or isTDLReport fields.
| Header | Breaking | Additions |
|---|---|---|
aisDataStateComponent.h | None | shipClass / setShipClass on interface, both frames, and data |
dataGate.h | None | DtGateLock::signal_gateAboutToBeUnlocked |
entityLocationStateComponent.h | None | markingText accessor/mutator on the interface and component |
entityStateComponent.h / .inl | Must implement sidc / setSidc | sidc on data struct and both frame templates |
environmentalLocationStateComponent.h | None | markingText() |
environmentalStateComponent.h | Must implement sidc / setSidc | sidc on data and both frames; initializeFromParameters override |
aerodromeStateComponent.h, metocServiceStateComponent.h, orbatStateComponent.h | Must implement sidc / setSidc | None |
rwSimKinematicState.h | debug parameter added to seven virtual methods | None |
rwVrfKinematicState.h | debug parameter added to five virtual methods; worldVelocity, worldAcceleration, bodyVelocity overrides removed | None |
searchLightStateComponent.h | New header | DtSearchLightStateComponent family |
laserLightStateComponent.h | New header | DtLaserLightStateComponent family |
sensorFieldOfViewStateComponent.h | host() returns const DtUUID&; updateDataStorage now guarded | DtSensorFieldOfViewStateComponentData; powerOn, targetedRelativeLocation, entityId(); frameState() |
simObjectReferenceTemplate.h / .inl | None | entityType() |
simpleTypedDictionary.h | setValue and elementIDValue no longer use makVrv types; vrvCore include removed | None |
simulatedObjectStateComponent.h | New sidc / setSidc virtuals on the base interface | None |
spotReportStateComponent.h | Observer API uses DtUUID; visualHandlerType, dataHandlerType, isTDLReport removed; vrvCore include removed | sidc; operator== / operator!= on the data struct |
stateComponent.h | None | LaserLightStateComponent and SearchLightStateComponent enumerators; setMarkedForRemoval / markedForRemoval on DtFrameStateInterface |
stateData.h | entityId() returns const DtEntityIdentifier&; getStateComponentList filters removal-marked components | setSidc / sidc; ownsComponents(); signal_uuidChanged now mutable |
stateDataManager.h | reserve() is a high-water mark, not cumulative | None |
stateDataSimulatedObjectStateComponent.h | Must implement sidc / setSidc | sidc / setSidc |
stateDataWrapper.h | isTDLReport() removed | parameterProperties(); sidc() |
timeAndDateStateComponent.h | scenarioStartTimeAtLocalOnFirstObjectCreationToTime and scenarioStartTimeIsLocal removed | None |
trueAggregateRollUp.h | New header | DtTrueAggregateRollUp, DtTrueAggregateRollUpFunctor |
vrfGeometryStateComponent.h | None | markingText(); setMaximumVertices() |
simObjectManagerTemplate.h / .inl, stateComponentFactory.h, stateComponentImplementationTemplate.h, stateDataTypes.h, vrfStateComponent.h, doubleBufferedDataStorage.h | None | None |
Return to VR-Forces 5.3 API Migration Guide.
[Home]