| 1 | [[TracNav(TracNav/TOC)]] |
| 2 | |
| 3 | = Module for Data Input/Output : dataIO = |
| 4 | |
| 5 | == Introduction == |
| 6 | |
| 7 | dataIO is the module to unitize data input or output of a render node, independend if the node is connected via cluster or externalLink. It provides a unified interface to query or set data values and set or execute executer tasks. |
| 8 | |
| 9 | Behind this interface, dataIO syncronise at appropriate positions the relevant data over the cluster module to all connected render nodes, so the osgVisual cluster renders consistend views. |
| 10 | The connection to the simulator is hold by the module extLink, which gets all values, queries and executer from simulation host and returns the queried return values. |
| 11 | |
| 12 | Every rendering node in the visual system does not need to care if it's role is cluster master or cluster slave, it hast just to use the unified dataIO interface. Picture 1 clarifies the structore of the dataIO module. |
| 13 | |
| 14 | == SLOT concept == |
| 15 | |
| 16 | The main conecpt for data exchange is the slot concept. Therein dataIO holds a array of slots, each containing the following values: |
| 17 | * variableName (string) |
| 18 | * direction (enum: TO_OBJ, FROM_OBJ) |
| 19 | * variableType (enum: DOUBLE, STRING) |
| 20 | * value (double) |
| 21 | * sValue (string) |
| 22 | |
| 23 | Each slot in dataIO's slot list can be accessed by all application modules (modules, objects etc). A slot may updated from any module - this can be a return value of an object as well as the cluster or extLink module. |
| 24 | |
| 25 | === Data flow === |
| 26 | |
| 27 | To explain the dataflow, lets follow an virtual variable from simulation host to osgVisual, to a specific visual_object, and return. PLease read prior the concept of [wiki:"visual_object"] and the [wiki:"object_updater"]. |
| 28 | |
| 29 | * At first lets assume the virtual variable is: |
| 30 | {{{ |
| 31 | variableName = "testObject_prop_rpm" |
| 32 | direction = TO_OBJ |
| 33 | variableType = DOUBLE |
| 34 | value = 500 |
| 35 | }}} |
| 36 | * testVar should be used by a visual_object named "testObject" to update the object's propeller rotations per minute. |
| 37 | * extLink recieves the latitude for the object (TO_OBJ) "testObject" and stores the value in the slot array. If the slot exists already, the value is updated. Otherweise the slot is added and then updated with the current value. |
| 38 | * cluster reads all values who should transfered to clusters (TO_OBJ) and transfers it over network to all slave nodes' slot array. |
| 39 | * independent of the cluster role of any rendering node (SLAVE or MASTER), now the current value is available on nodes' slot array and can be accessed in an unified way. |
| 40 | * the object_updater can retrieve the value via getSlotDataAsDouble() or getSlotDataAsString() and store it as propeller rpm value. |
| 41 | * Any return value like Height above Terrain (HAT) queries are written as FROM_OBJ variable to the slot array. This happens only at the master node. |
| 42 | * extLink sends all FROM_OBJ slot values to the simulation host. |
| 43 | |
| 44 | === Accessing SLOTs === |
| 45 | |
| 46 | Slots are accessible with several approaches: |
| 47 | * Via Pointer |
| 48 | * void* getSlotPointer( std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_, osgVisual::dataIO_slot::DOUBLE ); |
| 49 | * Via References |
| 50 | * std::string& getSlotRefAsString( std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_); |
| 51 | * double& getSlotRefAsDouble( std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_); |
| 52 | * Via get/set methods |
| 53 | * double getSlotDataAsDouble(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_ ); |
| 54 | * std::string getSlotDataAsString(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_ ); |
| 55 | * void setSlotData(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_, std::string sValue_ ); |
| 56 | * void setSlotData(std::string slotName_, osgVisual::dataIO_slot::dataDirection direction_, double value_ ); |
| 57 | |
| 58 | |
| 59 | |
| 60 | == Executer == |
| 61 | |
| 62 | == Cluster == |
| 63 | |
| 64 | == !ExtLink == |
| 65 | |
| 66 | |
| 67 | |