Skip to content
Snippets Groups Projects
NeuralNetworkSumSerialization.h 1.42 KiB
Newer Older

#ifndef LIB4NEURO_NEURALNETWORKSUMSERIALIZATION_H
#define LIB4NEURO_NEURALNETWORKSUMSERIALIZATION_H

#include <boost/serialization/base_object.hpp>
#include <boost/serialization/export.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

#include "NeuralNetworkSum.h"
#include "NeuralNetworkSerialization.h"

BOOST_CLASS_EXPORT_KEY(lib4neuro::NeuralNetworkSum);
namespace lib4neuro {
    struct NeuralNetworkSum::access {
        template<class Archive>
        static void serialize(Archive &ar, NeuralNetworkSum &n, const unsigned int version) {
            ar & boost::serialization::base_object<NeuralNetwork>(n);
            ar & n.summand;
            ar & n.summand_coefficient;
        }
    };
}

namespace boost {
    namespace serialization {

        /**
         * Serialization function
         * @tparam Archive Boost library template
         * @param ar Boost parameter - filled automatically during serialization!
         * @param n NeuralNetworkSum instance
         * @param version Boost parameter - filled automatically during serialization!
         */
        template<class Archive>
        void serialize(Archive & ar, lib4neuro::NeuralNetworkSum& n, const unsigned int version)
            lib4neuro::NeuralNetworkSum::access::serialize(ar, n, version);
#endif //LIB4NEURO_NEURALNETWORKSUMSERIALIZATION_H