next up previous
Next: Other Modeling Library classes Up: Class Library Previous: ProcessWriter

DataPort, IntPort and BoolPort

All objects which are to be used as either inputs or outputs to an element of a simulation must be derived from DataPort. It exists to provide a mechanism of relating one simulation element to another, and updating the necessary values of the port when needed. In order to do this, all DataPorts must be associated with an owner (which will be a ProcessElement), and the identification of that owner is the main purpose of this class. Derived classes provide the actual data that will be transferred between elements.


There is very little a user needs to know about the internal workings of DataPort class, only that all ports must be derived from it. However, the model provides a couple of useful DataPort derived classes, IntPort and BoolPort. These will probably be sufficient for most interconnections between elements, although more specialized data formats may be needed in some cases. IntPort provides a port which can have any number of integer values, and BoolPort provides the same for boolean values.


Essentially, IntPort is just an integer array wrapped in a class which also derives from DataPort. The methods getWord and setWord are provided for access to the integer values, and these also provide naive array bounds checking. The constructor and accessors are defined in such a way that they can be used without indices if a port providing a single integer value is required. The BoolPort class is very similar, with the names of the accessors being getBit and setBit.


next up previous
Next: Other Modeling Library classes Up: Class Library Previous: ProcessWriter
M.P.J.Landon 2003-05-15