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

11.8 Portable Guard Classes

Guarding other classes follows the same pattern. Assuming that all guards follow the pattern GuardXXX, where XXX is the name of a DB Interface Module class, you can use a simple macro to provide a portable interface, whether or not the compiler uses templates. The macro would look something like this:

The first macro concatenates the word Guard with the name of the class, RWDBConnection, and creates an instance of that class called guard__, initialized with the OBJECT (conn). The second macro simply instantiates an instance of class Guard with the type Class (Class = RWDBConnection). Even if your compiler or application does not support templates, you can use these macros in a portable manner as follows:

Even when using the portable guard class template, you must still create a specialized guard class for each DB Interface Module object type you want to guard. For example, to guard an RWDBSchema, you have to create:

This is necessary in addition to using GUARD(RWDBSchema, mySchema) in your code.



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.