Port Types
To facilitate the creation of components, templates have been written
to help the programmer create input and outport ports that will become
members of their component. These templates are called InputPort and
OutputPort. The template parameter indicates the data type the the port
handles.
In order for a class T to be a port data type (i.e. in order to instantiate
InputPort<T> or OutputPort<T>), we must define the following functions for T:
HPCxx_String T::typeID();
This method returns an identifier for the type T. If objects of
type T
are passed between the component and the CAT (for example, configuration
parameters), then the value of the identifier should match the fully qualified
file name for the corresponding type at the CAT (in the java code).
void hpcxx_pack(HPCxx_Buffer&, T* , int count);
void hpcxx_unpack(HPCxx_Buffer&, T*, int count);
These two functions specify how an object of type T should be marshaled and
un-marshaled. Again, if this data type must be sent or received from the CAT,
the marshaling (un-marshaling) should be performed in the way that is
compatible with nexusRMI.
ostream& operator<<(ostream& c, T& s);
This is an operator that writes some information about the object to an
ostream. For example, if T is sparseSystem, then this operator might print
how many rows and columns the matrix has, and some other useful statistics
about the matrix. The string that gets written here will appear at the CAT,
when the CAT queries a port about it's current state.
Java class at the CAT:
For KNOB port types created on the C++ side, a corresponding Java class must
be created and made accessible to the CAT. This java class should contain the
data field of the port type in the same order that they are unpacked by
hpcxx_unpack() described above, and the java class must implement u
Serializable.
This will ensure that the RMI compiler will generate that appropriate code to
serialize and de-serialize the object when being passed or received as an
argument.
dastern@extreme.indiana.edu
Last updated: Tue Jan 26 16:06:16 1999