X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Frtems%2FRtemsShaperVisitor.java;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Frtems%2FRtemsShaperVisitor.java;h=cd50166bb6a8ec36505f63f982abf7d83aac12f4;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/rtems/RtemsShaperVisitor.java b/dol/src/dol/visitor/rtems/RtemsShaperVisitor.java new file mode 100644 index 0000000..cd50166 --- /dev/null +++ b/dol/src/dol/visitor/rtems/RtemsShaperVisitor.java @@ -0,0 +1,50 @@ +/* $Id: RtemsShaperVisitor.java 1 2010-02-24 13:03:05Z haidw $ */ +package dol.visitor.rtems; + +import java.util.HashMap; + +import dol.datamodel.pn.Process; +import dol.datamodel.pn.ProcessNetwork; +import dol.util.Sed; +import dol.visitor.PNVisitor; + +/** + * This class is a class for a visitor that is used to generate + * a wrapper class for the traffic shaper. + */ +public class RtemsShaperVisitor extends PNVisitor { + + /** + * Constructor. + * + * @param dir target directory + */ + public RtemsShaperVisitor(String dir, HashMap sinkMap) { + _dir = dir; + _sinkMap = sinkMap; + } + + /** + * + * @param x process network that needs to be processed + */ + public void visitComponent(ProcessNetwork x) { + try { + String filename = _dir + _delimiter + "traffic_shaping.h"; + + Sed sed = new Sed(); + String tmp = "NUMBER_OF_QUEUES " + x.getChannelList().size(); + sed.sed(filename, "@NUMBER_OF_QUEUES@", tmp); + tmp = "NUMBER_OF_SINKS " + _sinkMap.size(); + sed.sed(filename, "@NUMBER_OF_SINKS@", tmp); + } + catch (Exception e) { + System.out.println("RtemsProcessVisitor: exception " + + "occured: " + e.getMessage()); + e.printStackTrace(); + } + } + + protected String _dir = null; + protected HashMap _sinkMap; +}