home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / next / programm / 7097 < prev    next >
Encoding:
Text File  |  1992-11-09  |  1.4 KB  |  50 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!spool.mu.edu!nigel.msen.com!math.fu-berlin.de!uniol!tpki.toppoint.de!aplki!ploeger
  3. From: ploeger@aplki.toppoint.de (Andreas Ploeger)
  4. Subject: Re: Archiving objects with multiple references
  5. Message-ID: <1992Nov6.153251.625@aplki.toppoint.de>
  6. Sender: ploeger@aplki.toppoint.de
  7. Reply-To: ploeger@aplki.toppoint.de
  8. Organization: Andreas Ploeger
  9. References: <Bx6HEs.F1v@ns1.nodak.edu>
  10. Date: Fri, 6 Nov 92 15:32:51 GMT
  11. Lines: 37
  12.  
  13. In article <Bx6HEs.F1v@ns1.nodak.edu> glaeske@plains.NoDak.edu (Brian Glaeske)  
  14. writes:
  15. > Pictorially, I have:
  16. >     Obj1 ---> Obj2 ---> Obj3  and visa versa  Obj3 ---> Obj2 --1
  17. > (...)
  18. > Now, how do I archive this and restore this mess?  I haven't seen any source
  19. > code that does anything like this (I might have missed something).
  20.  
  21. I would do it this way:
  22.  
  23.     - read:(NXTypedStream*)stream
  24.     {
  25.       myTarget = NXReadObject(stream);
  26.       return self;
  27.     }
  28.     
  29.     - write:(NXTypedStream*)stream
  30.     {
  31.       NXWriteObject(stream, myTarget);
  32.       return self;
  33.     }
  34.  
  35. Look up NXWriteObject in Digital Librarian:
  36.   "...These functions also ensure that objects are written only once."
  37.  
  38. So, even when multiple Objects (Obj1, Obj3) have references to a given object  
  39. (Obj2) which are written this way, the target (obj2) is only written once.
  40.  
  41. Hope this helps,
  42.  
  43. Andreas
  44.  
  45. -- 
  46. Andreas Ploeger, Kiel, Germany
  47.