$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Robert Ramey (ramey_at_[hidden])
Date: 2004-05-13 13:17:03
Martin Ecker wrote:
> One way of achieving all this would, of course, be to derive from one of
> the existing archive classes and add the required functionality.
> However, we don't want to lose the flexibility of being able to write
> out data to a binary, text, XML, or any other archive with some other
> kind of representation. So basically we're looking for a good way of
> inserting an additional layer in between the archives and the actual
> serialize functions that can store state variables.
>
Have you consider making a template which takes the base class as a
parameter? Example
template <class BaseArchive>
class stately_iarchive : public BaseArchive
{
... // your overloads here
... // you extra control functions here
};
To be used thusly:
// can't use typedef because it typedef does like self-reference
class stately_binary_archive :
public stately_archive<binary_iarchive_impl<stately_binary_archive>
{
stately_binary_archive(istream &is, flags = 0) :
stately_archive<binary_iarchive_impl<stately_binary_archive>(is,
flags);
};
Now just use stately_binary_archive anywhere you used binary_archive before.
Robert Ramey