Imbricated data

18 views
Skip to first unread message

yann suisini

unread,
Feb 12, 2020, 2:30:14 PM2/12/20
to cereal serialization library
Hi ,

I have to write a config file from a node editor with something like this

struct Node
{
   
int id;
   
string name;
}


struct Pin
{
   
int id;
   
Node* node;
}


struct Link
{
   
int id;
   
Pin*  start;
   
Pin* end;
}


struct Config
{
   std
::vector<Node> Nodes;
   std
::vector<Pin> Pins;
   std
::vector<Link> Links;
}


How can i serialize the topover object Config ? and deserialize ?

From the documentation , I cannot figure out how manage imbricated struct/objects  ?

Thanks !

Yann

Randolph Voorhies

unread,
Mar 20, 2020, 8:42:37 AM3/20/20
to cereal serialization library
Hi Yann,
  If you define a serialization function for each of your structs then serializing Config should "just work".  See the docs here for details: https://uscilab.github.io/cereal/serialization_functions.html

If you still have trouble, try posting a minimal compilable example to this list.
Reply all
Reply to author
Forward
0 new messages