Using the HIOManager and HIO Plugins

by Rob Mazeffa

HIOManager Overview

HOOPS/MVO includes a class called HIOManager, which manages all file input and output modules. By using this File I/O manager you can simply pass any file reading to HBaseModel::Read and it will use the I/O manager to automatically detect and load the appropriate I/O module. The input/output handlers used for a given filetype are determined primarily by the file extension.

To use the HIOManager object you need to first ensure that your Input/Output handlers are derived from the HInputHandler and/or HOutputHandler classes. In addition to implementing the HInputHandler::FileInputByKey and HOutputHandler::FileOutputByKey methods you need to implement the HOutputHandler::RegisterOutputHandlerTypes and/or HInputHandler::RegisterIntputHandlerTypes methods. These are used by the HIOManager to determine which handler should be used to import/export a specific filetype.

The I/O handlers deal with two distinct data types and the developer specifies the datatype it was designed to import/export by implementing the HInputHandler::GetInputStyle and/or HOutputHandler::GetOutputStyle methods. If the handler is of type model then the data will either be read into a segment, the key to which the developer supplies or written directly out to a file, the handle to which the developer supplies. If the handler is of style Image then the contents of the segment tree will be rendered into a HOOPS Image segment (the key to which the developer provides) and then compressed. For the import case, the raster data will be uncompressed and then placed in the memory referenced by the supplied image key.

HIO Plugins

Some I/O handlers link to external toolkits for handling of formats such as DWF, DWG, or JT. If the handlers are only needed for basic reading and writing of a format and the developer does not need to access APIs from the third party toolkit to implement custom functionality, then the HIO Plugin architecture can be used. This approach removes any need for the application to link in the third party libraries.

With HIO Plugins, you include a provided directory called hio_plugins within the application's working directory. HOOPS/MVO will then load any .hio files (which are simply .dlls) located in the hio_plugins directory, and that HIO library will automatically register it’s supported file extensions with MVO. The HIO component then loads any additional DLLs that it depends on.

The HIO components are located in the bin//hio_plugins directory of your HOOPS installation while the source code to these modules is included in the hoops_mvo/source folder. You can rebuild these components by loading the projects and ensuring you have the appropriate environment variables required by the third party toolkit.

You do not need to recompile your application to use the HIO components. Simply copy the hio_plugins directory into your application's working directory, and your HOOPS/MVO-based application will be able to load any of the files supported by the provided HIO components. Note that if you are using HIO modules with dependencies on external File I/O toolkits such as the DWF Toolkit or RealDWG toolkit, the .dlls for those toolkits need to be present. Contact Tech Soft 3D Sales or Support for more information on obtaining/licensing such external toolkits.

The HOOPS Part Viewer included in the HOOPS/3dAF package uses the HIO modules to enable DWF, U3D, JT and DWG import and/or export.