🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.programmer
Article #1387

Re: Archiving objects with multiple references

#1387
From: Andreas Ploeger
Date: Fri, 06 Nov 1992 15:32
37 lines
1445 bytes
In article <Bx6HEs.F1v@ns1.nodak.edu> glaeske@plains.NoDak.edu (Brian Glaeske)  
writes:
> 
> Pictorially, I have:
> 
> 	Obj1 ---> Obj2 ---> Obj3  and visa versa  Obj3 ---> Obj2 --1
> (...)
> Now, how do I archive this and restore this mess?  I haven't seen any source
> code that does anything like this (I might have missed something).
> 

I would do it this way:

    - read:(NXTypedStream*)stream
    {
      myTarget = NXReadObject(stream);
      return self;
    }
    
    - write:(NXTypedStream*)stream
    {
      NXWriteObject(stream, myTarget);
      return self;
    }

Look up NXWriteObject in Digital Librarian:
  "...These functions also ensure that objects are written only once."

So, even when multiple Objects (Obj1, Obj3) have references to a given object  
(Obj2) which are written this way, the target (obj2) is only written once.

Hope this helps,

Andreas

-- 
Andreas Ploeger, Kiel, Germany
Technical Details
Message-ID: <1992Nov6.153251.625@aplki.toppoint.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!nigel.msen.com!math.fu-berlin.de!uniol!tpki.toppoint.de!aplki!ploeger
References: <Bx6HEs.F1v@ns1.nodak.edu>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer
Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!nigel.msen.com!math.fu-berlin.de!uniol!tpki.toppoint.de!aplki!ploeger
From: ploeger@aplki.toppoint.de (Andreas Ploeger)
Subject: Re: Archiving objects with multiple references
Message-ID: <1992Nov6.153251.625@aplki.toppoint.de>
Sender: ploeger@aplki.toppoint.de
Reply-To: ploeger@aplki.toppoint.de
Organization: Andreas Ploeger
References: <Bx6HEs.F1v@ns1.nodak.edu>
Date: Fri, 6 Nov 92 15:32:51 GMT
Lines: 37