|
Boost Users : |
From: sadrok (sadrok.za_at_[hidden])
Date: 2007-01-07 06:20:03
Thanks for replying.
On 1/7/07, Robert Ramey <ramey_at_[hidden]> wrote:
> A couple of observations:
>
> a) you might try using xml_?archives for debugging. The consume more space
> are
> are easier to interpret.
I've used xml_?archives now. The output looks satisfactory.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE boost_serialization>
<boost_serialization signature="serialization::archive" version="3">
<moduleName>core</moduleName>
<msg_type>LogMessage</msg_type>
<msg_id>-1210130444</msg_id>
<msg class_id="1" class_name="Sadrok::LogMessage" tracking_level="1"
version="0" object_id="_0">
<Message class_id="0" tracking_level="1" version="0" object_id="_1">
<test_>Just testing</test_>
</Message>
<logLevel>0</logLevel>
<logTime>1168162900</logTime>
<logMessage>Loaded module log from file modules/liblog.so pid
31525</logMessage>
</msg>
I notice that the XML is not completed, but this doesn't seem to be a problem.
>
> b) Could it be that you are doing something like:
>
> ar << lm ; // pointer to LogMessage
> ...
> ar >> m; // pointer to Message
>
I'm saving and loading using a pointer to Message.
>
> If this doesn't help, make a small test which just serializes and
> de-serializes
> and we can take a look at it.
>
I did a small test loading the resultant XML from a file. It uses code
copy & pasted from the program. The test works perfectly.
I would expect that if I did something obviously wrong I would've
gotten one of boost's exceptions (like unregistered_class) and I could
fix my error. I however don't know why bad_cast gets thrown.
For now I'll have to rip apart this program and try to reconstruct it
piece by piece in a test program until the error pops up again.
> Robert Ramey
>
> sadrok wrote:
>
> > My application saves message classes derived from a Message base class
> > (it has a virtual deconstructor) and sends this serialized data over a
> > UNIX socket for IPC between interconnected processes.
-- sadrok_at_[hidden] Yahoo! IM: sadrok_za Jabber ID: sadrok_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net