 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
martin f. krafft Guest
|
Posted: Mon Feb 23, 2004 11:39 am Post subject: serialising class instances |
|
|
hi there,
i am about to implement serialisability on a complex class
hierarchy. my initial thought was to provide a 'serialisable'
abstract class with pure virtual functions serialise and
deserialise, but i run into the problem of multiple inheritance:
a class 'Neuron' inherits from a class 'positionable', which adds
Cartesian coordinates to the Neuron. Since positionable thus holds
data, it must be serialisable, yielding the following construct:
class positionable : public serialisable {
// ...
};
class Neuron : public positionable, public serialisable {
// ...
};
and this (rightfully) yields the following warning from gcc 3.3:
../include/neuralnet/neuron.h:27: warning: direct base
`serialisable' inaccessible in `Neuron' due to ambiguity
Of course I could simply do without the serialisable class and
implement the 'serialise' and 'deserialise' functions nonetheless in
each serialisable class, but that's highly unsatisfactory, if you
know what I mean.
Thus I'd be interested in hearing how you guys realise
serialisability in C++ class hierarchies?
One thought I had was to provide a Serialiser class and require
operator<< implementations for each class that is to be saved.
I guess this would be worth looking into...
--
martin; (greetings from the heart of the sun.)
____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck
invalid/expired pgp subkeys? use subkeys.pgp.net as keyserver!
always remember you're unique, just like everyone else.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
Pavel Vozenilek Guest
|
Posted: Tue Feb 24, 2004 1:33 pm Post subject: Re: serialising class instances |
|
|
"martin f. krafft" <comp.lang.c++.moderated (AT) usenet (DOT) madduck.net> wrote
| Quote: | Thus I'd be interested in hearing how you guys realise
serialisability in C++ class hierarchies?
Take look on Boost.Serialization library: |
http://www.rrsd.com/boost/index.htm
It may fit your needs.
/Pavel
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|