Boost logo

Boost Users :

From: Oliver Kania (kania.oliver_at_[hidden])
Date: 2007-11-08 10:02:53


Hello and thx
I guess that means I cannot change class state in my save method.
That is what I need ! Is there any way around it ?

regards, Oliver

On Nov 8, 2007 3:47 PM, Oliver Mutz <omutz_at_[hidden]> wrote:

> Hello Oliver,
>
> Your save method has to be const.
>
> Regards
>
> Oliver
>
> ________________________________
>
> Von: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] Im Auftrag von Oliver Kania
> Gesendet: Donnerstag, 8. November 2007 15:16
> An: boost-users
> Betreff: [Boost-users] [Boost Users] Serialization: problems when
> splittingserialize into load / save
>
>
> Hello out there !
> I have an urgent problem concerning boost::serialize.
> I have split the serialize operation into save / load as described
> in the tutorial:
> ===================================================
> template<class Archive>
> void save( Archive &ar, unsigned int version) {
> m_offlineMode = true;
> // we cannot load more when offline --> always cachedAll
> bool oldCachedAll = m_CachedAll;
> m_CachedAll = true;
> ar & m_CachedAll;
> ar & m_offlineMode;
> // do not serialize the lock -- use the default
> constructor.
> // we assume that no iterators that lock the cache do exist
> when serializing.
> // ar & m_Lock;
> ar & m_LookupId;
> ar & m_LookupName;
> ar & m_SequenceNumber;
> //reset old state for the case we want to continue working
> m_CachedAll = oldCachedAll;
> m_offlineMode = false;
> }
>
> template<class Archive>
> void load( Archive &ar, unsigned int version) {
>
> ar & m_CachedAll;
> ar & m_offlineMode;
> // do not serialize the lock -- use the default
> constructor.
> // we assume that no iterators that lock the cache do exist
> when serializing.
> // ar & m_Lock;
> ar & m_LookupId;
> ar & m_LookupName;
> ar & m_SequenceNumber;
> //reset old state for the case we want to continue working
> }
> BOOST_SERIALIZATION_SPLIT_MEMBER()
> ===============================================================
>
> The class I serialize is part of a deep class hierarchy that I want to
> serialize as a whole.
> With the standard serialize() it seems to work, but now the compiler
> complains
> ( when I
> want to perform the actual serialization):
>
> error C2662: 'void
> jedox::palo::AbstractCache<C,Exception>::save<Archive>(Archive &,unsigned
> int)' :
> cannot convert 'this' pointer from 'const
> jedox::palo::AbstractCache<C,Exception>' to
> 'jedox::palo::AbstractCache<C,Exception> &'
>
> AbstractCache is the class containing the above load / save operations
>
> kind regards,
> Oliver
>
>
>
> _______________________________________________
> 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