IBM InfoSphere Streams Version 4.1.0
Advanced code generation
When you create generic operators, you can use advanced code generation techniques for more operator customization and control.
- Code sharing
To share code between different operators in a toolkit, use one of the supported sharing methods. - Error reporting
SPL code generation APIs provide four different families of functions that are related to error reporting. These functions are the print, warn, error, and exit family of functions that are supplied by the SPL::CodeGen module. - Type inspection
The SPL code generation APIs include various type inspection functions, which are supplied by the SPL::CodeGen::Type module. - Checking schemas
Some primitive operators require that the output port has the same schema as the input port. To comply with this requirement, you must check the schema. - Helper class generation
When you develop generic operators, you often need to emit a class, which contains member variables with a list of types. The SPL code generation framework provides an emitClass function within the SPL::CodeGen module for this purpose. - Parameter helpers
When you write generic operators, you often must obtain the list of types and expressions that are associated with the parameter expressions. The SPL code generation framework provides helper functions within the SPL::CodeGen module to simplify this task. - Output tuple helpers
During code generation for generic operators, you often must initialize or assign an output tuple that is based on output attribute assignments that are captured in the operator instance model. SPL provides helper functions within the SPL::CodeGen module simplify this task. - Window handling
The SPL code generation framework provides code generation APIs to ease the common tasks that are associated with window handling. - Accessing paths at compile time
The SPL code generation APIs provide the methods to access special paths at code generation time. - Generating C++ code from an SPL expression tree
An SPL expression tree represents the SPL expression for a parameter or output expression in a form that can be easily traversed in a C++ primitive operator. To use SPL expression trees, the context of the primitive operator must include an <splExpressionTree [param="true|false"] [output="true|false"] [cppCode="true|false"]/> element.
Parent topic: Developing C++ primitive operators