Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleExample
operator ODLSelect(outputMode = "INPUT", minInputPorts = 1, maxInputPorts = 1){   

    parameter IPredicate predicate;

    optional parameter int heartbeatrate;
	
	//...
}

 

Note that not every data type can be used for a parameter because each data type must have a corresponding parameter class in Odysseus. The following table shows the available data types:

...

Code Block
titleExample
operator ODLProject(outputMode ="MODIFIED_INPUT", minInputPorts = 1, maxInputPorts = 1){    
    
    parameter(type=ResolvedSDFAttributeParameter) SDFAttribute[] attributes;
          	
	//...
}

Attributes

Besides parameters it is also possible to define attributes to store operator’s data.

Code Block
titleExample
operator ODLJoin(outputMode = "NEW_ELEMENT", minInputPorts = 2, maxInputPorts = 2){    
    
    ITimeIntervalSweepArea[] areas;     
    IDataMergeFunction dataMerge;
    ITransferArea transferFunction;
    IMetadataMergeFunction metadataMerge;
	
	//...
}

Validate methods

Each parameter can have a validate method. This method must return whether the value of the parameter is correct.

Code Block
titleExample
operator ODLProject(outputMode ="MODIFIED_INPUT", minInputPorts = 1, maxInputPorts = 1){    
    
     validate attributes {
        if (this.attributes.isEmpty) {
            error("attributes have to be set");
            return false;
        }
        return true;
    }
	
	//...
}

 

There is also a validate method which can be used if a parameter has dependencies to other parameters.

Code Block
titleExample
operator ODLProject(outputMode ="MODIFIED_INPUT", minInputPorts = 1, maxInputPorts = 1){    
    
     validate {
        return true;
    }
	
	//...
}