[Soc-2013-dev] Soc-2013-dev Digest, Vol 3, Issue 22

Peter Schlaile peter at schlaile.de
Sat Jul 20 13:39:38 CEST 2013


Hi Alex,

> == Questions ==
> What is the best way to store C++ class in DNA? Do I just include a 
> single structure into the class and then dump it to/from DNA?

simple answer: you don't.

The C++ code should only(!) be limited to the render engine and not
extend to the rest of the code (all the strip / DNA manipulation etc.).

These should be kept strictly in C.

Please consider the C++ part as a completely seperate unit which should

a) have a C API which is as thin as possible
b) most probably shouldn't have to touch DNA at all
c) use a memory allocator that uses Guarded Alloc internally

Take a look, how Joerg did it with audaspace: he build a completely
seperate C++ engine and wrote an additional C API for it.

Or take a look at the new compositor: the C++-code only uses small parts
of DNA *read only*. Most of the time, it's only using the same constants
and ignores the structures completely.

Holding to these principles will lead to cleaner code through a strict
module / problem seperation:

The render engine does exactly *one* thing and does that properly.

TL;DR: please *don't* write a C++ wrapper around DNA / DNA manipulation.
That's definitely nothing you should do (or anyone else will do in the
near future).

Regards,
Peter


-- 
Peter Schlaile <peter at schlaile.de>



More information about the Soc-2013-dev mailing list