Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

3.3 Common Themes

Tools.h++ Professional offers several different solutions for transferring data. Here are some general points that apply to all the Tools.h++ Professional libraries.

3.3.1 Creating Chains of Objects

In most situations, you start with an instance of a class that represents a low-level data transfer mechanism-for example, an RWSocket. You then use this low-level construct to create an instance of a higher-level construct-for example, a Rogue Wave virtual stream, such as an RWpostream. In many cases, you must build several levels of intermediate objects before you create the portable stream. For example, to get from an RWSocket to an RWpostream, you might create an RWPortal, then an RWPortalStreambuf, then an RWpostream.

3.3.2 Virtual Streams As Universal Translators

To make effective use of Tools.h++ Professional, you must understand the Tools.h++ concept of virtual streams. All of the Tools.h++ Professional components rely on virtual streams to transmit data. Several virtual stream classes exist, each suited for a different task. For instance, portable ASCII virtual streams (RWpistream and RWpostream), which transmit data in ASCII, work well to transmit data between C++ and Java. The CORBA request streams (RWreqistream and RWreqostream) make it easy to pass an object by value across an Orbix ORB.

A virtual stream is a data sink or source. Virtual streams are extensions of the C++ stream abstraction, an abstract interface that hides the details of data transmission. Rogue Wave provides several different virtual streams, including portable ASCII (pistream and postream), binary (bistream and bostream), and CORBA (reqistream and reqostream). All virtual streams use << and >> to move data in and out of streams.

The mechanics of actually reading and writing data into the various streams and formats are provided by the Rogue Wave virtual stream classes; the user's only responsibility is to create helper functions for every class that will be transmitted over a stream. These helper functions are responsible for reading and writing the instance variables of a class. For a complete discussion of virtual streams, see the Tools.h++ User's Guide.

3.3.3 Transferring Data

You transfer data using Tools.h++ Professional in one of two ways:

  1. For pure C++ applications, you write functions that move instances of your C++ class into and out of a virtual stream. If you already have these functions, you are ready to take advantage of Tools.h++ Professional.

  2. To communicate using the Tools.h++ portable streams format, you create virtual stream functions for the C++ side; on the Java side, you use Java helper classes known as ObjectStreamers.

The rest of this chapter elaborates on these points, and demonstrates the use of Tools.h++ Professional in a few specific situations. Other uses are possible! Review the sample scenarios in the next few sections, and you will see how Tools.h++ Professional classes can be combined to solve your needs.


Previous fileTop of DocumentContentsIndexNext file

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