|
Boost Users : |
Subject: Re: [Boost-users] [Boost.Serialization] Serializing "abstract" classes
From: Júlio Hoffimann (julio.hoffimann_at_[hidden])
Date: 2011-08-05 15:01:01
Just correcting another mistake mine, the warning is not on line 40 as i
said. It's in export.hpp 134:40.
Do you have any hint Robert? What could i do to fix this? I heard
Boost.Serialization changed dramatically from 1.45 to actual versions. I
just don't want to upgrade right now because i'm the middle of another job.
Regards,
Júlio.
2011/8/5 Júlio Hoffimann <julio.hoffimann_at_[hidden]>
> Thank you for reply Robert,
>
> Yes, i've compiled the code using GCC 4.5. Now i see the warning you
> mentioned:
>
> warning:40: type qualifiers ignored on function return type
>
> I've used BOOST_SERIALIZATION_ASSUME_ABSTRACT because the library
> documentation is a little confusing with the "abstract class" term. But note
> that even commenting out the macro, the problem remains. What is the warning
> about on line 40? I'm missing something trivial? :-)
>
> I've also tried to misplace the BOOST_EXPORT_CLASS macro among the source
> lines, but without success. Do you have any hint in what is happening?
>
> Appreciate your help,
> Júlio.
>
> 2011/8/5 Robert Ramey <ramey_at_[hidden]>
>
>> **
>> Júlio Hoffimann wrote:
>> > Dear all,
>> >
>> >
>> > I'm using Boost 1.45...
>> >
>> >
>> > I've read Boost.Serialization docs so many times and can't understand
>> > why my testcase is not working as expected. According to the
>> > following three links, we need to address serialization of derived
>> > classes with "abstract" base class by using boost macros:
>> >
>> >
>> >
>> http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/traits.html#export
>> >
>> >
>> >
>> http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/special.html#export
>> >
>> >
>> >
>> http://www.boost.org/doc/libs/1_47_0/libs/serialization/doc/traits.html#abstract
>> >
>> >
>> > I did my testcase ( http://codepad.org/6ETp1Ac0 ) completely based on
>> > the demo:
>> >
>> http://www.boost.org/doc/libs/1_47_0/libs/serialization/example/demo.cpp
>>
>> Have you tried to build adn run the demo as it is? Does it work?
>>
>> Robert Ramey
>>
>> >
>> >
>> > Compiling and running shows that the derived class archive contains
>> > just the base class data members. What is happening? How can i solve
>> > this problem?
>>
>> One obvious problem is that the base class is not abstract. To be
>> abstract,
>> a base class must have atleast one virtual function in the form
>>
>> virtual my_function() = 0;
>>
>> The ASSUME_ABSTRACT macro doesn't mark it abstract to the
>> compiler - it marks it abstract to the boost type-traites system.
>> I know it's quirky and unclear - but I see no way to make it bullet proof.
>>
>> I'm sort of surprised/disappointed that this doesn't give a compile time
>> warning. What compiler do you use?
>>
>> Robert Ramey
>>
>>
>> >
>> >
>> > I really appreciate any help,
>> > Júlio.
>> >
>>
>> _______________________________________________
>> Boost-users mailing list
>> Boost-users_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>>
>
>
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