Port Interface

Each port has a type associated with it. This type is the type of object that can be written to and read from the port. On the CAT, an input port may only be connected to an output port of the same type. Templates are used to conveniently generate input and output ports from any type.

Input Ports

The InputPort<T> constructor takes two arguments:
template<class T>
InputPort<T>::InputPort(HPCxx_SyncQ<Request>* p,int req)
The first argument is a pointer to an HPCxx_SyncQ<Request>, and the second argument is a specific request. If this input port is ever written to, then the specific request will be written to the synchronized queue. This allows the main loop of the component to become aware that one of it's input ports has been written to.

Each input port exports the following methods (for remote invocation by the CAT and other components):

RETVAL write(PortWrapper pw);
This method is called by another component (or the CAT), when data is to be written to the input port. A write will cause the object to be stored in the input port, and any object that was previously written to the port is discarded. The HPCxx_SyncQ that was passed as an argument to the constructor is notified.
HPCxx_String getType();
This methods returns the fully qualified name of the type associated with the port (obtained from T::typeID()).
HPCxx_String getName();
This method tells the CAT what name has been associated with the port. The name is given to the port by using the setName(HPCxx_String name) method.
HPCxx_String getReadme();
This method gives the CAT a little blurb about how the component uses this port. For example, the input port of an LSA component with type "sparseSystem" might have a readme that says "The linear system to be solved".
RETVAL getTag();
getTag tells the CAT whether or not the input port is a "knob" port. A port is a knob port it it's sole purpose it to take configuration parameters (in an LSA component, for example, each solver takes a number of parameters, like number of iterations, tolerance, etc.). The CAT will not permit an output port to be connected to a "knob" input port, and it will send parameters to the knob port on a component.
PortWrapper readRemote();
This method allows the CAT to query the current contents of a port. This is currently used so that the CAT can obtain the values of the parameters on a "knob" port. This allows the CAT to obtain a set of default parameters which are present to the user for modification. The updated parameters are written to the "knob" port when the CAT invokes write() on the port.
HPCxx_String getStateInfo();
This method tells the CAT a little bit about the object (if any) that currently resides in the input port's buffer. For example, if an InputPort<sparseSystem> is queried with getStateInfo, it will return some information about the size of the linear system, number of non-zeros, etc.

Output Ports

Output ports are constructed without any parameters, they export many of the same methods as input ports:
HPCxx_String getType();
HPCxx_String getName();
HPCxx_String getReadme();
RETVAL getTag();
PortWrapper readRemote();
HPCxx_String getStateInfo();
Additional, output ports export:
RETVAL addListener(MyHPCxx_GlobalPtr<PortBase> p);
addListener is called by the CAT with an argument to points to an input port. The port to adds this pointer to a list. Subsequently, after each computation, if the component write data to this port, then the data will be propagated (sent over the network) to all listeners in the list. Checks are made to assure that the maximum number of listeners is not exceeded and that there are no duplicates in the list.
RETVAL removeListener(MyHPCxx_GlobalPtr<PortBase> p);
This method removes the given pointer from the list of listeners associated with this port, so that data from this port will no longer be sent to the port at p.


[ IU CS ] [ Extreme! Computing ] [ CAT ] [ HPC++ CAT ]
dastern@extreme.indiana.edu

Last updated: Tue Jan 26 16:05:24 1999