Re: Data Structure to Data
Re: Data Structure to Data
- Subject: Re: Data Structure to Data
- From: Ben Trumbull <email@hidden>
- Date: Fri, 18 Jan 2008 14:25:36 -0800
Bruce,
Directly encoding a struct is not going to have a happy ending. If
it's in process, you can pass a pointer or an NSValue created with
+valueWithPointer.
If you need a copy or to pass it to another process, you're going to
need to write some encode/decode function. In addition to the
semantic issue of a deep copy, structs have alignment and endian
issues.
Also, plist structures can effectively be toll free bridged.
<http://developer.apple.com/documentation/CoreFoundation/Conceptual/CFPropertyLists/CFPropertyLists.html>
For passing image data between a CLI and a user app, especially on
the same machine, you might try writing the image data to file, and
passing the path in the notification instead. The file system is
very efficient with larger sized blobs (> 128K) and pretty reasonable
down to 16-32K.
I'd wager that +dataWithContentsOfMappedFile: is faster than passing
a large block of image data via notifications.
--
-Ben
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden