Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Advanced Tools Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

2.3 Introduction to the Handle-Body Architecture

The streams in the Advanced Tools Module are implemented using a common C++ design technique called the handle-body idiom. The hierarchies in the Streams and Serialization packages include body classes, whose names end in Imp signifying implementation, and handle classes. Each runnable instance consists of a protected body class and a public handle class that references it. Concrete classes include a public static make() function that when called returns a corresponding handle class. Applications then manipulate streams through their handle classes, which isolates the applications from concrete stream classes and ensures a uniform interface to any class within a stream family.

The Serialization package derives its hierarchy from the Streams package. You can extend and customize stream behavior in either package by deriving from the classes in the RWObjectOutputStreamImp and RWObjectInputStreamImp hierarchies, the body classes in the Streams package.

The handle-body idiom allows you to use streams as automatic variables on the stack and as instance variables without regard for dynamic memory management. It also makes streams safe for multithreaded applications. For additional information regarding the handle-body idiom, see the Smart Pointer package in the Threads Module User's Guide.



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.