From: Bjoern Sikora Date: Wed, 17 Jul 2013 14:57:57 +0000 (+0200) Subject: Splitted method serialize() into load() and save() as this is needed to introduce... X-Git-Tag: v1.1~6 X-Git-Url: http://developer.intra2net.com/git/?p=bpdyndnsd;a=commitdiff_plain;h=8dbf68300716b310105f8e4f217955300e6413f1 Splitted method serialize() into load() and save() as this is needed to introduce versioning. Increased class version to 1. Set member Activated to be available with version 1 only. From older version state files this member is not read. --- diff --git a/src/service.hpp b/src/service.hpp index 7d71d97..289e629 100644 --- a/src/service.hpp +++ b/src/service.hpp @@ -14,6 +14,8 @@ #include #include +#include +#include #include #include @@ -47,7 +49,7 @@ private: friend class boost::serialization::access; template - void serialize(Archive & ar, const unsigned int version) + void save(Archive & ar, const unsigned int version) const { // protocol and hostname are the unique identifier for each service. ar & Protocol; @@ -59,8 +61,29 @@ private: ar & MaxUpdatesWithinInterval; ar & MaxEqualUpdatesInSuccession; ar & DNSCacheTTL; + + // Activated was introduced with version 1. ar & Activated; } + template + void load(Archive & ar, const unsigned int version) + { + // protocol and hostname are the unique identifier for each service. + ar & Protocol; + ar & Hostname; + // lastupdated and actual_ip must also be serialized, cause these are essential infos of each service. + ar & LastUpdates; + ar & ActualIP; + ar & UpdateInterval; + ar & MaxUpdatesWithinInterval; + ar & MaxEqualUpdatesInSuccession; + ar & DNSCacheTTL; + + // Activated was introduced with version 1. + if ( version >= 1 ) + ar & Activated; + } + BOOST_SERIALIZATION_SPLIT_MEMBER() Logger::Ptr Log; @@ -135,4 +158,6 @@ public: bool operator!= (const Service& other) const; }; +BOOST_CLASS_VERSION(Service,1) + #endif