Boost logo

Boost :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-10-10 01:19:48


LOL - I'm amazed that I don't know the answer to this question off hand.

After some reflection I think the answer is the following( for loading)

Take for example text_iarchive.

It inherits from basic_text_iprimitive.hpp (for input of prmitive types) and
it inherits from basic_text_iarchive for all other types.

basic_text_iprimitives contains load functions for all prmitive types.
basic_iarchive.hpp contains load_override functions for all "special" types
not handled by iserializer.hpp.
interface_iarchive contains the interface described in the manual under
Loading Archive Concept and direct calls the the interface to the most
derived class of the implementation.

The chain of calls for ar >> x where x is a non-primitive type will be:
interface_iarchive::operator>>
-> text_iarchive::load_override
-> basic_text_iarchive<Archive>::load_override(t, 0)
-> archive::load(* this->This(), t); // in iserializer.hpp
...

The chain of calls for ar >> i where i is a primititve data type will be:

interface_iarchive::operator>>
-> text_iarchive::load_override
-> basic_text_iarchive<Archive>::load_override(t, 0)
-> archive::load(* this->This(), t); // in iserializer.hpp
-> load_non_pointer
->load_primitive
->ar.load(...) // back to archive to load primitive
->text_iarchive::load
->basic_text_iprimitive::load if not overridden

So load is overridden for primitives while load_override is used for others.

Now looking at this, it seems that this could be made shorter, more
efficient and more transparent not to mention better explain in the Archive
Implementation section of the documents. Maybe we'll do that when we have
nothing else to do.

Robert Ramey


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk