Newsgroups: comp.parallel.pvm
From: Colin Scott <CS@iinet.com.au>
Subject: Re: C++
Organization: iiNet Technologies
Date: Sun, 24 May 1998 15:15:59 +0800
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-ID: <3567C92F.CBC07855@iinet.com.au>

Ajay Pandya wrote:
> 
> Hello,
> 
> I am using C++ for implementing a parallel matrix multiplication
> algorithm.
> 
> In PVM 3.3.11, if I want to spawn a process from one machine to
> another and pass a user defined data type, like an object , how do I
> do it? According to the standard pvm_pk() routines, I can only send
> int, float,etc. standard data types. So if I  want to send a matrix
> object, is there any other way apart from sending it byte by byte?
> 
> Your response will be greatly appreciated,

If all you want to pass is objects, you could try giving all the classes
to be passed a common base class. Assign each class a unique id, and
then implement a virtual function to return this id for each object
type. Also implement virtual functions to encode and decode the classes.
The encoding function should encode the id as the first element of the
message, but the decoding function shouldnt decode it.

Then, when you want to decode the class, you unpack the id from the
message, and then create an object of the appropriate type. Then, call
it's decode function.

Of course, this requires your decode algorithm to know what type of
object to create for each id. So dynamically creating object types is
probably out.

Colin Scott
4th Year Computer Systems Engineering Student
Curtin University of Technology
http://tactical.ece.curtin.edu.au

