diff options
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | settings_manager.mako.hpp | 21 |
2 files changed, 23 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 895ce17..ec6df59 100644 --- a/configure.ac +++ b/configure.ac @@ -41,5 +41,9 @@ AS_IF([test "x$SETTINGS_PERSIST_PATH" == "x"], \ AC_DEFINE_UNQUOTED([SETTINGS_PERSIST_PATH], ["$SETTINGS_PERSIST_PATH"], \ [Path of directory housing persisted settings]) +AC_ARG_VAR(CLASS_VERSION, [Class version to register with Cereal]) +AS_IF([test "x$CLASS_VERSION" == "x"], [CLASS_VERSION=1]) +AC_DEFINE_UNQUOTED([CLASS_VERSION], [$CLASS_VERSION], [Class version to register with Cereal]) + AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/settings_manager.mako.hpp b/settings_manager.mako.hpp index 9e0b3fd..09a5a1f 100644 --- a/settings_manager.mako.hpp +++ b/settings_manager.mako.hpp @@ -216,7 +216,8 @@ class Impl : public Parent template<class Archive> void save(Archive& a, - const Impl& setting) + const Impl& setting, + const std::uint32_t version) { <% props = [] @@ -231,7 +232,8 @@ props = ', '.join(props) template<class Archive> void load(Archive& a, - Impl& setting) + Impl& setting, + const std::uint32_t version) { <% props = [] %>\ % for index, item in enumerate(settingsDict[object]): @@ -349,3 +351,18 @@ class Manager } // namespace settings } // namespace phosphor + +// Now register the class version with Cereal +% for object in objects: +<% + classname = "phosphor::settings" + ns = object.split('/') + ns.pop(0) +%>\ +% for n in ns: +<% + classname += "::" + n +%>\ +% endfor +CEREAL_CLASS_VERSION(${classname + "::Impl"}, CLASS_VERSION); +% endfor |