RE: [sv-bc] stream to object hierarchy

From: Arturo Salz <Arturo.Salz_at_.....>
Date: Sun Apr 13 2008 - 13:48:16 PDT
Shalom,

 

That sentence is in the context of this paragraph: 

When applied to a class handle (i.e., an object), the streaming operator
shall stream the contents of the object, and not the handle itself.
Class items are streamed in declaration order; extended class items
shall fol-low the items of their superclass. Embedded class handles are
streamed as other aggregate types: they are recursively traversed in
depth-first order until reaching integral types.  A null  class handle
shall be ignored (not streamed), and a warning may be issued. Null
handles are skipped by both the pack and unpack opera-tors; therefore,
the unpack operation shall not create class objects.

 

Hence it conveys two concepts:

1) Re-emphasizes that last sentence stating that streaming operations do
not create objects.

2) A stream can be unpacked into a collection of contained objects,
provided the objects exist prior to streaming.

 

Here's an example:

 

class Number;

  int  n;

  function new(int x); n = x; endfunction

endclass

 

class Pair;

  Number  left;

  Number  right;

  int     avg;

endclass

 

Pair p, r;

bit q[$];

p = new(); p.left = new(2); p.right = new(4); p.avg = 3;  // create and
initialize Pair object

 

q = {<<{p}};      // stream object into queue

 

r = new(); r.left = new(0); r.right = new(0);             // create
other Pair object

{<<{r}} = q;            // stream queue onto new object collection - r
is a copy of p

 

In order for 'r' above to be a copy of p, the two contained objects
(r.left and r.right) must have been created (as done above).

 

            Arturo

 

From: owner-sv-bc@eda.org [mailto:owner-sv-bc@eda.org] On Behalf Of
Bresticker, Shalom
Sent: Sunday, April 13, 2008 1:20 AM
To: sv-bc
Subject: [sv-bc] stream to object hierarchy

 

Hi, 

1.4.14 says about the streaming operators, 

If a particular object hierarchy is to be reconstructed from a stream,
the object hierarchy into which the stream is unpacked must be created
before the streaming operator is applied.

Can someone explain to me what this means and give an example? 

Thanks, 
Shalom 

Shalom Bresticker 
Intel Jerusalem LAD DA 
+972 2 589-6582 
+972 54 721-1033 

---------------------------------------------------------------------
Intel Israel (74) Limited
 
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


-- 
This message has been scanned for viruses and 
dangerous content by MailScanner <http://www.mailscanner.info/> , and is

believed to be clean. 


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sun Apr 13 13:49:54 2008

This archive was generated by hypermail 2.1.8 : Sun Apr 13 2008 - 13:51:52 PDT