Boost logo

Boost Users :

From: Miguel Silvestre (msilvestre_at_[hidden])
Date: 2007-01-15 06:56:07


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

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