problems with serialization library
Hi everybody,
I'm having deep troubles with the serialization library. I need to
serialize a class (called VisualisationObject3D),
but every time I try to serialize it I get a static compile error
boost::STATIC_ASSERTION_FAILURE<x> referring to the line: oa << _obj
(below you find the error stack and the source code).
Since the error has to do with the tracking I tried disabling the
trackin also, but without success.
CAN SOMEBODY HELP ME?
thanks in advance,
Mauro.
------------------------ SOURCE CODE -------------------
class VisualisationPoint3D;
class VisualisationObject3D
{
public:
VisualisationObject3D();
~VisualisationObject3D(){}
std::vector<VisualisationPoint3D> m_vPoints;
}
void send_3D_object(VisualisationObject3D* _p){
tcpserialize::serialize_with_boost_to_socket<VisualisationObject3D>(_p,g_socket);
}
template<class T>
bool serialize_with_boost_to_socket(const T* _obj, StreamSocket* send_socket){
std::strstream ss;
{
boost::archive::text_oarchive oa(ss);
/*ERROR*/ oa << _obj;
}
char* _serialized_data=ss.rdbuf()->str();
size_t _serialized_data_size = ss.rdbuf()->pcount();
......
return true;
};
BOOST_CLASS_TRACKING(VisualisationPoint3D, boost::serialization::track_never)
BOOST_CLASS_TRACKING(VisualisationObject3D, boost::serialization::track_never)
namespace boost {
namespace serialization {
template<class Archive>
void serialize(Archive & ar, VisualisationPoint3D & o, const unsigned
int /* version */)
{
ar & ....;
}
template<class Archive>
void serialize(Archive & ar, VisualisationObject3D & o, const unsigned
int /* file_version */){
ar & .....;
}
} // namespace serialization
} // namespace boost
------------------------ ERROR -------------
the error stack is here attached:
d:\boost_1_33_1\boost\archive\detail\oserializer.hpp(567) : error
C2027: Verwendung des undefinierten Typs
"boost::STATIC_ASSERTION_FAILURE<x>"
with
[
x=false
]
d:\boost_1_33_1\boost\archive\detail\oserializer.hpp(567):
Siehe Verweis auf Instanziierung der kompilierten Klassenvorlage
'boost::STATIC_ASSERTION_FAILURE<x>'
with
[
x=false
]
d:\boost_1_33_1\boost\archive\basic_text_oarchive.hpp(78):
Siehe Verweis auf Instanziierung der kompilierten Funktionsvorlage
'void boost::archive::save
try the following template<class T> bool serialize_with_boost_to_socket(T const * const _obj, StreamSocket* send_socket){ std::strstream ss; { boost::archive::text_oarchive oa(ss); /ERROR/ oa << _obj; } char* _serialized_data=ss.rdbuf()->str(); size_t _serialized_data_size = ss.rdbuf()->pcount(); ...... return true; }; mauro gargano wrote:
Hi everybody,
I'm having deep troubles with the serialization library. I need to serialize a class (called VisualisationObject3D), but every time I try to serialize it I get a static compile error boost::STATIC_ASSERTION_FAILURE<x> referring to the line: oa << _obj (below you find the error stack and the source code).
Since the error has to do with the tracking I tried disabling the trackin also, but without success.
CAN SOMEBODY HELP ME?
]
participants (2)
-
mauro gargano
-
Robert Ramey