Hey guys,
I need to add some kind of archiving functionality to a Objective-C Trie implementation (NDTrie on github), but I have very little experience with C and it's data structures.
struct trieNode
{
NSUInteger key;
NSUInteger count,
size;
id object;
__strong struct trieNode ** children;
__strong struct trieNode * parent;
};
@interface NDTrie (Private)
- (struct trieNode*)root;
@end
What I need is to create an NSData
with the tree structure from that root - or serialize/deserialize the whole tree some other way (conforming to NSCoding
?), but I have no clue how to work with NSData
and a C struct containing pointers.
Performance on deserializing the resulting object would be crucial, as this is an iPhone project and I will need to load it in the background every time the app starts.
What would be the best way to achieve this?
Thanks!