|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2004-10-25 15:54:02
"Hubert Holin" <Hubert.Holin_at_[hidden]> wrote in message
news:Hubert.Holin-89E7B0.14253525102004_at_sea.gmane.org...
> It is not immediately clear if [serialize] can do that in any way
> which is simpler to implement than what I already do for these classes
> (i.e. it would likely be as disgusting and unmaintainable, however
> necessary).
I don't think there is any factual support for that statement.
As a counter example, The following code includes implementation of
serialization for the quaternion class template (17 lines of code) and a
test of its serialization. I only spent an hour on it ( most of which was
perusing the quaternion docs and code so it might benefit from more effort
and testing than I am in a position to invest. But I would hope that it
does illustrate how easy it is to serialize what might seem to be an
otherwise complex type. I would hope it also will help to refute the
perception that the serialization library is "too big". I don't believe
that serialization adds any more code (source and/or object) to an project
than any comparable alternative method.
For example, the i/o code built into the the quaternion class contains 329
lines of templated code. And, it doesn't include any facilities that come
for free with serialization libary such as the ability to create archives of
different types included XML, binary etc. It is also pure template code
that doesn't factor out commonality into a separart module so I would expect
to to be more "too big" than the equivalent of the serializaition library.
Robert Ramey
begin 666 test_quaternion.cpp
M+R\O+R\O+R\O,2\O+R\O+R\O+S(O+R\O+R\O+R\S+R\O+R\O+R\O-"\O+R\O
M+R\O+S4O+R\O+R\O+R\V+R\O+R\O+R\O-R\O+R\O+R\O+S_at_-"B\O('1E<W1?
M<75A=&5R;FEO;BYC<' -"@T*+R\@*$,I($-O<'ER:6=H=" R,# R(%)O8F5R
M="!286UE>2 M(&AT=' Z+R]W=W<N<G)S9"YC;VT@+B -"B\O(%5S92P@;6]D
M:69I8V%T:6]N(&%N9"!D:7-T<FEB=71I;VX@:7,@<W5B:F5C="!T;R!T:&4@
M0F]O<W0_at_4V]F='=A<F4-"B\O($QI8V5N<V4L(%9E<G-I;VX@,2XP+B H4V5E
M(&%C8V]M<&%N>6EN9R!F:6QE($Q)0T5.4T5?,5\P+G1X="!O<B!C;W!Y(&%T
M#0HO+R!H='1P.B\O=W=W+F)O;W-T+F]R9R],24-%3E-%7S%?,"YT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HZ8F]O<W0Z.FUA=&@Z.G%U871E<FYI;VX\9&]U8FQE/B @(" @("!Q
M,3$H,2PR+#,L-"D[#0H@(" @>PT*(" @(" @("!T97-T7VES=')E86T@:7,H
M=&5S=&9I;&4L(%1%4U1?4U1214%-7T9,04=3*3L-"B @(" @(" @=&5S=%]I
M87)C:&EV92!I82AI<RD[#0H@(" @(" @(&EA(#X^($)/3U-47U-%4DE!3$E:
M051)3TY?3E90*'$P,2D[#0H@(" @(" @(&EA(#X^($)/3U-47U-%4DE!3$E:
M051)3TY?3E90*'%A,2D[#0H@(" @(" @(&EA(#X^($)/3U-47U-%4DE!3$E:
M051)3TY?3E90*'$Q,2D[#0H@(" @?0T*(" @('-T9#HZ<F5M;W9E*'1E<W1F
M:6QE*3L-"@T*(" @($)/3U-47T-(14-+*'$P(#T]('$P,2D[#0H@(" @0D]/
M4U1?0TA%0TLH<6%;,%T@/3T@<6$Q6S!=*3L-"B @("!"3T]35%]#2$5#2RAQ
M85LQ72 ]/2!Q83%;,5TI.PT*(" @($)/3U-47T-(14-+*'$Q(#T]('$Q,2D[
H#0H-"B @("!R971U<FX_at_8F]O<W0Z.F5X:71?<W5C8V5S<SL-"GT-"@``
`
end
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk