Boost logo

Boost Users :

Subject: Re: [Boost-users] Automating Serialization?
From: Brian Wood (woodbrian77_at_[hidden])
Date: 2009-11-27 02:38:21


Emil Dotchevski writes:

>On Thu, Nov 26, 2009 at 5:05 AM, Bilokon, Paul <paul.bilokon_at_[hidden]>
wrote:
>
>> The current approach requires some code duplication. We have to declare a
>> field. We have to manually (de)serialise it. If we need to make a change,
we
>> make it in at least two distinct places.
>
> You are thinking in terms of reflection. Think in terms of states and
> invariants and it'll make more sense. For example, if you have an
> array of items and a pointer, and your invariant is that the pointer
> always points the last element in the array, the pointer should not be
> serialized.
>

I don't know if that is a common situation, but there are two ways to
handle that with the C++ Middleware Writer. One as I mentioned
in another post is to turn off the automatic generation of marshalling
functions. The other is to place those fields which shouldn't be
included in the marshalling process within an #ifdef SERVER_SIDE
-- http://webEbenezer.net/ifdefSERVER.html .
The macro is turned on when servers are built and off when clients
are built. This approach enables servers to have a complete view of
a type and clients to have an accurate, but limited view of the same
type.

Regards,
Brian Wood
http://www.webEbenezer.net <http://www.webebenezer.net/>

"Then Samuel took a stone, and set it between Mizpeh and Shen,
and called the name of it Ebenezer, saying, so far the the L-RD has
helped us."



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