cereal icon indicating copy to clipboard operation
cereal copied to clipboard

Is it possible deserialize from unknown type?

Open pi1ot opened this issue 2 years ago • 0 comments

Someone serialize some data type A by cereal to string buffer, and I want to deserialize buffer, print as json format, without type A's class declaration, is it possible?

such as:

// process-a
struct SomeType {
  ……  
  template<class Archive>
  void serialize(Archive& archive) {
    archive(……);
  }
};

SomeType data;
std::stringstream ss;
{
  cereal::PortableBinaryOutputArchive oarchive(ss);
  oarchive(data);
}
send_buffer_to_process_b(ss.str());
// process-b
std::string buffer;
recv_buffer_from_process_a(buffer);

// how to deserialize buffer, print as json format, without 'SomeType' info?

thanks.

pi1ot avatar Sep 16 '21 11:09 pi1ot