The procedure for creating a new kind of set data request is very similar to creating a new task by overriding DtSimTask.
For a detailed description of how to create a new task in VR-Forces, please see 12.4 - Deriving a New Task from DtSimTask. The analogous steps for creating a set data request are:
-
Create a derived DtSetDataRequest (setDataReq.h) class. You must implement the following functions in the derived class:
-
Pure virtual type(), clone(), and stringRep() member functions
-
Static creator function
-
netRepSize(), setToNet(), and setFromNet() functions.
-
Register the new set data request with the corresponding factory. Override the DtFactoryManager class to register the new creator function with the appropriate set data request factory.
-
Add a controller for handling the new set data request. In this controller, you must register a callback for handling the set data request with the Set Data Manager as either a processor or notify callback. Please see 4.9 - The Set Data Manager.
The following list summarizes the differences between creating a new DtSetDataRequest and creating a new DtSimTask:
-
When you add the new creator function to the factory in the DtFactoryManager to register the new creator function, override DtFactoryManager::registerSetDataRequestCreators() to add a new DtSetDataRequest creator function.
-
In your callback function for handling the set data request, the type of radio message passed into the function is different. You need to cast the incoming DtSimMessage* to a DtSetDataRequestMessage* if you are overriding a DtSetDataRequest.
-
Set data request callbacks are registered with the Set Data Manager instead of the task controller component.
[<< Adding a User Task] [Home] [Top of Page] [Simulation Commands >>]