serialization library
Fredrik Olsson
peylow at gmail.com
Fri Nov 10 06:55:25 PST 2006
Bill Baxter wrote:
> Fredrik Olsson wrote:
>> Bill Baxter skrev:
>> <snip>
>
>>>
>> What you want is a lib for reading and writing EA IFF-85 compatible
>> files?
>
> I've never heard of EA IFF-85, but a brief skim of the description here:
> http://www.newtek.com/lightwave/developer/LW80/8lwsdk/docs/filefmts/eaiff85.html
>
> sounds good.
>
> Is it something 3D-graphics specific though? Electronic Arts created
> the standard, and the website I found above is for a 3D modeling
> package... But it looks right.
>
No it is not limited to any specific kind of files. EA made it as an
atempt to make a general file format structure for any use. Basically it
just takes care of bundling chunks, marking them as required of
optional. And byte-order-independence! IFF as such has been used for
images as in IFF, audio AIFF, 3D objects OBJ, and lots more.
When Microsoft created BMP and WAV they more or less ripped the EA IFF
rationale, but changed the required byte order.
EA IFF is a low level format. How to actually interpret the data that is
contained is up to each application.
> But the truth is I don't know what I want exactly in terms of API. I
> just want something that makes it easy to take my data structures ->
> extract the data into something generic and ESPECIALLY not intrinsically
> tied to the types in my program -> save it to disk -> load it back into
> whatever data structures I choose later. It's ok if it's a little more
> painful than MyData.serialize(archive); MyData.load(archive); as long
> as it achieves the goal.
>
> With Boost::serialization I've ended up having to write upgrader
> programs a few times over the course of development. It's always a pain
> because boost::serialization wants to be smart so what I end up doing is
> taking an old version of my data structures header file, wrapping it in
> an "oldversion" namespace then load via the olversion::type, and save
> via the newversion::type.
>
>> I actually have some code for D doing this around somewhere. Written
>> to be able to read IFF graphics files and Lightwave 3D objects.
>
> Oh, right, lightwave. So I guess it's not a coincidence google for EA
> IFF-85 turned up NewTek's page.
>
EA IFF 85 was a joint venture of Electronic Arts and Commodore, for
creating a universal file format for the Amiga. Lightwave 3D is an old
Amiga application, so them using IFF as a base is kind of natural.
>> I shall dig up the code, clean it up in a presentable shape, and make
>> it public.
>
> Cool, can you explain how the API works a little? I guess I can imagine
> that loading such a file is not so different from loading an XML file.
> So like XML parsing there are a few ways to do it.
>
IFF is not quite as flexible as XML, much more flat. So the API is very
simple.
My current implementation wraps over a Stream instance, and implement
simple methods as:
foo.seekNextChunk("CTAB");
auto bar = foo.readInt();
Etc, just for working with the basics, as defined by EA IFF 85. NewTek
the creators of Lightwave 3D have made some additions, that would be
nice to have as well.
But it was one of my first attempts at D, so I will rewrite it. Just how
is something I shall think about. Having the chunks as independent
instances over a seekable stream might be a good idea.
// Fredrik Olsson
>
> --bb
More information about the Digitalmars-d-announce
mailing list