Re: [Boost-users] Deriving Serialization classes
????
a) But I'm deriving it from text_archive_imp
b) what? I didn't understand.. As I said the binary serialization is
working fine
c) Onde again what do you mean?? How can I derivate the serialization classes??
I've tried the following code to, but with the same error:
class TextArchiveO : public IArchive,
// don't derive from text_oarchive !!!
public boost::archive::text_oarchive_impl<TextArchiveO>
{
public:
TextArchiveO(std::ostream & os, unsigned flags = 0) :
boost::archive::text_oarchive_impl<TextArchiveO>(os, flags)
{}
~TextArchiveO(){}
virtual void Serialize(int& t) { *this & BOOST_SERIALIZATION_NVP(t); }
virtual void Serialize(bool& t) { *this & BOOST_SERIALIZATION_NVP(t); }
};
class TextArchiveI : public IArchive,
// don't derive from text_oarchive !!!
public boost::archive::text_iarchive_impl<TextArchiveI>
{
public:
TextArchiveI(std::istream & is, unsigned flags = 0) :
boost::archive::text_iarchive_impl<TextArchiveI>(is,flags)
{}
~TextArchiveI(){}
virtual void Serialize(int& t) { *this & BOOST_SERIALIZATION_NVP(t); }
virtual void Serialize(bool& t) { *this & BOOST_SERIALIZATION_NVP(t); }
};
On 1/10/07, Robert Ramey
a) try deriving from text_?archive_impl rather than IArray b) If you're going to put your own archive in a separate file - make sure you find a way to explicitly instantiat it. See text_oarchive.cpp in the library. c) I wouldn't recommend using the HEAD branch for "real" code since this is altered from time to time.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre -- Miguel Silvestre
On 11 Jan 2007, at 12:58, Miguel Silvestre wrote:
????
I've tried the following code to, but with the same error:
... Did you follow this advive of Robert?
On 1/10/07, Robert Ramey
wrote: b) If you're going to put your own archive in a separate file - make sure you find a way to explicitly instantiat it. See text_oarchive.cpp in the library.
Miguel Silvestre wrote:
a) But I'm deriving it from text_archive_imp
Sorry, I didn't see that - the IArchive threw me for a loop. Look for the explicit instantiation at the bottom of text_oarchive.cpp. Include something similar in your own code. Robert Ramey
Hummm.. good point.
But now I'm getting these compilation errors:
IT says that the functions template are already defined :S.
I wonder where.....
d:\flow project\flowengine\3rdparty\include\boost\archive\impl\basic_text_oarchive.ipp(48)
: error C2995: 'void
boost::archive::basic_text_oarchive<Archive>::newtoken(void)' :
function template has already been defined
d:\flow
project\flowengine\3rdparty\include\boost\archive\basic_text_oarchive.hpp(72)
: see declaration of
'boost::archive::basic_text_oarchive<Archive>::newtoken'
d:\flow project\flowengine\3rdparty\include\boost\archive\impl\basic_text_oarchive.ipp(59)
: error C2995: 'void
boost::archive::basic_text_oarchive<Archive>::init(void)' : function
template has already been defined
d:\flow
project\flowengine\3rdparty\include\boost\archive\basic_text_oarchive.hpp(103)
: see declaration of
'boost::archive::basic_text_oarchive<Archive>::init'
d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(26)
: error C2995: 'boost::archive::detail::basic_serializer_map
*boost::archive::detail::oserializer_map(void)' : function template
has already been defined
d:\flow
project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(22)
: see declaration of 'boost::archive::detail::oserializer_map'
d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(38)
: error C2995: 'boost::archive::detail::archive_pointer_oserializer<Archive>::archive_pointer_oserializer(const
boost::serialization::extended_type_info &)' : function template has
already been defined
d:\flow
project\flowengine\3rdparty\include\boost\archive\detail\archive_pointer_oserializer.hpp(40)
: see declaration of
'boost::archive::detail::archive_pointer_oserializer<Archive>::archive_pointer_oserializer'
d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(48)
: error C2995: 'const
boost::archive::detail::basic_pointer_oserializer
*boost::archive::detail::archive_pointer_oserializer<Archive>::find(const
boost::serialization::extended_type_info &)' : function template has
already been defined
d:\flow
project\flowengine\3rdparty\include\boost\archive\detail\archive_pointer_oserializer.hpp(56)
: see declaration of
'boost::archive::detail::archive_pointer_oserializer<Archive>::find'
d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(59)
: error C2995: 'boost::archive::detail::archive_pointer_oserializer<Archive>::~archive_pointer_oserializer(void)'
: function template has already been defined
d:\flow
project\flowengine\3rdparty\include\boost\archive\detail\archive_pointer_oserializer.hpp(48)
: see declaration of
'boost::archive::detail::archive_pointer_oserializer<Archive>::~archive_pointer_oserializer'
On 1/11/07, Robert Ramey
Miguel Silvestre wrote:
a) But I'm deriving it from text_archive_imp
Sorry, I didn't see that - the IArchive threw me for a loop.
Look for the explicit instantiation at the bottom of text_oarchive.cpp. Include something similar in your own code.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre
Here is my cpp file
#if (defined _MSC_VER) && (_MSC_VER == 1200)
# pragma warning (disable : 4786) // too long name, harmless warning
#endif
#define BOOST_ARCHIVE_SOURCE
#include "core/system/Precompiled.h"
#include "core/serialization/TextSerializer.h"
// explicitly instantiate for this type of text stream
#include
Hummm.. good point.
But now I'm getting these compilation errors: IT says that the functions template are already defined :S. I wonder where.....
d:\flow project\flowengine\3rdparty\include\boost\archive\impl\basic_text_oarchive.ipp(48) : error C2995: 'void boost::archive::basic_text_oarchive<Archive>::newtoken(void)' : function template has already been defined d:\flow project\flowengine\3rdparty\include\boost\archive\basic_text_oarchive.hpp(72) : see declaration of 'boost::archive::basic_text_oarchive<Archive>::newtoken' d:\flow project\flowengine\3rdparty\include\boost\archive\impl\basic_text_oarchive.ipp(59) : error C2995: 'void boost::archive::basic_text_oarchive<Archive>::init(void)' : function template has already been defined d:\flow project\flowengine\3rdparty\include\boost\archive\basic_text_oarchive.hpp(103) : see declaration of 'boost::archive::basic_text_oarchive<Archive>::init' d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(26) : error C2995: 'boost::archive::detail::basic_serializer_map *boost::archive::detail::oserializer_map(void)' : function template has already been defined d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(22) : see declaration of 'boost::archive::detail::oserializer_map' d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(38) : error C2995: 'boost::archive::detail::archive_pointer_oserializer<Archive>::archive_pointer_oserializer(const boost::serialization::extended_type_info &)' : function template has already been defined d:\flow project\flowengine\3rdparty\include\boost\archive\detail\archive_pointer_oserializer.hpp(40) : see declaration of 'boost::archive::detail::archive_pointer_oserializer<Archive>::archive_pointer_oserializer' d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(48) : error C2995: 'const boost::archive::detail::basic_pointer_oserializer *boost::archive::detail::archive_pointer_oserializer<Archive>::find(const boost::serialization::extended_type_info &)' : function template has already been defined d:\flow project\flowengine\3rdparty\include\boost\archive\detail\archive_pointer_oserializer.hpp(56) : see declaration of 'boost::archive::detail::archive_pointer_oserializer<Archive>::find' d:\flow project\flowengine\3rdparty\include\boost\archive\impl\archive_pointer_oserializer.ipp(59) : error C2995: 'boost::archive::detail::archive_pointer_oserializer<Archive>::~archive_pointer_oserializer(void)' : function template has already been defined d:\flow project\flowengine\3rdparty\include\boost\archive\detail\archive_pointer_oserializer.hpp(48) : see declaration of 'boost::archive::detail::archive_pointer_oserializer<Archive>::~archive_pointer_oserializer'
On 1/11/07, Robert Ramey
wrote: Miguel Silvestre wrote:
a) But I'm deriving it from text_archive_imp
Sorry, I didn't see that - the IArchive threw me for a loop.
Look for the explicit instantiation at the bottom of text_oarchive.cpp. Include something similar in your own code.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre
-- Miguel Silvestre
you've included *.ipp files twice. Once in TextSerializer.h and again in in your instantiation. The *.ipp files shouldn't be in the TextSerializer.h header Robert Ramey
So true! And so stupid of me.... LOL
Ok! It's compiling and running..
But with warnings:
d:\flow project\flowengine\3rdparty\include\boost\serialization\extended_type_info_typeid.hpp(92)
: warning C4541: 'typeid' used on polymorphic type
'FlowEngine::Serializer' with /GR-; unpredictable behavior may result
d:\flow
project\flowengine\3rdparty\include\boost\serialization\extended_type_info_typeid.hpp(86)
: while compiling class template member function 'const
boost::serialization::extended_type_info
*boost::serialization::detail::extended_type_info_typeid_1<T>::get_derived_extended_type_info(const
FlowEngine::Serializer &)'
with
[
T=const FlowEngine::Serializer
]
d:\flow
project\flowengine\3rdparty\include\boost\serialization\extended_type_info_typeid.hpp(111)
: see reference to class template instantiation
'boost::serialization::detail::extended_type_info_typeid_1<T>' being
compiled
with
[
T=const FlowEngine::Serializer
]
d:\flow
project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(131)
: see reference to class template instantiation
'boost::serialization::extended_type_info_typeid<T>' being compiled
with
[
T=const FlowEngine::Serializer
]
d:\flow
project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(128)
: while compiling class template member function 'bool
boost::archive::detail::oserializer
you've included *.ipp files twice. Once in TextSerializer.h and again in in your instantiation. The *.ipp files shouldn't be in the TextSerializer.h header
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre
Another thing!
I've settled that for text binary and xml archives.
Now I want a method that just saves data (binary to the file).
like
void Serialize(void* data, size_t size);
I mean I'm serializing an object but I want to store some data, just store it.
How can I make that? If it is a text or a xml file it's ok. You see
the other members of the object and the void * you see it but just
strange characters.
Thanks
On 1/12/07, Miguel Silvestre
So true! And so stupid of me.... LOL
Ok! It's compiling and running.. But with warnings:
d:\flow project\flowengine\3rdparty\include\boost\serialization\extended_type_info_typeid.hpp(92) : warning C4541: 'typeid' used on polymorphic type 'FlowEngine::Serializer' with /GR-; unpredictable behavior may result d:\flow project\flowengine\3rdparty\include\boost\serialization\extended_type_info_typeid.hpp(86) : while compiling class template member function 'const boost::serialization::extended_type_info *boost::serialization::detail::extended_type_info_typeid_1<T>::get_derived_extended_type_info(const FlowEngine::Serializer &)' with [ T=const FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\serialization\extended_type_info_typeid.hpp(111) : see reference to class template instantiation 'boost::serialization::detail::extended_type_info_typeid_1<T>' being compiled with [ T=const FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(131) : see reference to class template instantiation 'boost::serialization::extended_type_info_typeid<T>' being compiled with [ T=const FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(128) : while compiling class template member function 'bool boost::archive::detail::oserializer
::is_polymorphic(void) const' with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(264) : see reference to class template instantiation 'boost::archive::detail::oserializer ' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(263) : while compiling class template member function 'void boost::archive::detail::save_non_pointer_type ::save_standard::invoke(Archive &,const T &)' with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(322) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type ::save_standard' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(310) : while compiling class template member function 'void boost::archive::detail::save_non_pointer_type ::invoke(Archive &,const T &)' with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(536) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type ' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\basic_binary_oarchive.hpp(70) : see reference to function template instantiation 'void boost::archive::save (Archive &,const T &)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\binary_oarchive.hpp(47) : see reference to function template instantiation 'void boost::archive::basic_binary_oarchive<Archive>::save_override<T>(T &,int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\engine\include\core\serialization\binaryserializer.h(54) : see reference to function template instantiation 'void boost::archive::binary_oarchive_impl<Archive>::save_override<T>(T &,int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\interface_oarchive.hpp(78) : see reference to function template instantiation 'void FlowEngine::BinaryArchiveO::save_override<T>(T &,int)' being compiled with [ T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\serialization\nvp.hpp(77) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator <<<const T>(T &)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\serialization\access.hpp(93) : see reference to function template instantiation 'void boost::serialization::nvp<T>::save<Archive>(Archivex &,const unsigned int) const' being compiled with [ T=FlowEngine::Serializer, Archive=FlowEngine::BinaryArchiveO, Archivex=FlowEngine::BinaryArchiveO ] d:\flow project\flowengine\3rdparty\include\boost\serialization\split_member.hpp(43) : see reference to function template instantiation 'void boost::serialization::access::member_save (Archive &,T &,const unsigned int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\serialization\split_member.hpp(42) : while compiling class template member function 'void boost::serialization::detail::member_saver ::invoke(Archive &,const T &,const unsigned int)' with [ Archive=FlowEngine::BinaryArchiveO, T=boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\serialization\split_member.hpp(69) : see reference to class template instantiation 'boost::serialization::detail::member_saver ' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\serialization\nvp.hpp(87) : see reference to function template instantiation 'void boost::serialization::split_member (Archive &,boost::serialization::nvp<T> &,const unsigned int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\serialization\access.hpp(109) : see reference to function template instantiation 'void boost::serialization::nvp<T>::serialize<Archive>(Archive &,const unsigned int)' being compiled with [ T=FlowEngine::Serializer, Archive=FlowEngine::BinaryArchiveO ] d:\flow project\flowengine\3rdparty\include\boost\serialization\serialization.hpp(81) : see reference to function template instantiation 'void boost::serialization::access::serialize (Archive &,T &,const unsigned int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=const boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\serialization\serialization.hpp(140) : see reference to function template instantiation 'void boost::serialization::serialize (Archive &,T &,const unsigned int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=const boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(257) : see reference to function template instantiation 'void boost::serialization::serialize_adl (Archive &,T &,const unsigned int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=const boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(250) : while compiling class template member function 'void boost::archive::detail::save_non_pointer_type ::save_only::invoke(Archive &,const boost::serialization::nvpFlowEngine::Serializer &)' with [ Archive=FlowEngine::BinaryArchiveO, T=boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(322) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type ::save_only' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(310) : while compiling class template member function 'void boost::archive::detail::save_non_pointer_type ::invoke(Archive &,const boost::serialization::nvpFlowEngine::Serializer &)' with [ Archive=FlowEngine::BinaryArchiveO, T=boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(536) : see reference to class template instantiation 'boost::archive::detail::save_non_pointer_type ' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\basic_binary_oarchive.hpp(70) : see reference to function template instantiation 'void boost::archive::save (Archive &,const T &)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=const boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\binary_oarchive.hpp(47) : see reference to function template instantiation 'void boost::archive::basic_binary_oarchive<Archive>::save_override<T>(T &,int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=const boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\engine\include\core\serialization\binaryserializer.h(54) : see reference to function template instantiation 'void boost::archive::binary_oarchive_impl<Archive>::save_override<T>(T &,int)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=const boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\interface_oarchive.hpp(78) : see reference to function template instantiation 'void FlowEngine::BinaryArchiveO::save_override<T>(T &,int)' being compiled with [ T=const boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\interface_oarchive.hpp(86) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator <<<T>(T &)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=const boost::serialization::nvpFlowEngine::Serializer ] d:\flow project\flowengine\engine\include\core\serialization\binaryserializer.h(80) : see reference to function template instantiation 'Archive &boost::archive::detail::interface_oarchive<Archive>::operator & (const boost::serialization::nvp<T> &)' being compiled with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] d:\flow project\flowengine\3rdparty\include\boost\smart_cast.hpp(76) : warning C4541: 'dynamic_cast' used on polymorphic type 'boost::archive::detail::basic_oarchive' with /GR-; unpredictable behavior may result d:\flow project\flowengine\3rdparty\include\boost\smart_cast.hpp(87) : see reference to function template instantiation 'T boost::smart_cast_impl::reference<T>::polymorphic::cross::cast<U>(U &)' being compiled with [ T=FlowEngine::BinaryArchiveO &, U=boost::archive::detail::basic_oarchive ] d:\flow project\flowengine\3rdparty\include\boost\smart_cast.hpp(135) : see reference to function template instantiation 'T boost::smart_cast_impl::reference<T>::polymorphic::cast<U>(U &)' being compiled with [ T=FlowEngine::BinaryArchiveO &, U=boost::archive::detail::basic_oarchive ] d:\flow project\flowengine\3rdparty\include\boost\smart_cast.hpp(293) : see reference to function template instantiation 'T boost::smart_cast_impl::reference<T>::cast<U>(U &)' being compiled with [ T=FlowEngine::BinaryArchiveO &, U=boost::archive::detail::basic_oarchive ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(149) : see reference to function template instantiation 'T boost::smart_cast_reference (U &)' being compiled with [ T=FlowEngine::BinaryArchiveO &, Archive=FlowEngine::BinaryArchiveO, U=boost::archive::detail::basic_oarchive ] d:\flow project\flowengine\3rdparty\include\boost\archive\detail\oserializer.hpp(145) : while compiling class template member function 'void boost::archive::detail::oserializer ::save_object_data(boost::archive::detail::basic_oarchive &,const void *) const' with [ Archive=FlowEngine::BinaryArchiveO, T=FlowEngine::Serializer ] On 1/11/07, Robert Ramey
wrote: you've included *.ipp files twice. Once in TextSerializer.h and again in in your instantiation. The *.ipp files shouldn't be in the TextSerializer.h header
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre
-- Miguel Silvestre
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
Use binary_object.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre
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
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
wrote: Use binary_object.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre
-- Miguel Silvestre
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
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
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
wrote: Use binary_object.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre
-- Miguel Silvestre
-- Miguel Silvestre
Hello,
http://www.boost.org/libs/serialization/doc/serialization.html#registration
I hope this helps.
Regards,
Leon Mergen
http://www.solatis.com
On 1/15/07, Miguel Silvestre
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
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
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
wrote: Use binary_object.
Robert Ramey
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Miguel Silvestre
-- Miguel Silvestre
-- Miguel Silvestre _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Leon Mergen http://www.solatis.com
participants (4)
-
Leon Mergen
-
Matthias Troyer
-
Miguel Silvestre
-
Robert Ramey