Closed gokhansolak closed 4 years ago
Thanks for pointing this out. It is good to know that someone is using the serialization functionality. To be honest, getting boost:serialization to work was a real pain, and so is keeping it running. See also the "Serialization" page in the Doxygen documentation. So I've considered disabling/replacing it several times. Now that I know people are using it, I am more motivated to maintain this feature.
Since the main use case is now to use C++ for the DMPs, and Python for the optimization (see https://github.com/stulp/dmpbbo/blob/master/README.md#why-python-and-c) I did indeed remove the boost serialization from the bbo and dmp_bbo modules in 1d77323d7 and 26f944694. This may be causing the "unregistered class" error above (i.e. your XML file may contain for instance a serialized object of the DistributionGaussian class, but this class is now no longer registered, because it is part of the bbo library).
Could you provide the XML file you are using? That would help with debugging.
Thank you for your answer. I don't serialize bbo modules.
I actually solved the problem. I run diff between the old and new xml files and noticed that the new one doesn't contain DmpBbo namespace in class_name attributes. When I added the namespaces the boost::serialization worked. I also created a Gist file that adds DmpBbo::
prefix to all class names in xml files in a directory, for those who may have a similar problem.
Thank you for sharing your solution. Good to know that it is easy to make the XML files conform to the new syntax. I've included it in the documentation in d2fe4cb1e10f
I think this change of serialization behaviour must have happened in commit fb936a2e1ac, when I moved the registering of classes from the hpp file where the class is declared into one hpp file per module. This is less elegant and less modular, but since then, serialization works more robustly, i.e. not causing as many run-time crashes as you have experienced.
I have been using older versions of DMPBBO (~2018). Recently I updated to the latest and observed that I can't save or load serialized DMPs anymore. After some debugging, I noticed that adding the
#include "dmp/serialization.hpp"
line solves the saving issue. It is hard to spot since the program still builds without this header and it used to work without the header in the older versions. I suggest mentioning this in the documentation.I still can't load the old DMP archives with the following error:
Probably, I will need to do some changes in the old XML files. I will send the updates.