Howdy folks,
I have an effect plugin that needs to store persistent data. I've read all the forum threads I could find discussing flattening/unflattening data, the SDK sections discussing this, as well as many external sites discussing serializing data. I've got a few questions, they aren't explicitly SDK related, so sorry in advance if this ends up being a bit broad.
It seems to me, that flattening data is essentially the same task as serializing data. I'm using STL vectors to store data while my effect is doing its thing. Obviously these cannot be stored/flattened due to their internal structure and use of pointers. My current plan is to convert my data struct to JSON text, reserve a handle of proper size for the JSON, and memcopy the JSON data into the reserved memory space.
I'm sure there will be a performance hit when converting my data struct to JSON (and vice versa) but I found a terrific little JSON library that handles most of the work for me.
Is this a terrible idea?
I've read that Boost has a good serialization library, have people used it for the task of flattening/unflattening data in effects plugins?
Finally, my really stupid question:
In the SDK example of flattening data, they show an example where the sequence data struct contains a char pointer. When they flatten the data, they use a different struct that has replaced the char pointer with a char array of a fixed size. If I wanted to do something similar, how would one actually go about doing this when a portion of the struct has an arbitrary size (IE: the number of elements in my vector changes depending upon user settings, its parent layer, and other factors). It seems to me that you have to do all the legwork of serializing data to accomplish this task (unless you set the fixed size of the flattened data array to be bigger than any user will ever need, which sounds like a bug/error waiting to happen).
thanks!
-Andy