[serialization] save/load split between 2 different classes
I've got a particular issue I cannot seem to find a solution to. I'm using boost.serialization to deserialize audio data into an object that wraps OpenAL. For example, the data I'm writing out would be (in order) a single INT representing the size of the raw data and then the data buffer after that. However, in my "Sound" object, I do not keep the data and length information as state in the class. Instead, I just keep the OpenAL buffer handle. In order for this class to be able to implement save(), it would need to have extra state, which would not be appropriate. Basically, I need to have a separate object dedicated to saving the sound data, and another for loading it. Is this possible? Perhaps there is a recommended design?
Though it's hard to tell from you're description, you might want to take
a look at Reference>Serializable Concept->Serialization
Wrappers->BinaryObject
basically this is a "wrapper" which temporarily adds required information
for serialization to otherwise opaque buffers.
Robert Ramey
"Robert Dailey"
I'll have a look at that, thanks Robert.
Off-topic question, but when I create free-standing save/load functions for
a class, how can I get access to that class's privates? I'm currently doing
"friend class access", but this doesn't seem to be enough.
On Fri, Apr 10, 2009 at 1:36 AM, Robert Ramey
Though it's hard to tell from you're description, you might want to take a look at Reference>Serializable Concept->Serialization Wrappers->BinaryObject
basically this is a "wrapper" which temporarily adds required information for serialization to otherwise opaque buffers.
Robert Ramey
"Robert Dailey"
wrote in message news:496954360904092221x5ba5554fyb181286bf760e7a@mail.gmail.com... I've got a particular issue I cannot seem to find a solution to. I'm using boost.serialization to deserialize audio data into an object that wraps OpenAL. For example, the data I'm writing out would be (in order) a single INT representing the size of the raw data and then the data buffer after that. However, in my "Sound" object, I do not keep the data and length information as state in the class. Instead, I just keep the OpenAL buffer handle. In order for this class to be able to implement save(), it would need to have extra state, which would not be appropriate. Basically, I need to have a separate object dedicated to saving the sound data, and another for loading it.
Is this possible? Perhaps there is a recommended design?
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
"Robert Dailey"
On Fri, Apr 10, 2009 at 2:55 AM, Robert Ramey
"Robert Dailey"
wrote in message news:496954360904092306h8d62a84rf73a8bf110294dd3@mail.gmail.com... I'll have a look at that, thanks Robert. Off-topic question, but when I create free-standing save/load functions for a class, how can I get access to that class's privates?
LOL
I said it that way just for you :)
I'm currently doing "friend class access", but this doesn't seem to be enough.
Hmmm - friend class boost::serialization::access doesn't do it?
Apparently not, however I could be just doing it wrong. I'm not at my work computer at the moment and I won't be for a couple of days, but when I do get back to it I'll post you a code snippet so you can verify everything is structurally sound. Keep an eye out. Thanks for the help.
participants (2)
-
Robert Dailey
-
Robert Ramey