Top Up Prev Next Bottom Contents Index Search

6.4 AutoFork and AutoForkNode

AutoForks are a method for implementing netlist-style connections. An AutoForkNode is a type of Geodesic built on top of AutoFork. The classes are separate to allow a "mixin approach", so that if a domain requires special actions in its Geodesics, these special actions can be written only once and be implemented in both temporary and permanent connections. The implementation technique used is to automatically insert a Fork star to allow the n-way connection; this Fork star is created by invoking KnownBlock::makeNew("Fork"), which works only for domains that have a fork star.

6.4.1 Class AutoFork

An AutoFork object has an associated Geodesic and possibly an associated Fork star (which it creates and deletes as needed). It is normally used in a multiply inherited object, inherited from AutoFork and some kind of Geodesic; hence the associated Geodesic is the object itself. The constructor for class AutoFork takes a single argument, a reference to the Geodesic. It sets the pointer to the fork star to be null. The destructor removes the fork star, if one was created. There are two public member functions, setSource and setDest.

PortHole* setSource(GenericPort& port, int delay = 0); 
If there is already an originating port for the geodesic, this method returns an error. Otherwise it connects it to the node.

PortHole* setDest(GenericPort& port, int alwaysFork = 0); 
This function may be used to add any number of destinations to the port. Normally, when there is more than one output, a Fork star is created and inserted to support the multi-way connection, but if there is only one output, a direct connection is used. However, if alwaysFork is true, a Fork is inserted even for the first output. When the fork star is created, it is inserted in the block list for the parent galaxy (the parent of the geodesic).

6.4.2 Class AutoForkNode

Class AutoForkNode is multiply inherited from Geodesic and AutoFork. This class redefines isItPersistent to return TRUE, and redefines the setSourcePort and setDestPort functions to call the setSource and setDest functions of AutoFork. The exact same form could be used to generate other types of auto-forking nodes (that is, this class could have been done with a template).

Top Up Prev Next Bottom Contents Index Search

Copyright © 1990-1997, University of California. All rights reserved.