Hello All,

I've got a potentially tricky problem here. My app is backed by a network-like 
data structure based on three objects: a Network_Controller, a Network, and a 
set of Nodes. The network is arranged in a hierarchy of levels, with each level 
having at least one node. The Network object stores this as a 2D NSArray; each 
level is an NSArray, which holds an NSArray of Nodes for the given level. The 
Nodes, obviously, also have parent/child relationships. 
Now, the problem has been in reading files saved using NSCoder. I'm 
reading/writing these files in a fairly typical manner, at this stage, by 
having the Network_Controller initiate the save, which tells the Network to 
encode its 2D array of Nodes, each of which encodes its necessary data, in turn 
(as per the typical way of using encodeWithCoder/initWithCoder). A single 
Node's data, however, includes references to parent/child Nodes. So the 
question is, how to best decode this from the file? Ideally, I suppose, it 
should start at the top level, decode the single top-level Node first, then 
work its way down. I'm not doing that, at this point, as I'm just letting the 
Network decode its 2D array of Nodes, and crossing my fingers. It loads, but 
the behaviour of the whole thing after loading is not what it should be - it's 
a complex system, so it's hard to identify exactly why, but it isn't doing what 
it should be doing.
Any thoughts on how to manage this sort of decoding? And should I also approach 
the encoding in a particular way?

Thanks in advance.

J._______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to