Re: encoding structs (NSCoder / NSArchiver issue)
Re: encoding structs (NSCoder / NSArchiver issue)
- Subject: Re: encoding structs (NSCoder / NSArchiver issue)
- From: Justin Anderson <email@hidden>
- Date: Mon, 19 Jan 2004 01:01:33 -0500
Those are of static size and don't contain pointers, so they should get
allocated in contiguous blocks. I *think* it's just a matter of typing
[NSData dataWithBytes:aPlaneStruct length:sizeof(planeStruct)] for each
planeStruct.
And if your array of structs isn't malloc'd in pieces, you could grab
each array at once instead of individually.
What I'm really curious about is a good way to store binary tree
structs...
- Justin
On Jan 18, 2004, at 11:50 PM, Aaron Boothello wrote:
Im kinda foreign to the concept of NSCoder and NSArchiver/Unarchiver,
so please bear with me.
Ive managed to figure out how to save ints,floats,strings to a file
and load em up again.
But now, im trying to save an array of objects, each of which are made
up of an array of structs.
The structs are declared as follows:
struct pointStruct //POINTSTRUCT
{
float vertices[3]; //x,y,z coordinates
float offset[3]; //x,y,z offset
float scale[3]; //x,y,z scale
float angle[3]; //x,y,z angle
BOOL selectedPoint; //selected flag
};
struct planeStruct //PLANESTRUCT
{
struct pointStruct points[MAXPOINTS+1]; //pointStruct
array
int pointCounter; //number of point in current plane
float offset[3]; //x,y,z offset
float scale[3]; //x,y,z scale
float angle[3]; //x,y,z angle
};
each of my objects is made up of an array of "planeStruct"....so how
do i save the object out to a file, and load it back in when i need to
?
Thanks,
Aaron.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.