![]() |
VR-Forces Developer's Guide
|
makVrf::DtStateData is the protocol independent storage of data received from the network (see The Network Component The Network Component).
This is necessary to allow any type of network connection to be used in the VR-Forces front-end and back-end and have the two pieces share common code to do that network translation. The network component is reponsible for creating the makVrf::DtStateData and poulating it with data, however, from that point the front-end and back-end only deal with the protocol independent data. The visualization thread has no direct access to the network thread or network data, so, it needs this state data to be able to use data in a protocol independent way (see also vrfGuiStateViews GUI Representation of State Data).
The makVrf::DtStateDataManager is a collection of makVrf::DtStateData objects. When discovering a remote object, the makVrf::DtRemoteObjectManager will create new makVrf::DtStateData from the makVrf::DtStateDataManager:
Once created the state data manager will maintain the state data pointer and during advance frame, advance all state data in parallel to update from their next frame data to their current frame data. The makVrf::DtStateDataManager is the central place for storage of all protocol independent data. The makVrf::DtStateDataManager is given access to a VR-Forces makVrf::DtVrfParameterDb. This database contains, by entity type, the additional makVrf::DtStateComponent objects that are used to keep the individual data (see State Components State Components). These state components are defined in the ope files
Using this mechanism you can add any type of additional data to a makVrf::DtStateData without having to subclass and replace parts of the state data class (see Add State Component)
makVrf::DtStateComponent classes are used to store and retrieve simulation data in the system. Each state component is organized around a common set of data, and, can be added to the makVrf::DtStateData as one or more of the same state components (i.e. an entity can have more than one radio transmitter component). The state components are responsible for keeping track of the next frame data and the current frame data. Each component will be broken up into 4 sections:
During a frame run, the frame is started by calling beginFrame on the state data manager, and then advanceFrame when complete. In between the being and advance of the frame, data can be modified for the next frame and accessed for the current frame. When advance frame is called, the state data manager will, in parallel, advance the next frame data to the current frame. Each state component is responsible for transferring next frame data to current frame data. The current state components are:
You can add (or remove) a state component from a state data by using the addStateComponent<_TemplateClass> or removeStateComponent<_TemplateClass>. The state components classes are also registered in the makVrf::DtStateComponentFactory. This is how the state data can create components from the .ope file and add them to the state data on object creation. The Add State Component shows how to add a new state component that contains new data to a state data. You can also add a state component by state component type. For example
Each state component has a TypeWithCreator method that can be used to supply to the addStateComponent in order to add a new state component of that type.