class ConcatParams {
public:
ConcatParams() : times(1) {}
int times; // tells component to produce (AB)^k, where A is the
// input on iPort1, B is on iPort2, and k is this
// this parameter
static HPCxx_String typeID() { return "examples.ConcatKnobPort"; }
friend void hpcxx_unpack(HPCxx_Buffer&, ConcatParams*, int count);
friend void hpcxx_pack(HPCxx_Buffer&, ConcatParams*, int count);
};
Note that the default value specified for times is the value that the
CAT will initially retrieve from the component and display as the default
to the user.
It is important that the value returned by ConcatParams::typeID() ("example.ConcatKnobPort") is the fully qualified class name of the corresponding class at the CAT.
void hpcxx_unpack(HPCxx_Buffer& b, ConcatParams* p, int count)
{
hpcxx_unpack(b,&p->times,1);
}
void hpcxx_pack(HPCxx_Buffer& b, ConcatParams* p, int count)
{
HPCxx_String typeID = p->typeID();
hpcxx_byte twenty(20);
hpcxx_pack(b,&twenty,1);
hpcxx_pack(b,&typeID,1);
hpcxx_pack(b,&p->times,1);
}
Note hpcxx_pack must specify a little bit more information than
hpcxx_unpack. This is because by the time hpcxx_unpack
has been
called, the typeID of the object has already been removed from the
buffer. For compatibility with nexusRMI, a marshaled object must
always begin with byte20 followed by the fully qualified file name.
// operator<< is required by all port-types in case a textual description of
// the contents of the port is required.
ostream& operator<<(ostream&c, ConcatParams& d)
{
c << d.times << " times." << endl;
return c;
}
Finally, we must create a corresponding class at the CAT, and it must
be accessible as example.ConcatKnobPort:
public class ConcatKnobPort implements Serializable {
public int times;
public ConcatKnobPort() {
this.times = 0;
}
}
Last updated: Thu Jan 28 16:06:40 1999