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

30.5 Interface Token Class

COtlInterfaceToken template class encapsulates an interface pointer for stream based marshaling to a worker thread. Just declare the thread procedure to accept COtlInterfaceToken<InterfaceType> as a parameter, and then use the parameter like a regular interface pointer in the worker thread. Any number of interface pointers can be passed to a thread procedure in this manner without explicit calls to marshaling APIs. The following code from the InterfaceToken sample is of a global function receiving an interface token as a parameter:

While the token can be used any number of times in the receiving function, it is only unmarshaled once.

Because it can only be used in the context of a single function call, construct the interface token in the calling parameter list. The constructor takes an interface pointer as its only argument. You can use a smart pointer or standard interface pointer in the constructor parameter, as shown here:

This code does not really do any threading, but shows how the parameters must be declared to accept an interface token object. The next section shows you how to encapsulate the entire function call with parameters in a functor object.

As an alternative to interface tokens, Objective Toolkit also includes a Global Interface Table class that you can use to marshal interface pointers: OtlGIT. For more information about OtIGIT, please see the OtlGIT online documentation.



Previous fileTop of DocumentContentsNo linkNext file

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

The Rogue Wave name and logo, and Stingray, 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.