[Serialization]Working without RTTI

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Serialization]Working without RTTI

Alexandre Gacon
Hi,
 
I would like to use the serialization library inside one of my project which
do not use the RTTI. I produce a first version using
boost::serialization::extended_type_info to produce the key associated to
the class.
 
Is it possible to use my own keys instead of the extended_type_info class to
serialize my classes ?

Thank you,

Alexandre Gacon
Project Manager

_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Serialization]Working without RTTI

Robert Ramey
I've included that facility and a test which demonstrates it.

test_no_rtti demonstrates how it can be used with a
type_info facility which uses the string associated with the
type via BOOST_CLASS_EXPORT.

Other than that it hasn't been really tested/explored extensively.

After doing all this, it occurred to me that it RTTI would still
be required to serialize the std::vector etc.  This could be
worked around by some combination of the above

a) implemented BOOST_CLASS_EXPORT for those
serializations in the library

b) making a custom extended_type_info class which uses some
other yet to be determined method.

c) avoiding serialization of types not exported via pointers.  That
is, only types serialized via pointers required RTTI. (at least
that's the intention - better test this!!)

Robert Ramey


Alexandre Gacon wrote:

> Hi,
>
> I would like to use the serialization library inside one of my
> project which do not use the RTTI. I produce a first version using
> boost::serialization::extended_type_info to produce the key
> associated to the class.
>
> Is it possible to use my own keys instead of the extended_type_info
> class to serialize my classes ?
>
> Thank you,
>
> Alexandre Gacon
> Project Manager



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Serialization]Working without RTTI

Alexandre Gacon
I looked at the test_no_rtti.cpp and I have a question:

In the cpp file, the macro BOOST_CLASS_TYPE_INFO is used like this:

BOOST_CLASS_TYPE_INFO(
    derived_base,
    extended_type_info_no_rtti<derived_base>
)

But in the documentation, the macro is used like that:

BOOST_CLASS_TYPE_INFO(
    derived_base,
    extended_type_info_no_rtti<base_class>
)

What is the good use of the macro ?

Thank you

Alexandre Gacon

-----Message d'origine-----
De : [hidden email]
[mailto:[hidden email]] De la part de Robert Ramey
Envoyé : jeudi 9 février 2006 16:17
À : [hidden email]
Objet : Re: [Boost-users] [Serialization]Working without RTTI

I've included that facility and a test which demonstrates it.

test_no_rtti demonstrates how it can be used with a type_info facility which
uses the string associated with the type via BOOST_CLASS_EXPORT.

Other than that it hasn't been really tested/explored extensively.

After doing all this, it occurred to me that it RTTI would still be required
to serialize the std::vector etc.  This could be worked around by some
combination of the above

a) implemented BOOST_CLASS_EXPORT for those serializations in the library

b) making a custom extended_type_info class which uses some other yet to be
determined method.

c) avoiding serialization of types not exported via pointers.  That is, only
types serialized via pointers required RTTI. (at least that's the intention
- better test this!!)

Robert Ramey


Alexandre Gacon wrote:

> Hi,
>
> I would like to use the serialization library inside one of my project
> which do not use the RTTI. I produce a first version using
> boost::serialization::extended_type_info to produce the key associated
> to the class.
>
> Is it possible to use my own keys instead of the extended_type_info
> class to serialize my classes ?
>
> Thank you,
>
> Alexandre Gacon
> Project Manager



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Serialization]Working without RTTI

RIVASSEAU Jean Noel
In reply to this post by Alexandre Gacon
I already pointed this out to Robert, the correct use is on the cpp file, not the documentation.

I am  also using no RTTI, for me it works fine except that I have to do all sort of strange things to get the thing to link correctly without multiple definitions.

Jean-Noël

-----Message d'origine-----
De : [hidden email] [mailto:[hidden email]] De la part de Alexandre Gacon
Envoyé : vendredi 10 février 2006 10:11
À : [hidden email]
Objet : Re: [Boost-users] [Serialization]Working without RTTI

I looked at the test_no_rtti.cpp and I have a question:

In the cpp file, the macro BOOST_CLASS_TYPE_INFO is used like this:

BOOST_CLASS_TYPE_INFO(
    derived_base,
    extended_type_info_no_rtti<derived_base>
)

But in the documentation, the macro is used like that:

BOOST_CLASS_TYPE_INFO(
    derived_base,
    extended_type_info_no_rtti<base_class>
)

What is the good use of the macro ?

Thank you

Alexandre Gacon

-----Message d'origine-----
De : [hidden email]
[mailto:[hidden email]] De la part de Robert Ramey
Envoyé : jeudi 9 février 2006 16:17
À : [hidden email]
Objet : Re: [Boost-users] [Serialization]Working without RTTI

I've included that facility and a test which demonstrates it.

test_no_rtti demonstrates how it can be used with a type_info facility which
uses the string associated with the type via BOOST_CLASS_EXPORT.

Other than that it hasn't been really tested/explored extensively.

After doing all this, it occurred to me that it RTTI would still be required
to serialize the std::vector etc.  This could be worked around by some
combination of the above

a) implemented BOOST_CLASS_EXPORT for those serializations in the library

b) making a custom extended_type_info class which uses some other yet to be
determined method.

c) avoiding serialization of types not exported via pointers.  That is, only
types serialized via pointers required RTTI. (at least that's the intention
- better test this!!)

Robert Ramey


Alexandre Gacon wrote:

> Hi,
>
> I would like to use the serialization library inside one of my project
> which do not use the RTTI. I produce a first version using
> boost::serialization::extended_type_info to produce the key associated
> to the class.
>
> Is it possible to use my own keys instead of the extended_type_info
> class to serialize my classes ?
>
> Thank you,
>
> Alexandre Gacon
> Project Manager



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users



_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [Serialization]Working without RTTI

Robert Ramey
RIVASSEAU Jean Noel wrote:
> I already pointed this out to Robert, the correct use is on the cpp
> file, not the documentation.
>
> I am  also using no RTTI, for me it works fine

Well, I'm quite gratified that it works well.  I wrote the test but I never
felt that was a complete test of the concept of using one's own
custom type id system (extended_type_info_no_rtti in this case).

> except that I have to
> do all sort of strange things to get the thing to link correctly
> without multiple definitions.

Hmmm - I wouldn't think that this type of problem is
related to the extended_type_info system.  You should
track this down and find the real cause.  You might
take a look at demo pimpl which might (or not)
shed some light on this.

Robert Ramey





_______________________________________________
Boost-users mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-users