#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 "../General/ExprtkWrapper.h"

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

//BOOST_CLASS_EXPORT_KEY(lib4neuro::NeuralNetworkSum);

namespace lib4neuro {
    class NeuralNetworkSum::NeuralNetworkSumImpl {
    public:
        std::vector<NeuralNetwork*>* summand;
        std::vector<ExprtkWrapper*>* summand_coefficient;
    };

    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.p_impl->summand;
            ar & n.p_impl->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);
        }

    } // namespace serialization
} // namespace boost

#endif //LIB4NEURO_NEURALNETWORKSUMSERIALIZATION_H