Skip to content
Snippets Groups Projects
Commit 7f9e9654 authored by Martin Beseda's avatar Martin Beseda
Browse files

ENH: Added serialization method to NeuronDifferentiable class

parent cf24b803
No related branches found
No related tags found
No related merge requests found
......@@ -13,14 +13,28 @@
#include "Neuron.h"
BOOST_SERIALIZATION_ASSUME_ABSTRACT(lib4neuro::Neuron);
BOOST_CLASS_EXPORT_KEY(lib4neuro::Neuron);
struct lib4neuro::Neuron::access {
template<class Archive>
static void serialize(Archive &ar, lib4neuro::Neuron &n, const unsigned int version) {}
};
BOOST_SERIALIZATION_ASSUME_ABSTRACT(lib4neuro::NeuronDifferentiable);
BOOST_CLASS_EXPORT_KEY(lib4neuro::NeuronDifferentiable);
namespace lib4neuro {
struct Neuron::access {
template<class Archive>
static void serialize(Archive& ar,
Neuron& n,
const unsigned int version) {}
};
struct NeuronDifferentiable::access {
template<class Archive>
static void serialize(Archive& ar,
NeuronDifferentiable& n,
const unsigned int version) {
ar & boost::serialization::base_object<Neuron>(n);
}
};
}
namespace boost {
namespace serialization {
......@@ -38,6 +52,19 @@ namespace boost {
lib4neuro::Neuron::access::serialize(ar, n, version);
}
/**
* Serialization function
* @tparam Archive Boost library template
* @param ar Boost parameter - filled automatically during serialization!
* @param n NeuronDifferentiable instance
* @param version Boost parameter - filled automatically during serialization!
*/
template<class Archive>
void serialize(Archive & ar, lib4neuro::NeuronDifferentiable& n, const unsigned int version)
{
lib4neuro::NeuronDifferentiable::access::serialize(ar, n, version);
}
} // namespace serialization
} // namespace boost
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment