Thread View: comp.sys.next.programmer
2 messages
2 total messages
Started by Brian Glaeske
Wed, 04 Nov 1992 06:16
Archiving objects with multiple references
Author: Brian Glaeske
Date: Wed, 04 Nov 1992 06:16
Date: Wed, 04 Nov 1992 06:16
26 lines
1405 bytes
1405 bytes
Ok, here is what I got. First of all I have a main controlling view. In this view are some subviews and other objects that need to keep pointers to each other in order to send messages. Pictorially, I have: Obj1 ---> Obj2 ---> Obj3 and visa versa Obj3 ---> Obj2 --1 Obj2 only has pointers to Obj1 and Obj3, ut Obj3 and Obj1 are basically instances of the same class. This class can have many such relationships at the same time. In other words Class1 (Obj1 and Obj2) use a List to hold multiple Obj2 instances. 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). Thanks, -- Brian Glaeske - /| glaeske@plains.NoDak.edu [Internet] o.O` --Ooop ACK!! ..!uunet!plains!gehenna!brian [NeXT UUCP] =(___)= U "Bloom County Forever!!"
Re: Archiving objects with multiple references
Author: Andreas Ploeger
Date: Fri, 06 Nov 1992 15:32
Date: Fri, 06 Nov 1992 15:32
37 lines
1445 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads