Opened 16 years ago

Closed 16 years ago

#809 closed Support Requests (None)

Deriving Serialization classes

Reported by: gorogoro Owned by: Robert Ramey
Milestone: Component: None
Version: None Severity:
Keywords: Cc:

Description

Hello! 

I don't now why, but the mailing list is deniying my mails :S.

Isn't there an example on how to derive the text_oarchive_impl like the demo_fast_binary_archive.cpp?

And another for the XML archives?

Because I'm trying to derive it and I was sucessfull with the binary archives, but I'm getting troubles with the other ones :S.


 
a) But I'm deriving it from text_archive_imp
 
b) what? I didn't understand.. As I said the binary serialization is working fine
 
c) Onde again what do you mean?? How can I derivate the serialization classes??
 
 
I've tried the following code to, but with the same error:
 
class TextArchiveO : public IArchive,
 // don't derive from text_oarchive !!!
 public boost::archive::text_oarchive_impl<TextArchiveO>
{ 
public:
 TextArchiveO(std::ostream & os, unsigned flags = 0) : 
   boost::archive::text_oarchive_impl<TextArchiveO>(os, flags)
   {}

   ~TextArchiveO(){}

   virtual void Serialize(int& t) { *this & BOOST_SERIALIZATION_NVP(t); }
   virtual void Serialize(bool& t) { *this & BOOST_SERIALIZATION_NVP(t); }
};

class TextArchiveI : public IArchive,
 // don't derive from text_oarchive !!!
 public boost::archive::text_iarchive_impl<TextArchiveI>
{
 
public:
 TextArchiveI(std::istream & is, unsigned flags = 0) : 
   boost::archive::text_iarchive_impl<TextArchiveI>(is,flags)
   {}

   ~TextArchiveI(){}

   virtual void Serialize(int& t) { *this & BOOST_SERIALIZATION_NVP(t); }
   virtual void Serialize(bool& t) { *this & BOOST_SERIALIZATION_NVP(t); }
};




On 1/10/07, Robert Ramey <ramey@rrsd.com> wrote: 
- Hide quoted text -
a) try deriving from text_?archive_impl rather than IArray
b) If you're going to put your own archive in a separate file - make sure you find
a way to explicitly instantiat it.  See text_oarchive.cpp in the library.
c) I wouldn't recommend using the HEAD branch for "real" code since
this is altered from time to time.  
 
Robert Ramey
 
 


_______________________________________________
Boost-users mailing list 
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users

Change History (3)

comment:1 by Robert Ramey, 16 years ago

Logged In: YES 
user_id=396141
Originator: NO

usage question dealt with on boost user mailing list

comment:2 by Robert Ramey, 16 years ago

Logged In: YES 
user_id=396141
Originator: NO

Thank you for submitting a Boost tech support request. <BR>*** 
At this time, tech support requests to this SourceForge tracker 
are monitored at best sporadically. A more reliable way to get 
answers is to post to the boost mailing list at <a 
href="http://groups.yahoo.com/group/boost">http://groups.yahoo.co
m/group/boost</a>. Although the maintainers of Boost libraries 
try to respond to questions in a timely fashion, we offer no 
guarantee of service, express or implied. ***

comment:3 by Robert Ramey, 16 years ago

Status: assignedclosed
Note: See TracTickets for help on using tickets.