[comp.lang.c++] Object/IO in NIHCL

sundvall@bio.embnet.se (Mats Sundvall) (05/27/91)

I am aboout to use the object IO mechanism in NIHCL 3.0 to be able to tranfer
data transactions between two machines. What I have not figured out yet is
if you transfer an object that contains pointers to other objects, are the
objects pointed to transfered as well.


class Transaction : public Object {

private:
	int counter;
	someObject	*typeofdata;
	someOtherObject data;

..

}


I do not want typeofdata to be transfered in every transaction because that
will be to much overhead.

 

Mats.Sundvall@sunbrk.FidoNet.Org (Mats Sundvall) (05/28/91)

I am aboout to use the object IO mechanism in NIHCL 3.0 to be able to tranfer
data transactions between two machines. What I have not figured out yet is
if you transfer an object that contains pointers to other objects, are the
objects pointed to transfered as well.


class Transaction : public Object {

private:
	int counter;
	someObject	*typeofdata;
	someOtherObject data;

..

}


I do not want typeofdata to be transfered in every transaction because that
will be to much overhead.

 

 * Origin: Seaeast - Fidonet<->Usenet Gateway - sunbrk (1:343/15.0)

kgorlen@alw.nih.gov (Keith Gorlen) (05/31/91)

In article <1991May27.145953.115@bio.embnet.se>, sundvall@bio.embnet.se (Mats Sundvall) writes:
|> 
|> I am aboout to use the object IO mechanism in NIHCL 3.0 to be able to tranfer
|> data transactions between two machines. What I have not figured out yet is
|> if you transfer an object that contains pointers to other objects, are the
|> objects pointed to transfered as well.
|> 
|> 
|> class Transaction : public Object {
|> 
|> private:
|> 	int counter;
|> 	someObject	*typeofdata;
|> 	someOtherObject data;
|> 
|> ..
|> 
|> }
|> 
|> 
|> I do not want typeofdata to be transfered in every transaction because that
|> will be to much overhead.
|> 
|>  

You will have to write a storer() member function and a readFrom() constructor for class Transaction that will store/read instances of class Transaction.  These
functions can decide whether or not to store/read typeofdata.  Note that if you store a data structure that contains multiple Transaction instances, and some or all of these instances point to a shared instance of someObject, and your write the storer()/readFrom() for class Transaction to unconditionally store/read typeofdata, the shared someObject instances will be stored only once anyway.

-- 
	Keith Gorlen			phone: (301) 496-1111
	Building 12A, Room 2033		FAX: (301) 402-0007
	National Institutes of Health	uucp: uunet!kgorlen%alw.nih.gov
	Bethesda, MD 20892		Internet: kgorlen@alw.nih.gov