I am quite new trying msgpack. I need to serialize an object (instance of an user defined class), that contains pointers (internal tree, hashes,etc), and some basic types attributes.
Until now I can do what is done in the quick example of msgpack.org wiki, just serialize the class to a msgpack::sbuffer
, and then read the buffer to unserialize.
But now, I want to send that buffer to a file, or the serialization result to a file and then unserialize it.
Can anyone give me some tip on how to do it? I browse and read enough to get tired of it :)
My code look like this:
msgpack::sbuffer sbuf;
msgpack::pack(sbuf, cluster); //cluster is the instance of my class clustering
//HERE I SHOULD SEND THE BUFFER TO A STREAM FILE, AND THEN LOAD IT IN THE UNPACK;
msgpack::unpacked msg;
msgpack::unpack(&msg, sbuf.data(), sbuf.size());
msgpack::object obj = msg.get();
clustering clustUnser
obj.convert(&clustUnser);
thanks everybody!
bests,
Luchux.