Boost logo

Boost Users :

From: Pfligersdorffer, Christian (Christian.Pfligersdorffer_at_[hidden])
Date: 2007-01-15 11:26:45


Hi Miguel,

you can find what you seek in the documentation under Reference, Serializable Concept, Pointers, Pointers to Objects of Derived Classes.

Two possibilities:
* eiter call ar.register_class<A>()
* or use the macro BOOST_CLASS_EXPORT(A)

Have fun,

Christian Pfligersdorffer
Software Engineering EOS GmbH

> -----Ursprüngliche Nachricht-----
> Von: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]]Im Auftrag von Miguel
> Silvestre
> Gesendet: Montag, 15. Januar 2007 16:30
> An: boost-users_at_[hidden]
> Betreff: Re: [Boost-users] Deriving Serialization classes
>
>
> Anyone???
>
> In the boost code I found this comment:
>
> // note:if this exception is thrown, be sure that derived pointer
> // is either regsitered or exported.
>
> How can I register a class????????
>
> On 1/15/07, Miguel Silvestre <msilvestre_at_[hidden]> wrote:
> > Just make the test without a pointer ant it works just fine.
> >
> > I've looked at the documentation and it only refers to this
> problem on
> > derivated classes! But I'm not deriving any class. I'm just
> including
> > the ponter of a class :(
> >
> > On 1/15/07, Miguel Silvestre <msilvestre_at_[hidden]> wrote:
> > > Ok!!!
> > >
> > > Now I'm getting unregistered_class exceptions when trying
> to seryalize
> > > a class that has another class. Like:
> > >
> > > class C : public Serializer
> > > {
> > > typedef Serializer Parent;
> > > public:
> > > std::string text;
> > > A* m_owner;
> > > int32 dasse;
> > > C():m_owner(0)
> > > {
> > > text = "Ola sua puta rabeta!";
> > > dasse = 69;
> > > }
> > >
> > > void Serialize(IArchive& ar, const unsigned int version)
> > > {
> > > ar.Serialize(dasse);
> > > ar.Serialize(text);
> > > //ar.Serialize(m_owner);
> > > }
> > > };
> > >
> > > class A : public Serializer
> > > {
> > > typedef Serializer Parent;
> > > public:
> > >
> > > void Serialize(IArchive& ar, const unsigned int version)
> > > {
> > > ar.Serialize(dumbi);
> > > ar.Serialize(vectorTest);
> > > ar.Serialize(matrix);
> > > ar.Serialize(testing);
> > > ar.Serialize((void*)test_void, sizeof(Vector3f));
> > > }
> > >
> > > int dumbi;
> > > float dumbf;
> > > Vector2f vectorTest;
> > > Matrix33 matrix;
> > > C* testing;
> > > Vector3f* test_void;
> > >
> > > A():dumbi(12), dumbf(69.69f)
> > > {
> > > testing = new C();
> > > testing->m_owner = this;
> > > matrix.SetIdentity();
> > > test_void = new Vector3f(1,2,3);
> > > }
> > >
> > > A(int dumb1, float dumb2) : dumbi(dumb1), dumbf(dumb2)
> > > {
> > > testing = new C();
> > > testing->m_owner = this;
> > > matrix.SetIdentity();
> > > test_void = new Vector3f(1,2,3);
> > > }
> > > };
> > >
> > > If I comment the line that serializes C object from A
> > > (ar.Serialize(testing);) everything works fine.
> > > I can serialize Object A. And I can serialiaze the Object
> C to. But
> > > when I have apoibter to C on object A It throws the
> unregistered_class
> > > exception?
> > >
> > > Why?
> > >
> > > How can I avoid this???
> > > On 1/12/07, Robert Ramey <ramey_at_[hidden]> wrote:
> > > > Use binary_object.
> > > >
> > > > Robert Ramey
> > > >
> > > >
> > > >
> > > > _______________________________________________
> > > > Boost-users mailing list
> > > > Boost-users_at_[hidden]
> > > > http://lists.boost.org/mailman/listinfo.cgi/boost-users
> > > >
> > >
> > >
> > > --
> > > Miguel Silvestre
> > >
> >
> >
> > --
> > Miguel Silvestre
> >
>
>
> --
> Miguel Silvestre
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>


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