/* Overridden from SIRStream: */ public void setWork(JMethodDeclaration work) { // if new work function has no I/O rates and old one does, // then transfer rates to new one. This is an ugly remnant of // the old mode of operation, where I/O rates were stored // outside the function. if (!work.doesIO()) { work.setPeek(getWork().getPeek()); work.setPop(getWork().getPop()); work.setPush(getWork().getPush()); } addReplacementMethod(work, getWork()); getPhases()[0] = work; }
public SIRFilter( SIRContainer parent, String ident, JFieldDeclaration[] fields, JMethodDeclaration[] methods, JExpression peek, JExpression pop, JExpression push, JMethodDeclaration work, CType inputType, CType outputType) { super( parent, ident, fields, methods, new JMethodDeclaration[0], // initPhases new JMethodDeclaration[1], // phases inputType, outputType); // Create a single phase corresponding to the work function. // if work function is null, make a dummy one just to hold I/O rates if (work == null) { work = new JMethodDeclaration("Placeholder method for SIRFilter"); } getPhases()[0] = work; work.setPeek(peek); work.setPop(pop); work.setPush(push); // Confirm that the work function is in the methods array. if (work != null) addReplacementMethod(work, work); // check for void type if we have 0 inputs or outputs assert this instanceof SIRTwoStageFilter || ((!(peek instanceof JIntLiteral) || ((JIntLiteral) peek).intValue() > 0) || inputType == CStdType.Void) : "Filter " + this + " declares peek rate of 0 but has input type of " + inputType + " which should be Void instead."; assert this instanceof SIRTwoStageFilter || ((!(push instanceof JIntLiteral) || ((JIntLiteral) push).intValue() > 0) || outputType == CStdType.Void) : "Filter " + this + " declares push rate of 0 but has output type of " + outputType + " which should be Void instead."; }