Schedule schedule = director.getScheduler().getSchedule();
boolean isIDefined = false;
Iterator actorsToFire = schedule.firingIterator();
while (actorsToFire.hasNext()) {
Firing firing = (Firing) actorsToFire.next();
Actor actor = firing.getActor();
// FIXME: Before looking for a helper class, we should check to
// see whether the actor contains a code generator attribute.
// If it does, we should use that as the helper.
CodeGeneratorHelper helper = (CodeGeneratorHelper) _getHelper((NamedObj) actor);
if (inline) {
for (int i = 0; i < firing.getIterationCount(); i++) {
// generate fire code for the actor
code.append(helper.generateFireCode());
code.append(helper.generateTypeConvertFireCode());
// update buffer offset after firing each actor once
Iterator inputPorts = actor.inputPortList().iterator();
while (inputPorts.hasNext()) {
IOPort port = (IOPort) inputPorts.next();
int rate = DFUtilities.getRate(port);
_updatePortOffset(port, code, rate);
}
Iterator outputPorts = actor.outputPortList().iterator();
while (outputPorts.hasNext()) {
IOPort port = (IOPort) outputPorts.next();
int rate = DFUtilities.getRate(port);
_updateConnectedPortsOffset(port, code, rate);
}
}
} else {
int count = firing.getIterationCount();
if (count > 1) {
if (!isIDefined) {
code.append(CodeStream.indent("int i;" + _eol));
isIDefined = true;
}