I would like to create a (json) file manually (with python) and load it then with cereal into my c++ application.
Saving and loading using ceral works fine. However, the polymorphic_ids in the json file are not clear to me.
Here a more clear example: This is the object, which is generated by the cereal framework:
{
"array1": [
{
"key": 0,
"value": {
"ptr_wrapper": {
"id": 2147483649, //!-- ID1
"data": {
...some float fields...
}
}
}
},
{
"key": 1,
"value": {
"ptr_wrapper": {
"id": 2147483650, //!-- This is previous ID+1 and so on...
"data": {
... some float fields...
}
}
}
}
],
"array2": [
{
"key": 0,
"value": {
"polymorphic_id": 2147483649, //!-- this is the very first ID from array 1.
"polymorphic_name": "my_struct_name",
"ptr_wrapper": {
"id": 2147483651, //this ID1+N Elements from array1
"data": {
... also some float stuff...
}
}
}
}
]
}
As I observe the number generation, the very first ID is increased. The second array uses the first ID as its polymorphic ID and further increases the numbers.
So is there some logic why these numbers have been used? Is it save to just use them all the time or will these change when I run my c++ importer on another machine?