From c7659e07b2ec1e014a66b6f4ac31b95a60b497bb Mon Sep 17 00:00:00 2001 From: Nils Wentzell Date: Tue, 13 Aug 2024 17:17:22 -0400 Subject: [PATCH] Add deserialization function and add documentation strings --- c++/cppdlr/dlr_imfreq.hpp | 20 +++++++++++++++++--- c++/cppdlr/dlr_imtime.hpp | 20 +++++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/c++/cppdlr/dlr_imfreq.hpp b/c++/cppdlr/dlr_imfreq.hpp index 7640851..7e14e0b 100644 --- a/c++/cppdlr/dlr_imfreq.hpp +++ b/c++/cppdlr/dlr_imfreq.hpp @@ -261,9 +261,23 @@ namespace cppdlr { // -------------------- serialization ------------------- public: - template void serialize(Archive &ar) { // - ar & lambda_ & statistic & r & niom & dlr_rf & dlr_if & cf2if & if2cf.lu & if2cf.piv; - } + + /** + * Serialize the object into an archive by serializing all its members. + * The archive parameter must support the operator& to serialize each member. + * + * @param[in] ar Archive to serialize into + */ + void serialize(auto &ar) const { ar & lambda_ & statistic & r & niom & dlr_rf & dlr_if & cf2if & if2cf.lu & if2cf.piv; } + + /** + * Deserialize an object from the archive. This will initialize all members. + * The archive parameter must support the operator& to deserialize the members + * in the order they were serialized. + * + * @param[in] ar Archive to deserialize from + */ + void deserialize(auto &ar) { ar & lambda_ & statistic & r & niom & dlr_rf & dlr_if & cf2if & if2cf.lu & if2cf.piv; } // -------------------- hdf5 ------------------- diff --git a/c++/cppdlr/dlr_imtime.hpp b/c++/cppdlr/dlr_imtime.hpp index 8a37f93..9f0ab8c 100644 --- a/c++/cppdlr/dlr_imtime.hpp +++ b/c++/cppdlr/dlr_imtime.hpp @@ -831,7 +831,25 @@ namespace cppdlr { // -------------------- serialization ------------------- public: - template void serialize(Archive &ar) { // + + /** + * Serialize the object into an archive by serializing all its members. + * The archive parameter must support the operator& to serialize each member. + * + * @param[in] ar Archive to serialize into + */ + void serialize(auto &ar) const { + ar & lambda_ & r & dlr_rf & dlr_it & cf2it & it2cf.lu & it2cf.zlu & it2cf.piv & hilb & tcf2it & thilb & ttcf2it & ipmat & refl; + } + + /** + * Deserialize an object from the archive. This will initialize all members. + * The archive parameter must support the operator& to deserialize the members + * in the order they were serialized. + * + * @param[in] ar Archive to deserialize from + */ + void deserialize(auto &ar) { ar & lambda_ & r & dlr_rf & dlr_it & cf2it & it2cf.lu & it2cf.zlu & it2cf.piv & hilb & tcf2it & thilb & ttcf2it & ipmat & refl; }