Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

5.1 Overview

The jtools library contains two Java packages that provide a framework for exchanging objects between programs written in Java and programs written in C++:

Specifically, these packages let you take objects that are serialized via the Tools.h++ virtual stream facility, and save or restore them with a Java program.

For example, you might write a Tools.h++ RWCString to a virtual stream from a C++ program and read it into a Java program as a java.lang.String object. Or you could take a java.util.Vector object, save it to a jtools library virtual stream, and read it into a C++ program as a Tools.h++ RWOrdered vector. As with traditional Tools.h++ virtual streams, the graph of objects is preserved.

Although this feature gives the illusion of passing objects back and forth between processes, there is no real magic here. Objects are not actually moving from one place to another. Rather, a C++ object is serialized into a virtual stream in some predetermined format so that a Java program can decode that information into a Java object, and vice-versa.

These Java/C++ mappings are defined by small helper objects called streamers. Rogue Wave provides prebuilt streamers that map Tools.h++ classes to classes in the Java core packages, or to classes in the com.roguewave.tools.v2-0 package. For example, there are streamers that map a Tools.h++ RWTime to a java.util.Date, a Tools.h++ RWCollectableInteger to a java.lang.Integer, and a Tools.h++ RWSet to a com.roguewave.tools.v2-0.Set. Of course, you can write your own streamers to provide alternative mappings or mappings for your own classes.

The following discussion assumes that you are already familiar with Version 7 of Tools.h++ and the information contained in the Tools.h++ User's Guide. In particular, you should be familiar with techniques for persisting objects using the virtual streams in Tools.h++.


Previous fileTop of DocumentContentsIndexNext file

©Copyright 2000, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.