Skip to content
Snippets Groups Projects
NeuronBinarySerialization.h 1.52 KiB
Newer Older
  • Learn to ignore specific revisions
  • 
    #ifndef LIB4NEURO_NEURON_BINARY_SERIALIZATION_H
    #define LIB4NEURO_NEURON_BINARY_SERIALIZATION_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 "NeuronBinary.h"
    
    
    BOOST_CLASS_EXPORT_KEY(lib4neuro::NeuronBinary);
    
     
    namespace lib4neuro {
        struct NeuronBinary::access {
            template<class Archive>
            static void serialize(Archive& ar,
                                  lib4neuro::NeuronBinary& n,
                                  const unsigned int version) {
                ar & boost::serialization::base_object<Neuron>(n);
            }
        };
    }
    
    
    namespace boost {
        namespace serialization {
    
            /**
             * Serialization function
             * @tparam Archive Boost library template
             * @param ar Boost parameter - filled automatically during serialization!
             * @param n NeuronBinary instance
             * @param version Boost parameter - filled automatically during serialization!
             */
            template<class Archive>
    
    Martin Beseda's avatar
    Martin Beseda committed
            void serialize(Archive& ar,
                           lib4neuro::NeuronBinary& n,
                           const unsigned int version) {
                lib4neuro::NeuronBinary::access::serialize(ar,
                                                           n,
                                                           version);
    
            }
    
        } // namespace serialization
    } // namespace boost
    
    
    #endif //LIB4NEURO_NEURON_BINARY_SERIALIZATION_H