Skip to content
Snippets Groups Projects
NormalizationStrategySerialization.h 2.19 KiB
Newer Older
  • Learn to ignore specific revisions
  • //
    // Created by martin on 22.11.18.
    //
    
    #ifndef LIB4NEURO_NORMALIZATIONSTRATEGYSERIALIZATION_H
    #define LIB4NEURO_NORMALIZATIONSTRATEGYSERIALIZATION_H
    
    #include <boost/serialization/base_object.hpp>
    #include <boost/archive/text_oarchive.hpp>
    #include <boost/archive/text_iarchive.hpp>
    #include <boost/serialization/export.hpp>
    
    #include <boost/serialization/vector.hpp>
    
    
    #include "NormalizationStrategy.h"
    
    BOOST_SERIALIZATION_ASSUME_ABSTRACT(NormalizationStrategy);
    BOOST_CLASS_EXPORT_KEY(NormalizationStrategy);
    BOOST_CLASS_EXPORT_KEY(DoubleUnitStrategy);
    
    struct NormalizationStrategy::access {
        template<class Archive>
        static void serialize(Archive &ar, NormalizationStrategy& ns, const unsigned int version) {
    
        }
    };
    
    struct DoubleUnitStrategy::access {
        template<class Archive>
        static void serialize(Archive &ar, DoubleUnitStrategy &s, const unsigned int version) {
            ar & boost::serialization::base_object<NormalizationStrategy>(s);
        }
    };
    
    namespace boost {
        namespace serialization {
    
            /**
             * Serialization function
             * @tparam Archive Boost library template
             * @param ar Boost parameter - filled automatically during serialization!
             * @param ns NormalizationStrategy instance
             * @param version Boost parameter - filled automatically during serialization!
             */
            template<class Archive>
            void serialize(Archive & ar, NormalizationStrategy& ns, const unsigned int version)
            {
                NormalizationStrategy::access::serialize(ar, ns, version);
            }
    
            /**
             * Serialization function
             * @tparam Archive Boost library template
             * @param ar Boost parameter - filled automatically during serialization!
             * @param s DoubleUnitStrategy instance
             * @param version Boost parameter - filled automatically during serialization!
             */
            template<class Archive>
            void serialize(Archive & ar, DoubleUnitStrategy& s, const unsigned int version)
            {
                DoubleUnitStrategy::access::serialize(ar, s, version);
            }
        } // namespace serialization
    } // namespace boost
    
    #endif //LIB4NEURO_NORMALIZATIONSTRATEGYSERIALIZATION_H