From 009cf50454e5d545003ecc93acd959092612b1b0 Mon Sep 17 00:00:00 2001 From: Marcos Bento Date: Fri, 29 Nov 2024 08:19:38 +0000 Subject: [PATCH] Fix registration of RepeatDateTime serialisation Re ECFLOW-1992 --- .../attribute/src/ecflow/attribute/RepeatAttr.cpp | 3 +++ libs/core/src/ecflow/core/Chrono.cpp | 15 +++++++++++++++ libs/core/src/ecflow/core/Chrono.hpp | 12 ++++++++++++ libs/core/src/ecflow/core/Serialization.hpp | 1 + 4 files changed, 31 insertions(+) diff --git a/libs/attribute/src/ecflow/attribute/RepeatAttr.cpp b/libs/attribute/src/ecflow/attribute/RepeatAttr.cpp index bc7f89ae0..ba522ab4f 100644 --- a/libs/attribute/src/ecflow/attribute/RepeatAttr.cpp +++ b/libs/attribute/src/ecflow/attribute/RepeatAttr.cpp @@ -1779,6 +1779,7 @@ bool RepeatDay::operator==(const RepeatDay& rhs) const { } return true; } + // ========================================================================================= template @@ -1840,6 +1841,7 @@ void Repeat::serialize(Archive& ar, std::uint32_t const version) { CEREAL_TEMPLATE_SPECIALIZE(RepeatBase); CEREAL_TEMPLATE_SPECIALIZE_V(RepeatDate); +CEREAL_TEMPLATE_SPECIALIZE_V(RepeatDateTime); CEREAL_TEMPLATE_SPECIALIZE_V(RepeatDateList); CEREAL_TEMPLATE_SPECIALIZE_V(RepeatInteger); CEREAL_TEMPLATE_SPECIALIZE_V(RepeatEnumerated); @@ -1848,6 +1850,7 @@ CEREAL_TEMPLATE_SPECIALIZE_V(RepeatDay); CEREAL_TEMPLATE_SPECIALIZE_V(Repeat); CEREAL_REGISTER_TYPE(RepeatDate) +CEREAL_REGISTER_TYPE(RepeatDateTime) CEREAL_REGISTER_TYPE(RepeatDateList) CEREAL_REGISTER_TYPE(RepeatInteger) CEREAL_REGISTER_TYPE(RepeatEnumerated) diff --git a/libs/core/src/ecflow/core/Chrono.cpp b/libs/core/src/ecflow/core/Chrono.cpp index 17ad3fc65..cbe89a7ef 100644 --- a/libs/core/src/ecflow/core/Chrono.cpp +++ b/libs/core/src/ecflow/core/Chrono.cpp @@ -17,6 +17,8 @@ #include +#include "ecflow/core/Serialization.hpp" + namespace ecf { namespace { @@ -237,4 +239,17 @@ bool operator>=(const Duration& rhs, const Duration& lhs) { return !(rhs < lhs); } +template +void Instant::serialize(Archive& ar, std::uint32_t const version) { + ar(instant_); +} + +template +void Duration::serialize(Archive& ar, std::uint32_t const version) { + ar(duration_); +} + +CEREAL_TEMPLATE_SPECIALIZE_V(Instant); +CEREAL_TEMPLATE_SPECIALIZE_V(Duration); + } // namespace ecf diff --git a/libs/core/src/ecflow/core/Chrono.hpp b/libs/core/src/ecflow/core/Chrono.hpp index d590f8979..9e96c515d 100644 --- a/libs/core/src/ecflow/core/Chrono.hpp +++ b/libs/core/src/ecflow/core/Chrono.hpp @@ -14,6 +14,10 @@ #include #include +namespace cereal { +class access; +} + namespace ecf { class Instant; @@ -47,6 +51,10 @@ class Instant { private: instant_t instant_; + + friend class cereal::access; + template + void serialize(Archive& ar, std::uint32_t const version); }; std::ostream& operator<<(std::ostream& o, const Instant& v); @@ -76,6 +84,10 @@ class Duration { private: duration_t duration_; + + friend class cereal::access; + template + void serialize(Archive& ar, std::uint32_t const version); }; std::ostream& operator<<(std::ostream& o, const Duration& v); diff --git a/libs/core/src/ecflow/core/Serialization.hpp b/libs/core/src/ecflow/core/Serialization.hpp index 8eb45e579..20a5d5ac6 100644 --- a/libs/core/src/ecflow/core/Serialization.hpp +++ b/libs/core/src/ecflow/core/Serialization.hpp @@ -20,6 +20,7 @@ #include #include +#include #include #include #include