df86579d7b97448f9b687c75b90901fe94e021ba
[fleet.git] / src / edu / berkeley / fleet / interpreter / InterpreterDestination.java
1 package edu.berkeley.fleet.interpreter;
2 import edu.berkeley.fleet.api.*;
3 import java.util.*;
4
5 abstract class InterpreterDestination extends Destination {
6
7     public InterpreterDestination(InterpreterDock d) {
8         super(d);
9         synchronized(d.getInterpreter()) {
10             this.serialNumber = d.getInterpreter().maxAllocatedDestinationSerialNumber++;
11         }
12     }
13
14     /** adds the included datum to the port from the switch fabric side */
15     public abstract void addDataFromFabric(Packet packet);
16     public abstract String toString();
17
18     /**
19      *  The Fleet instruction encoding mechanism assumes that each
20      *  source->dest path can be turned into a bitstring, and that the
21      *  bitstring gives sufficient information to route the packet.
22      *  Therefore, the interpreter assigns a "serial number" to every
23      *  InterpreterDestination in a fleet and uses the serial number
24      *  of the destination as the path.
25      */
26     private int serialNumber;
27     int getSerialNumber() { return serialNumber; }
28 }