Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct registration of RepeatDateTime serialisation ECFLOW-1992 #137

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libs/attribute/src/ecflow/attribute/RepeatAttr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,7 @@ bool RepeatDay::operator==(const RepeatDay& rhs) const {
}
return true;
}

// =========================================================================================

template <class Archive>
Expand Down Expand Up @@ -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);
Expand All @@ -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)
Expand Down
15 changes: 15 additions & 0 deletions libs/core/src/ecflow/core/Chrono.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include <boost/lexical_cast.hpp>

#include "ecflow/core/Serialization.hpp"

namespace ecf {

namespace {
Expand Down Expand Up @@ -237,4 +239,17 @@ bool operator>=(const Duration& rhs, const Duration& lhs) {
return !(rhs < lhs);
}

template <class Archive>
void Instant::serialize(Archive& ar, std::uint32_t const version) {
ar(instant_);
}

template <class Archive>
void Duration::serialize(Archive& ar, std::uint32_t const version) {
ar(duration_);
}

CEREAL_TEMPLATE_SPECIALIZE_V(Instant);
CEREAL_TEMPLATE_SPECIALIZE_V(Duration);

} // namespace ecf
12 changes: 12 additions & 0 deletions libs/core/src/ecflow/core/Chrono.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
#include <chrono>
#include <string>

namespace cereal {
class access;
}

namespace ecf {

class Instant;
Expand Down Expand Up @@ -47,6 +51,10 @@ class Instant {

private:
instant_t instant_;

friend class cereal::access;
template <class Archive>
void serialize(Archive& ar, std::uint32_t const version);
};

std::ostream& operator<<(std::ostream& o, const Instant& v);
Expand Down Expand Up @@ -76,6 +84,10 @@ class Duration {

private:
duration_t duration_;

friend class cereal::access;
template <class Archive>
void serialize(Archive& ar, std::uint32_t const version);
};

std::ostream& operator<<(std::ostream& o, const Duration& v);
Expand Down
1 change: 1 addition & 0 deletions libs/core/src/ecflow/core/Serialization.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <string>

#include <cereal/archives/json.hpp>
#include <cereal/types/chrono.hpp>
#include <cereal/types/deque.hpp>
#include <cereal/types/map.hpp>
#include <cereal/types/memory.hpp>
Expand Down
Loading