Top Up Prev Next Bottom Contents Index Search

6.3 Class MultiPortHole


A MultiPortHole is an organized connection of related PortHoles. Any number of PortHoles can be created within the PortHole; their names have the form mphname#1, mphname#2, etc., where mphname is replaced by the name of the MultiPortHole. When a PortHole is added to the MultiPortHole, it is also added to the porthole list of the Block that contains the MultiPortHole. As a result, a Block that contains a MultiPortHole has, in effect, a configurable number of portholes. A pair of MultiPortHoles can be connected by a "bus connection". This technique creates n PortHoles in each MultiPortHole and connects them all "in parallel". The MultiPortHole constructor sets the "peer MPH" to 0. The destructor deletes any constituent PortHoles.

6.3.1 MultiPortHole public members

void initialize(); 
Does nothing.

void busConnect (MultiPortHole& peer, int width, int delay = 0); 
Makes a bus connection with another multiporthole, peer, with width width and delay delay. If there is an existing bus connection, it is changed as necessary; an existing bus connection may be widened, or, if connected to a different peer, all constituent portholes are deleted and a bus is made from scratch.

int isItMulti() const; 
Returns TRUE.

MultiPortHole& setPort(const char* portName, 
Block* parent,DataType type = FLOAT);
int numberPorts() const; 
Return the number of PortHoles in the MultiPortHole.

virtual PortHole& newPort(); 
Add a new physical port to the MultiPortHole list.

MultiPortHole& realPort(); 
Return the real MultiPortHole associated with me, translating any aliases.

void setAlias (MultiPortHole &blockPort); 
Set my alias to blockPort.

virtual PortHole& newConnection(); 
Return a new port for connections. If there is an unconnected porthole, return the first one; otherwise make a new one.

6.3.2 MultiPortHole protected members

PortList ports; 
The list of portholes (should be protected).

const char* newName(); 
This function generates names to be used for contained PortHoles. They are saved in the hash table provided by the hashstring function .

PortHole& installPort(PortHole& p); 
This function adds a newly created port to the multiporthole. Derived MultiPortHole classes typically redefine newPort to create a porthole of the appropriate type, and then use this function to register it and install it.

void delPorts(); 
This function deletes all contained portholes.



Top Up Prev Next Bottom Contents Index Search

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