IBM Streams 4.2

Multiple version toolkit support with C++ operators

There are two fundamental forms of operator implemented using C++; generic and non-generic. The mechanism used to support multiple IBM® Streams versions varies for each.

Generic operators are characterized by the use of a mixed-mode, Perl and C++, model which gives the operator's code generator access to a compile time Perl interface that can be used to determine the version of the IBM Streams a given application is being compiled for. Non-generic operators do not have a compile time Perl interface that can be interrogated. Both generic and non-generic operators have access to the same run time interface.

Supporting multiple IBM Streams versions with a single generic operator implementation is relatively straight-forward. Since inception the Perl API has provided to the code generator the IBM Streams version for which code is to be generated. Use of that version information, along with Perl code in the code generator, your code generator can generate code that is specific to that Streams version. As such you can utilize any compile or run time API that is valid for that version of Streams. The API to use is:

my $context = $model->getContext();
my $productVersion = $context->getProductVersion();

Given the product version you can generate version-specific C++ code.

Multiple version support for non-generic operators was added in Version 4.0 so your options here are more limited. Version 4.0 added the following four macro definitions to the C++ compile:

_IBM_STREAMS_VER_
_IBM_STREAMS_REL_
_IBM_STREAMS_MOD_
_IBM_STREAMS_FIX_

These macros are defined on every C++ compile performed using the Version 4.0 or later SPL compiler. They can be used to determine if the IBM Streams version you are compiling for is prior to Version 4.0, or Version 4.0 and beyond with detail to the version, release, modification and fix level. Your code generator should then generate code for all versions of IBM Streams it needs to support, with conditional compilation guarding the version specific parts of the code.