Agile ALM
Free SaaS for open source projects on Amazon EC2 cloud
This server hosts 24000 users !
         
View all tags
Tags :  No tags associated yet.

生成和读取数据

读取数据

原文:

Data Generators constantly receive new data. However, the application may still be using older data (for example, the previous frame of the depth map). As a result of this, any generator should internally store new data, until explicitly requested to update to the newest available data.

This means that Data Generators "hide" new data internally, until explicitly requested to expose the most updated data to the application, using the UpdateData request function. OpenNI enables the application to wait for new data to be available, and then update it using the xn::Generator::WaitAndUpdateData() function.

In certain cases, the application holds more than one node, and wants all the nodes to be updated. OpenNI provides several functions to do this, according to the specifications of what should occur before the UpdateData occurs:

  • xn::Context::WaitAnyUpdateAll(): Waits for any node to have new data. Once new data is available from any node, all nodes are updated.
  • xn::Context::WaitOneUpdateAll(): Waits for a specific node to have new data. Once new data is available from this node, all nodes are updated. This is especially useful when several nodes are producing data, but only one determines the progress of the application.
  • xn::Context::WaitNoneUpdateAll(): Does not wait for anything. All nodes are immediately updated.
  • xn::Context::WaitAndUpdateAll(): Waits for all nodes to have new data available, and then updates them.

The above four functions exit after a timeout of two seconds. It is strongly advised that you use one of the xn::Context::Wait*…+UpdateAll() functions, unless you only need to update a specific node. In addition to updating all the nodes, these functions have the following additional benefits:

  • If nodes depend on each other, the function guarantees that the "needed" node (the lower-level node generating the data for another node) is updated before the "needing" node.
  • When playing data from a recording, the function reads data from the recording until the condition is met.
  • If a recorder exists, the function automatically records the data from all nodes added to this recorder.

译文: