|
Boost : |
From: Kim Barrett (kab_at_[hidden])
Date: 2005-07-26 09:55:04
At 2:12 PM -0700 7/25/05, Robert Ramey wrote:
>Truth is that I never considered the overhead in archive creation because
>the usage in marshalling is less common that for persistence. I wouldn't
>mess with it without real data that it would make a significant difference.
Entirely reasonable.
>Now that you have provided such data, I'll consider it. It doesn't seem
>that it would be all that hard to do. Feel free to experiment with thi sa
>little more.
Most of the work in my experimental reset function involved studying the
class hierarchy; the actual coding time was pretty minimal. Since the
changes are small, I've appended them (made to some cvs version of boost
from a couple weeks ago) to the end of this message. As I said previously,
I'm not convinced this is quite the right interface, so feel free to not
lock in on exactly this.
I'll be on vacation starting the end of this week; when I return I'll be
upgrading us to Boost 1.33 (presumably :) and then going back to work
on serialization-related stuff. I'll be happy to work with you on this in
whatever way will prove useful.
>I presume with your changes, you've found the serialization libary suitable
>for your application?
I think so. I still have some things to look at, including code size, which
I haven't really looked at yet. It might be that this is either just not a
problem (some of our requirements haven't been nailed down yet), or
addressable by coding patterns that ensure we aren't picking up multiple
copies of (inlined) things unnecessarily.
And I sure hope this works out, as it will save me a lot of work! We have
an existing marshalling facility that we long ago decided needed some
additional features. Using Boost.Serialization would give us every feature
we've ever discussed, plus some bonus features that we hadn't realized we
wanted or needed.
----- boost/archive/detail/basic_iarchive.hpp
// in the definition of class basic_iarchive, add
void reset();
----- boost/archive/detail/basic_oarchive.hpp
// in the definition of class basic_oarchive, add
void reset();
----- libs/serialization/src/basic_iarchive.cpp -----
// in the definition of class basic_iarchive_impl, add
void reset();
// add this definition
inline void basic_iarchive_impl::reset() {
object_id_vector.clear();
moveable_object_stack.clear();
moveable_object_position = 0;
cobject_info_set.clear();
cobject_id_vector.clear();
created_pointers.clear();
pending_object = NULL;
pending_bis = NULL;
pending_version = 0;
}
// add this definition
BOOST_ARCHIVE_DECL(void)
basic_iarchive::reset() {
pimpl->reset();
}
----- libs/serialization/src/basic_oarchive.cpp -----
// in the definition of class basic_oarchive_impl, add
void reset();
// add this definition
inline void basic_oarchive_impl::reset() {
object_set.clear();
cobject_info_set.clear();
stored_pointers.clear();
pending_object = NULL;
pending_bos = NULL;
}
// add this definition
BOOST_ARCHIVE_DECL(void)
basic_oarchive::reset() {
pimpl->reset();
}
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk